polarmystery
Diamond Member
Hey guys,
I'm trying to figure out whether or not I'm on the right track with a problem. I'm trying to write some RTN for a SRC that swaps the values of two registers. I'm fairly new to RTL so I'm not sure if I'm close, but this is what I have so far:
It makes sense in that the contents of the registers ra and rb are being swapped and loaded into memory, then the memory contents are being loaded back into the corresponding registers, but I feel like I'm missing something. Any help?
For reference, this is the problem statement:
I'm trying to figure out whether or not I'm on the right track with a problem. I'm trying to write some RTN for a SRC that swaps the values of two registers. I'm fairly new to RTL so I'm not sure if I'm close, but this is what I have so far:
Code:
swap (:=op=7) -> M[ra]<-R[ra]:M[rb]<-R[rb] ; R[rb]<-M[ra]:R[ra]<-M[rb]:
It makes sense in that the contents of the registers ra and rb are being swapped and loaded into memory, then the memory contents are being loaded back into the corresponding registers, but I feel like I'm missing something. Any help?
For reference, this is the problem statement:
Modify the SRC instruction to include the swap (op=7) instruction that exchanges the contents of two registers, ra and rb, by writing abstract RTN for the new instruction.