Lecture 15

Lecture 15 - ECE52 Spring 11 Lecture 15 2/16/11 1 Signed...

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

View Full Document Right Arrow Icon
1 ECE52 Spring 11 Lecture 15 2/16/11
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Signed numbers Need a way to represent positive and negative integers. Three different systems have been developed; all have their uses Sign-magnitude representation 1’s complement representation 2’s complement representation Important point: NOT JUST FOR REPRESENTING NEGATIVE NUMBERS! Represents integers, be they positive OR negative!
Background image of page 2
3 Sign-Magnitude: add a “sign bit” b n 1 b 1 b 0 Magnitude MSB (a) Unsigned number b n 1 b 1 b 0 Magnitude Sign (b) Signed number b n 2 0 denotes 1 denotes + MSB Range: 0 to 2 n -1 (0 to 255 for 8 bits) So: +3 in 8-bit SM is 00000011 and -3 in 8-bit SM is 10000011 Range: -(2 n-1 -1) to 2 n-1 -1 (-127 to +127 for 8 bits; two zeros!)
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Problem: Try adding these things! Real problem: sign bit is now “special” – can’t be added like others, and we need to do 17-13, not 17+13 on remaining 7 bits. We can build ripple-borrow subtracter circuits, set up correct problem based on combination of sign bits 29 10011110 10001101 00010001 10001101 13 00010001 17 ) 13 ( 17 try bit world, - 8 In 10 10 - = + = - = + -
Background image of page 4
5 Subtract circuit for whole numbers Note: subtract circuits aren’t in your book or most books for reasons that will become clear I hope! digit-by-digit subtraction: subtracting y i from x i : if y i >x i we must borrow from next digit to left. if we were borrowed from, an additional 1 must be subtracted from us. d: difference bit x i y i b i-1 b i d i NOTE 0 0 0 0 0 0-0 0 0 1 1 1 0-1 0 1 0 1 1 0-1 0 1 1 1 0 0-2 1 0 0 0 1 1-0 1 0 1 0 0 1-1 1 1 0 0 0 1-1 1 1 1 1 1 1-2 1 - - - = i i i i i b y x d b
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 4-bit binary subtracter full subtracter x 3 y 3 d 3 b 3 full subtracter x 2 y 2 d 2 b 2 full subtracter x 1 y 1 d 1 b 1 full subtracter x 0 y 0 d 0 b 0 b -1
Background image of page 6
7 Add/subtract approach to S/M If +/+ or - / - : ADD, sign of answer is same (+3)+(+5)=+8 ( - 3)+( - 5)= - (3+5)= - 8 If +/ - or - /+: SUBTRACT smaller magnitude
Background image of page 7

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

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

This note was uploaded on 07/05/2011 for the course ECE 52 taught by Professor Dr.jonathanboard during the Spring '11 term at Duke.

Page1 / 25

Lecture 15 - ECE52 Spring 11 Lecture 15 2/16/11 1 Signed...

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

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