csci341
play

CSCI341 Lecture 11, Logical Operations Image courtesy of - PowerPoint PPT Presentation

CSCI341 Lecture 11, Logical Operations Image courtesy of http://debsbookbag.blogspot.com/ vs PERFORMANCE CPU Time = (Instruction Count x CPI) / Clock Rate Clock Rate CPI class A CPI class B CPI class C CPI class D Watermelon 1.5 GHz 1


  1. CSCI341 Lecture 11, Logical Operations

  2. Image courtesy of http://debsbookbag.blogspot.com/

  3. vs PERFORMANCE CPU Time = (Instruction Count x CPI) / Clock Rate Clock Rate CPI class A CPI class B CPI class C CPI class D Watermelon 1.5 GHz 1 2 3 4 Sour Apple 2 GHz 2 2 2 2 Given a program with 100 instructions, with 10% as class A, 20% class B, 50% class C and 20% class D, which implementation is faster ?

  4. WHERE WE’VE BEEN • Understanding & Calculating Computer Performance • The Power Wall • Amdahl’s Law • Fallacies / Pitfalls • Heat, Costs and the Rise of Parallelism

  5. WHERE WE’VE BEEN • Binary numbers • Two’s complement (signed) binary numbers • Addition & Subtraction of signed/unsigned binary numbers • Binary to decimal to hex representations • Shortcuts & tricks (negation, sign extension)

  6. WHERE WE’VE BEEN • Fundamental MIPS operations • Operands and registers $zero, $t*, $s* • add, sub, addi, lw, sw • Base addresses and offsets (x4)

  7. INSTRUCTIONS (REVIEW) R-type R egister operations eg, add, sub (no, not this) I-type I mmediate operations eg, addi, and data transfer

  8. INSTRUCTION FORMATS add $t0, $s2, $t0 op rs rt rd shamt funct 0 18 8 8 0 32 R $s2 $t0 $t0 0 add lw $t0, 1200($t1) op rs rt constant / address 35 9 8 1200 I lw $t1 $t0 1200

  9. R-TYPE VS. I-TYPE

  10. LOGICAL OPERATIONS

  11. LOGICAL SHIFT ING 0000 1001 1011 0000 << >> 1001 0000 0000 1011

  12. LOGICAL SHIFT ING $s0 $s0 $s0 $s0 0000 1001 1011 0000 sll $t2, $s0, 4 srl $t2, $s0, 4 $t2 $t2 1001 0000 0000 1011

  13. sll, srl Instructions sll $t2, $s0, 4 op rs rt rd shamt funct 0 0 16 10 4 0 What is shamt for srl ?

  14. WHY GIVE A SHIFT? optimized version of multiplying or dividing by powers of two! (among other things)

  15. AND and OR and $t0, $t1, $t2 perform bitwise AND operation on values in $t1 and $t2 or $t0, $t1, $t2 perform bitwise OR operation on values in $t1 and $t2

  16. MASKING 32-bit words.... But what if I want just part of that word?

  17. MASKING Given a byte 1011 0100 How might you ‘extract’ or ‘isolate’ the second nibble?

  18. MASKING WITH AND 1011 0100 AND 0000 1111 0000 0100 “bit masking”

  19. HOMEWORK • Reading 9: section 2.6 • Problem Set 6 (Instruction formats) • Project 2 (a simple program)

Recommend


More recommend