Assn 2 Part 1

122 views
Skip to first unread message

Sam

unread,
Oct 5, 2020, 12:05:29 PM10/5/20
to cmpt-295-sfu
SFU ID: 301404717
Github username:ahmadsami07
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-ahmadsami07
Line and file: utils.c, 161
Expected behavior:00001000: jal    x19, 0
00001004: jal    x20, 1
00001008: jal    x3, 0
0000100c: jal    x1, 0...etc
Observed behavior:jal x19,4 etc
Question:I'm stuck on the jump offset for jal quite a while now and am not being able to figure it out. I changed my masking process and believe it to be correct but my output is not coming like it should on the ref. A clue to where I'm going wrong would be really appreciated as I'm stuck on this quite a while now and not being able to go to part 2.

Arrvindh Shriraman

unread,
Oct 5, 2020, 12:45:10 PM10/5/20
to cmpt-295-sfu
It appears to me your confusing where exactly the bits are located.
test is already imm (it is not the entire instruction.......)
For instance if you want bits 10:1 you should NOT be right shifting by 11 bits line 168 there are only these fields to right off it (11|19:12). That is not 11 bits. 
- The other shifts and masks are also off, but you may not notice it in this test as the offset is just 0. 
- But all of it stems from the fact that you seem to have written the code assuming test is storing the entire instruction; not just imm.

Further remember that is bits 10:1 not the 0th bit. The offset does not need to store the 0th bit. Think why.

Sam

unread,
Oct 5, 2020, 1:44:02 PM10/5/20
to cmpt-295-sfu
Thank you so much for your detailed reply,I got it correct now.
Reply all
Reply to author
Forward
0 new messages