I'm given a MIPS instruction:
top:
lw $t1, ($t0)
beq $s0, $0, end
jal func
add $s0, $s0, $t0
addi $s0, $s0, -1
j top
bne $s0, $0, top
end:
func:
sll $v0, $t1, 4
jr $ra
and am told to convert each line to the "instruction in hex." What I am having a problem with is the jal
instruction. I understand it is a Pseudodirect address, what I don't understand it how to write it out as asked.
Given the OPCode for a jal
instruction is 3hex
, the first 6 bits in the J-Type instruction format would be 000011
, how do I figure out the remaining?
I understand how to complete this task for R-Type and I-Type instruction formats but cant figure this one out.
Any help is appreciate.
Copyright Notice:Content Author:「corporateWhore」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30770508/how-to-represent-mips-instruction-as-its-hex-representation