EE101Lecture4

EE101Lecture4 - Lecture 4 Slides Sign Extension Overflow...

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

View Full Document Right Arrow Icon
© Mark Redekopp, All rights reserved Lecture 4 Slides Sign Extension Overflow Binary Logic
Background image of page 1

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

View Full DocumentRight Arrow Icon
© Mark Redekopp, All rights reserved 2’s Complement Tricks • Normal method of taking the 2’s complement : – Flip bits and add 1 •T r i c k – Start from LSB and work your way left towards MSB – Copy bits through the first ‘1’ you encounter – Flip every bit after that 011010 Start from the LSB Copy bits through the first ‘1’ Flip (invert) every bit after that 100110 011010 100101 + 1 100110 Normal 2’s complement method 2’s Complement Trick
Background image of page 2
© Mark Redekopp, All rights reserved Zero and Sign Extension Zero extension (unsigned) and Sign extension (2’s comp.) is the process of increasing the number of bits used to represent a value without changing the value itself 2’s complement = Sign Extension (Replicate sign bit): Unsigned = Zero Extension (Always add leading 0’s): 111011 = 00 111011 011010 = 00 011010 110011 = 11 110011 pos. neg. Increase a 6-bit number to 8-bit number by zero extending Sign bit is just repeated as many times as necessary
Background image of page 3

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

View Full DocumentRight Arrow Icon
© Mark Redekopp, All rights reserved Zero and Sign Truncation Zero truncation (unsigned) and Sign truncation (2’s comp.) is the process of decreasing the number of bits used to represent a value without changing the value itself 2’s complement = Sign Truncation (Remove copies of sign bit): Unsigned = Zero Truncation (Remove leading 0’s): 00111011 = 111011 00 0 11010 = 011010 111 1 0011 = 10011 pos. neg. Decrease an 8-bit number to 6-bit number by truncating 0’s. Can’t remove a ‘1’ because value is changed Any copies of the MSB can be removed without changing the numbers value.
Background image of page 4
© Mark Redekopp, All rights reserved Overflow • Overflow occurs when the result of an arithmetic operation is too large to be represented with the given number of bits
Background image of page 5

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

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

This note was uploaded on 02/27/2008 for the course EE 101 taught by Professor Redekopp during the Fall '06 term at USC.

Page1 / 20

EE101Lecture4 - Lecture 4 Slides Sign Extension Overflow...

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

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