Sample Output.
Here is the factorial function in fun. Here is some commented output assembly.
Caution, documentation bug!
The first operand of jalr is the register where to put the return address (you must use $ra, which is what gencode_func, described below expects), and the second one is the register containing the address of the function to be executed. NOTE: the order of the jalr operands is the OPPOSITE of what appears on the SPIM documentation. [We have notified the implementor of SPIM.]