learn-fpga
learn-fpga copied to clipboard
comment/code mismatch FROM_BLINKER_TO_RISCV step 4 (?)
Hi, I am trying to reconcile the following lines of code and comments:
// sw x2,0(x1)
// imm rs2 rs1 w imm STORE
MEM[6] = 32'b000000_00001_00010_010_00000_0100011;
as compared to
wire isStore = (instr[6:0] == 7'b0100011); // mem[rs1+Simm] <- rs2
My understanding of the store instruction assembly is "store the contents of register x2 to the address is register x1 adding zero offset." If I compare that to the comment // mem[rs1+Simm] <- rs2
it would seem that the values in rs1
and rs2
in the instruction are flipped. Then it seems to me that the MEM
line should read
// imm rs2 rs1 w imm STORE
MEM[6] = 32'b000000_00010_00001_010_00000_0100011;
Do I have it right? Thanks!