lecture6

lecture6 - Lecture 6 Decision Shift I/O Instructions so far...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 6 Decision + Shift + I/O
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructions so far MIPS C Program add, sub, addi, multi, div a=b+c, a=b-c, a=b+10, a=b*c, a=b/c lw $t0,12($s0) sw $t0, 12($s0) t= A[3] A[3]=t beq $s0, $s1, L1 bne $s0, $s1, L1 If (a==b) go to L1 If (a!=b) go to L1 j L1 (unconditional branch) goto L1 slt reg1,reg2,reg3 if (reg2 < reg3) reg1 = 1; else reg1 = 0;
Background image of page 2
Optional Individual Submission for Today’s Quiz Turnin under quiz2 In the program, include your name/perm number By 11:59PM Tonight
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
TODAY’S FOCUS Shift Instructions
Background image of page 4
Bitwise Operations Up until now, we’ve done arithmetic (add, sub,addi ), memory access (lw and sw), and branches and jumps. All of these instructions view contents of register as a single quantity (such as a signed or unsigned integer) New Perspective : View contents of register as 32 individual bits rather than as a single 32-bit number
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Bitwise Operations Since registers are composed of 32 bits, we may want to access individual bits (or groups of bits) rather than the whole. Introduce two new classes of instructions: Logical Operators Shift Instructions
Background image of page 6
Logical Operators Two basic logical operators: AND: outputs 1 only if both inputs are 1 OR: outputs 1 if at least one input is 1 In general, can define them to accept >2 inputs, but in the case of MIPS assembly, both of these accept exactly 2 inputs and produce 1 output Again, rigid syntax, simpler hardware
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Logical Operators Truth Table: standard table listing all possible combinations of inputs and resultant output for each Truth Table for AND and OR A B A AND B A OR B 0 0 0 1 1 0 1 1 0 1 1 1 0 0 0 1
Background image of page 8
Logical Operators
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course CMPSC 64 taught by Professor Zheng during the Fall '09 term at UCSB.

Page1 / 25

lecture6 - Lecture 6 Decision Shift I/O Instructions so far...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online