What does func means in R-Format instruction set?
As the description mentions all R-type instructions (e.g. ADD
, AND
, SLL
and others) have the 6 most significant bits (= op) set to 0, that means the only way to distinguish between them is to look at the 6 least significant bits (= funct). In other words they determine the instruction type. Perhaps an example will help:
ADD $1, $2, $3
has:
op = 0 (as all R-type instructions)
rs = 2
rt = 3
rd = 1
shamt = 0
funct = 0x20 = 0b00000100000 = 32
The encoding will thus be:
0000 0000 0100 0011 0000 1000 0010 0000
For e.g. XOR
(another R-type) instruction funct is 0b100110 = 0x26 = 38
. So you "calculate" it by looking up what instruction you want to encode.
(taken from MIPS Instruction Reference).