A+0=A A.1=A A + A = 1 A. A = 0
1+A=1 0. A = 0
A + (B + C) = (A + B) + C A. (B. C) = (A. B). C
A+A=A A.A =A
A. (B + C) = A.B + A.C A + B.C = (A+B). (A+C)
De Morgans theorem
De Morgans theorem
The Basics of Exception Handling
MIPS uses two coprocessors: C0 and C1 for additional help. C0 primarily helps with exception handling, and C1 helps with floating point arithmetic. Each coprocessor has a few registers.
Interrupts Initiated outside the ins
Run time environment of a MIPS program
Temporary local variables Return address Saved argument registers beyond a0-a3
Growth of stack
A translation hierarchy
Assembly language progr
Handling recursive procedure calls
Example. Compute factorial (n) int fact (int n) cfw_ if (n < 1) return (1); else return (n * fact(n-1)
(Plan) Put n in $a0. Result should be available in $v0.
subi $sp, $sp, 8 sw sw $ra, 4($sp) $a0, 0($sp)
Typically procedure call uses a stack. What is a stack?
Question. Cant we use a jump instruction to implement a procedure call?
Occupies a part of the main memory. In MIPS, it grows from high address to low address
These are easy-to-use assembly language instructions that do not have a direct machine language equivalent. During assembly, the assembler translates each psedudoinstruction into one or more machine language instructions. Pseudo-instru
Using AND for bit manipulation
To check if a register $s0 contains an odd number, AND it with a mask that contains all 0s except a 1 in the LSB position, and check if the result is zero (we will discuss decision making later)
andi $t2, $s0, 1
This uses I-
Assembly Language Programming
High-level vs. Assembly language Consider the following statements
a=x+yz if x > y then x:= x + y else x:= x - y
HLL (High Level Language) programs are machine independent. They are easy to learn, easy to use, and con
Draft notes of 22C: 060
Introduction Here are some natural questions: How does a computer execute a program?
What is there inside a computer? Are all computer hardwares alike? What is the difference between a PC and a Mac?
Draft notes o