R-Format Instructions

HOME

BASIC TYPES




Define “fields” of the following number of bits each:



For simplicity, each field has a name:



Important: Each field is viewed as a 5- or 6-bit unsigned integer, not as part of a 32-bit integer. Consequence: 5-bit fields can represent any number 0-31, while 6-bit fields can represent any number 0-63.


What do these field integer values tell us?

opcode: partially specifies what instruction it is (Note: This number is equal to 0 for all R-Format instructions.)

funct: combined with opcode, this number exactly specifies the instruction

More fields:

rs (Source Register): generally used to specify register containing first operand

rt (Target Register): generally used to specify register containing second operand (note that name is misleading)

rd (Destination Register): generally used to specify register which will receive result of computation

Notes about register fields:

Each register field is exactly 5 bits, which means that it can specify any unsigned integer in the range 0-31. Each of these fields specifies one of the 32 registers by number.

The word “generally” was used because there are exceptions, such as: mult and div have nothing important in the rd field since the dest registers are hi and lo

mfhi and mflo have nothing important in the rs and rt fields since the source is determined by the instruction

Final field:

shamt: This field contains the amount a shift instruction will shift by. Shifting a 32-bit word by more than 31 is useless, so this field is only 5 bits (so it can represent the numbers 0-31). This field is set to 0 in all but the shift instructions.