Abstract
- Accepts a memory address with
Address
- Both
MemWrite
andMemRead
cannot be1
at the same time. WhenMemWrite
is1
,Write Data
is active and data is written to theAddress
. WhenMemRead
is1
,Read Data
is active and data is read from theAddress
Important
The result from the ALU is connected to
Address
. However, some instructions, like theadd
instruction, don’t involve the data element and would like the ALU result to be written back to a register. That is why we add a multiplexerMemToReg
after theRead Data
and theALU result
.
Read Data
RegDst
is set to0
, so theWR
is registerrt
ALUSrc
is set to1
, so theImmediate
value is sent to ALU, instead ofRD2
MemWrite
is set to0
, andMemRead
is set to1
, so the memory is read-only
Write Data
RegDst
is set to0
, so theWR
is registerrt
ALUSrc
is set to1
, so theImmediate
value is sent to ALU, instead ofRD2
MemWrite
is set to1
, andMemRead
is set to0
, so the memory is write-only
Important
There is a wire between the
RD2
andWrite Data
, so the data inside registerrt
can be written back to the memory.