Trouble with execute_jal

69 views
Skip to first unread message

KV

unread,
Oct 9, 2020, 2:08:10 AM10/9/20
to cmpt-295-sfu
SFU ID: 301296793
Github username: kvahidi
Github: Link to github repo (your assignment repos are private so these links are only accessible to TAs and Instructor) : https://github.com/CMPT-295-SFU/assignment-2-kvahidi
Line and file: execute_jal
Expected behavior: pass any test containing JAL
Observed behavior: fails JAL tests
Question:
I have been having a hard time with execute_jal for a while and I've been trying to track the PC value but every time I try to make sense out of the provided solution output the jumps confuse me. Could you 
explain what I'm potentially doing wrong in my code? or how the r3 = 0x3000 in UJ in instruction 1 is calculated? Thanks.

Screen Shot 2020-10-08 at 11.04.58 PM.png

Arrvindh Shriraman

unread,
Oct 9, 2020, 12:36:16 PM10/9/20
to cmpt-295-sfu
https://web.cecs.pdx.edu/~harry/riscv/RISCV-Summary.pdf (Read page 71-74)
1. You do not have to *2 the offset. The encoded offsets already are adjusted for that. Just follow the semantics in the pdf above OR RISCV_CARD
2. Those regs are wrong possibly because you are jumping to the wrong place and rd calculations will obviously be off if your PC is wrong

KV

unread,
Oct 9, 2020, 4:26:20 PM10/9/20
to cmpt-295-sfu
thank you
Reply all
Reply to author
Forward
0 new messages