Chapter 1
- What are the five classic components of computer?
1. Input:keyboard, mouse2. Output:Screen3. Memory:primary–RAM (DRAM, SRAM), cache memory --Secondary – (magnetic) disks4. Datapath: the component of the processor that performs
arithmetic operationsarithmeticoperations5. Control: the component of the processor that commands the datapath, memory, I/O devices
Mynote: msg1: . asciiz “Hello\n” ---- num1: .word 73 ---- num2: .word 0xAB6C ----- array1: .word 1,2,3,4,5
Chapter 2
-How to convert among binary, decimal, and hex representations.
- Registers , $zero (0), $v0-$v1 (green), $a0-$a3 (), $t0-$t7 (“Temp” math), $s0-$s7 (“Saved” for variables), $t8-$t9 , $sp (Stack-Pointer), $ra (return-addr) –
MIPS assembly instructions, add, sub, addi (add-immediate “$t0, $t1, 5” reg always first), lw (lo adword “lw $s1, offset($t1)”to get val at $t1 + offset), sw (store-word “sw $t1, 0($s3)” to store
in MM the val at $s3 + offset), move (“$t0, $t1” #t0=t1), and (binary compare t0,t1,t2 ), or (t0,t1,t2), nor (not OR, so do or operation then negate t0,t1,t2), andi(t0, t1, 5), ori , sll (shift left logical//
$t0=$s2*2^i), srl (shift right logical), bne (branch on not equal[I-type]// t0,t1,label – if t0 != t1, go to label), beq (branch on equal[I-type]// if t0 == t1 go to…), bgt , bge , blt , ble , sgt , sge , sle ,
slt (set on less than//$t0, $s0, $s1 == if s0 < s1// [ if(a>=b) == !(a<b) ]), slti (set o n less than immediate//$t0, $s0, 87 == if s0 < 87), J (jump), jal (jump and link// call a function), jr (jump
register), mul , div , mflo [(multi = lower32bits of result) // (div = quotient)], mfhi [(multi = higher 32) // (div = remainder)], la(load array// la $a0, array a0=array[ ])
-Know how to convert a MIPS assembly instruction to the corresponding Machine code using
binary, decimal, or hex, for add, sub, addi, lw, sw, and, or, nor, andi, ori, sll, srl, beq, bne, slt, slti, j, and jr.
-Know R-type [ex: add, sub -- don’t require immediate nor offset(6,5,5,5,5,6)], I-type [ex: lw, sw, addi – l w $t0, 32($s2) where t0=rt, s2=rs, 32=offset (6,5,5,16)], J-type [(6,26)].
And also from a given machine code (using binary decimal, or hex), convert to the corresponding MIPS assembly instruction.
1.) (jr jump register R-Type) plug in vals from green sheet; 2.) (bne $t0, $t1, Label I-type) const = [BA – PC - 4]/4 (div will take away last 2 bits); 3.) (j jump J-Type) JAddr=
append4bit(const * 4)—append is (PC-4)
-How to convert “if, if-else, if-else if, else, …” statements in C into MIPS assembly code. -How to convert loops in C into MIPS assembly code .
-How to create procedures in MIPS assembly code, how to call them, using the stack pointer.
-How to operate arithmetic operations in MIPS assembly code, how to use arrays of integers in MIPS assembly code.
-branch with PC-relative addressing, jump with Pseudo-direct addressing. -Spilling Registers technique$v0-$v1(parameters), $a0-$a3 (return val) [**see $sp code pic]
*if a function is calling another function- $ra val needs to be stored(sw) in MM before jal, and we get its value back(lw) from MM after jal and before jr $ra
*if a functionA is modifying the vals for regs. used by the function that call the functionA, THEN these reg vals need to be stored(sw) at the beginning of the functionA (before val are changed) --
and load them back(lw) at the end of functionA (before jr $ra)
Chapter 3
-How to represent negative integers using 2’s complement representation. -Convert a number in 2’s complement representation into a signed decimal number. -How to
detect overflow for addition and subtraction
Sign extension (using left most bit to fill missing bits needed 4b8b = 1000 1111 1000)
1.) [pos + pos neg] 2.) [neg + neg pos] 3.) [pos – neg neg] 4.) [neg – pos pos]