Given the instruction
sd x12, 20(x13)
(ISA RV64I), what are the inputs and outputs of the encircled MUX?
My answer: if x[n]
is the value stored in register x
, and M[y]
is the value stored in memory address y
, then
Input 0: [x13] + 20
Input 1: M[[x13] + 20]
MemtoReg: 0
Output: [x13] + 20
The correct answer: the MUX outputs Input 1
as MemtoReg
is 1
, which I thought only happened whenever the we wish to write from memory to a register (e.g. with the ld
instruction).
RegWrite
will be 0. So no worries. \$\endgroup\$RegWrite=0
, why does it matter to you whetherMemToReg
is 1 or 0? \$\endgroup\$control unit
at the IF/ID latch and following logic. This is then pushed forward until it is needed in the WB stage. Either way, whether decoded one way or else the other way, the only important matter is that thecontrol unit
set things up so thatRegWrite
would be 0 when the time came. I just don't understand why you care so much about this. So long asRegWrite=0
the value ofMemToReg
isx
(don't care.) Either value has the exact same effect -- none at all. \$\endgroup\$