























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























0000
0111
0011 1011
11101111 1101 1100
1010 1001 1000
0110
0101
0100
0010
0001
0 100 = + 4 1 100 = - 4
High order bit is sign: 0 = positive (or zero), 1 = negative Three low order bits is the magnitude: 0 (000) thru 7 (111) Number range for n bits = +/-2 - Representations for 0 Cumbersome addition/subtraction Must compare magnitudes to determine sign of result
n-
Docsity.com
0000
0111
0011 1011
11101111 1101 1100
1010 1001 1000
0110
0101
0100
0010
0001
0 100 = + 4 1 100 = - 4
Only one representation for 0
One more negative number than positive number
like 1's comp except shifted one position clockwise
Sign and Magnitude 4
result sign bit is the same as the operands' sign
when signs differ, operation is subtract,sign of result depends on sign of number with the larger magnitude
Twos Complement Calculations 4
If carry-in to sign = carry-out then ignore carry if carry-in differs fromcarry-out then overflow
Simpler addition scheme makes twos complement the most common choice for integer number systems within digital systems
Half Adder With twos complement numbers, addition is sufficient
Ai 0 0 1 1
Bi 0 1 0 1
Sum 0 1 1 0
Carry 0 0 0 1
Ai Bi 0 1 0 1
0 1 1 0 Sum = Ai Bi + Ai Bi = Ai + Bi
Ai Bi 0 1 0 1
0 0 0 1 Carry = Ai Bi
Carry Half-adder Schematic
A (^) i Sum Bi
Cascaded Multi-bit Adder
usually interested in adding more than two bits this motivates the need for the full adder
A
A^ A
B
B B CI CI^ S^
CO
Alternative Implementation: 5 Gates
Half Adder
A B
Half Adder
A + B
CI
S S^ A + B + CI CO A B CO CI (A + B)
S
CO A B + CI (A xor B) = A B + B CI + A CI
Standard Approach: 6 Gates
A B CO S
A B CO S
A B CO S
A B CO S
0 1
Add/Subtract
A 3 B 3 B 3 0 1
A 2 B 2 B 2 0 1
A 1 B 1 B 1 0 1
A 0 B 0 B 0 Sel Sel Sel^ Sel
S 3 S 2 S 1 S 0
Overflow
Critical delay: the propagation of carry from low to high order stages
A
A
B
B CI (^) CO
@0 @
@0 @
@N
@
@
@N+ @N+
late arriving signal two gate delays to compute CO
4 stage adder
final sum and carry
A 0 B 0
C 0 S 0 @
A 1 B 1
C 1 @ S 1 @ A 2 B 2
C 2 @ S 2 @
A 3 B 3
C 3 @ S 3 @ C 4 @
0
1 2
3
Critical delay: the propagation of carry from low to high order stages
worst case addition
T0: Inputs to the adder are valid T2: Stage 0 carry out (C1) T4: Stage 1 carry out (C2) T6: Stage 2 carry out (C3) T8: Stage 3 carry out (C4)
2 delays to compute sum but last carry not ready until 6 delays later
T0 T2 T4 T6 T
S0, C1 Valid S1, C2 Valid S2, C3 Valid S3, C4 Valid
Reexpress the carry logic as follows: C1 = G0 + P0 C C2 = G1 + P1 C1 = G1 + P1 G0 + P1 P0 C C3 = G2 + P2 C2 = G2 + P2 G1 + P2 P1 G0 + P2 P1 P0 C C4 = G3 + P3 C3 = G3 + P3 G2 + P3 P2 G1 + P3 P2 P1 G0 + P3 P2 P1 P0 C
Each of the carry equations can be implemented in a two-level logic network Variables are the adder inputs and carry in to stage 0!
Adder with Propagate and Generate Outputs Increasingly complex logic Pi @ 1 gate delay Ci Si @ 2 gate delays Bi^ Ai
- C0 C Gi @ 1 gate delay