add
:
add $t1, $t2, $t3 # $t1 = $t2 + $t3 # rd = rs + rt |
rs
, rt
, and rd
.
Fields rs
and rt
are sources, and rd
is the destination.
The ALU function is in the funct
field and is decoded by the ALU control design.
The R-type instructions implemented include add
, sub
, AND
, OR
, and slt
.
The shamt
field is used only for shifts.
The figure shows a datapath for R-type instructions which includes two control signals: |
ALUCtrl
is derived from the funct
field because op=0
for R-type.
RegWrite
is used to enable the writing of the ALU result
.
$t2
(or rs
) and $t3
(or rt
), are read from the register file.
funct
field, of the instruction) to generate the ALU functions.
$t1
or rd
).