Adding Data Memory to Datapath
The figure shows the datapath including data memory for load and store (I-type) instructions where
- The ALU is also used to calculate data memory address.
BusB
is connected to Data_in
of data memory for store instructions.
It also includes three multiplexors:
- The left one selects
RW
as either rt
(I-type) or rd
(R-type).
- The middle one selects the second ALU input as either source register
rt
(R-type) data on BusB
or the extended immediate (I-type).
- The right one selects data on
BusW
as either ALU result
(R- or I- type) or memory Data_out
(I-type).
ALUCtrl
is derived from either the op
(I-type) or funct
(R-type) field.
RegWrite
enables the writing of the ALU result
or Data_out
.
ExtOp
controls the extension of the 16-bit immediate.
RegDst
selects the destination as either rt
(I-type) or rd
(R-type).
ALUSrc
selects the second ALU source as BusB
(R-type) or extended immediate (I-type).
MemRead
is for load instructions.
MemWrite
is for store instructions.
MemtoReg
selects data on BusW
as ALU result
(R- or I- type) or memory Data_out
(I-type).