{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

EE101Lecture4

# EE101Lecture4 - Lecture 4 Slides Sign Extension Overflow...

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

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

View Full Document
© 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
© 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

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

View Full Document
© 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.
© 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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online