











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












2
The product could be twice as large (i.e., 64b) It may not fit into a single general purpose register 32 bits (^) 32 bits
4
Jump and JAL, JALR JALR R Link System call SYSCALL SYSCALL
31 - 28 || target 26
J target 26 Jump J, JR If R2 < 0, PC PC + 4 - 16
Conditional Branch Mnemonics Example Meaning
5
Take the branch if contents of R1 = = contents of R The target address of the branch is specified using PC relative addressing mode PC + 4 - 16 For examples, we will use a more readable notation BEQ R1, R2, label If R2 < 0, PC PC + 4 - 16
Conditional Branch Mnemonics Example Meaning
7
JAL target 26 Jump and JAL, JALR Link Mnemonics Example Meaning
Target address specified as in J, JR instructions We will see how this instruction is useful in function calls
8
loophead: loopbody BEQ R1, R0, loophead repeat loopbody until ( X != 0)
BGTZ R1, thenpart elsepart: : thenpart: if (X > 0) thenpart; else elsepart goto label J label C MIPS 1 Instructions
10
11
13
14
An instruction that does not use R head: loopbody BEQ R1, R0, head head: loopbody BEQ R1, R0, head next-instruction
16 Opcode 6 bits Src 5 bits Constant 16 bits Dest 5 bits I Format Example: addi R 1, R 2, 8 lw R 1, 24 (R 2) bltz R 1, loop
17 Opcode 6 bits Jump address 26 bits J Format Example: jal fact
19
program.c cpp Library files cc as ld hello.s program.o a.out e.g., math.o, the math library These are text files – you can read or write them with a text editor These are object files (binary) – you can write programs to read them