13-shifters - 9/28/09 ECE2030 Introduction to Computer...

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

View Full Document Right Arrow Icon
9/28/09 1 1 ECE2030 Introduction to Computer Engineering Lecture 11: Building Blocks for Combinational Logic – Shifters 2 Basic Shifting 3 Logical Shift • Shift Left • MSB: Shifted out • LSB: Shifted in with a “0” • Examples: • (11001011 << 1) = 10010110 • (11001011 << 3) = 01011000 • Shift right • MSB: Shifted in with a “0” • LSB: Shifted out • Examples: (Some ISA use triple “>” for logical right shift) • (11001011 >>> 1) = 01100101 • (11001011 >>> 3) = 00011001 4 Arithmetic Shift • Shift left • MSB: Shifted out, however, be aware of overflow /underflow • LSB: Shifted in with a “0” • Examples: • (1100 << 1) = 1000 • (1100 << 3) = 0000 (Incorrect!) Underflow • Shift right • MSB: Retain “sign bit” • LSB: Shifted out • Examples: • (1100 >> 1) = 1110 (Retain sign bit) • (1100 >> 3) = 1111 ( -4/8 = -1 ) Floor value of -0.5
Background image of page 1

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

View Full DocumentRight Arrow Icon
9/28/09 2 5 Examples of Arithmetic Shift 1111 1011 Arithmetic shift right by 1 1111 1101 1111 1011 Arithmetic shift left by 1 1111 0110 1011 1111 (= -65) Arithmetic shift left by 1 (i.e. x2) 0111 1110 (= +126 -130) Underflow ! 0100 0010 (= +66) Arithmetic shift left by 1 (i.e. x2) 1000 0100 (= -124 +132) Overflow !
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

13-shifters - 9/28/09 ECE2030 Introduction to Computer...

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

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