assignment 3

55 views
Skip to first unread message

brandon

unread,
Oct 25, 2020, 4:13:05 PM10/25/20
to cmpt-295-sfu
# Question templates
SFU ID: 301358970
Github username: bla118
Github: Link to github repo (your assignment repos are private so these links are only accessible to TAs and Instructor)
Line and file: matmul.s, 68
Expected behavior:
Observed behavior: 
Question: I'm pretty sure I've done the dot function correct but I don't know why calling it in matmul.s creates an error later on. When I comment out the call, matmul proceeds and finishes as expected. Any help would be appreciated, thanks.

Arrvindh Shriraman

unread,
Oct 25, 2020, 4:29:56 PM10/25/20
to cmpt-295-sfu
Please include comments in your assembly code
1) What are the input arguments to each method or routine
2) What is each register mapping
3) Include some C code to indicate what you are expecting the code to be doing


A figure would be helpful

That said --------------------------------------------------
Seems like you are violating the calling convention. t registers are caller save
Seems like you are using t registers in matmul for loop index. You also seem to be using t registers in dot.
Once the first call to dot happens, when it returns your matmul loop variables are in bad state. 

Two options

1) Use s registers for loop variables. save and restore within dot

OR 2) save and restore t registers across the call to dot on line 68: 
#jal ra, dot https://web.cecs.pdx.edu/~harry/riscv/RISCV-Summary.pdf (read page 153)

brandon

unread,
Oct 25, 2020, 4:54:49 PM10/25/20
to cmpt-295-sfu
Thank you, I got it
Reply all
Reply to author
Forward
0 new messages