0
\$\begingroup\$

Given the instruction sd x12, 20(x13) (ISA RV64I), what are the inputs and outputs of the encircled MUX?

enter image description here

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).

\$\endgroup\$
5
  • \$\begingroup\$ RegWrite will be 0. So no worries. \$\endgroup\$ Commented Oct 24 at 22:32
  • \$\begingroup\$ @periblepsis Well, that does mean that nothing will get written into the register. However, what I'm trying to figure out is the output of the MUX. \$\endgroup\$
    – Sam
    Commented Oct 24 at 23:34
  • 1
    \$\begingroup\$ Given that RegWrite=0, why does it matter to you whether MemToReg is 1 or 0? \$\endgroup\$ Commented Oct 25 at 5:41
  • \$\begingroup\$ @periblepsis because the output of the MUX will be different. \$\endgroup\$
    – Sam
    Commented Oct 25 at 10:49
  • \$\begingroup\$ True. But why does that matter? This is all about instruction decoding that takes placed in the 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 the control unit set things up so that RegWrite would be 0 when the time came. I just don't understand why you care so much about this. So long as RegWrite=0 the value of MemToReg is x (don't care.) Either value has the exact same effect -- none at all. \$\endgroup\$ Commented Oct 25 at 11:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.