CSE 220 Lecture 6: Branches and Loops

46 views5 pages

Document Summary

There are no if-statements or loops in mips. Instead there are different kind of branch statements that direct the cpu to execute instructions out of sequential order. In addition to the 32 registers we can use as programmers, there is also the program counter (pc), which holds the address of the next instruction to execute. We have a, s, t, and r registers including the program counter. After an instruction is fetched (the address of which is in the pc), the value in the pc is incremented by 4 (4 bytes). The assumption is that the next instruction to execute is in the neighboring memory cell. Branch instructions provide a different value to the pc. Branch instructions allow us to execute different functions based on a set of conditions. The pc is changed directly, meaning that the program will jump to a specific part of the code when the program hits the branch.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers