Digital Logic and Design Material
Digital Logic and Design Material
Digital Logic and Design Material
to help understand }
the problem
CS 150 - Fall 2000 - Combinational Examples - 3
Formalize the Problem
Encoding:
Binary number for month: 4 bits month leap 28 29 30 31
0000 – – – – –
4 wires for 28, 29, 30, and 31 0001 – 0 0 0 1
one-hot – only one true at any time 0010 0 1 0 0 0
0010 1 0 1 0 0
Block diagram: 0011
0100
–
–
0
0
0
0
0
1
1
0
month leap 0101 – 0 0 0 1
0110 – 0 0 1 0
0111 – 0 0 0 1
1000 – 0 0 0 1
1001 – 0 0 1 0
1010 – 0 0 0 1
1011 – 0 0 1 0
1100 – 0 0 0 1
1101 – – – – –
111– – – – – –
28 29 30 31
or P-o-S
c6
c4 c2
c3
c0 c1 c2 c3 c4 c5 c6
BCD to 7–segment
control signal
decoder
A B C D
Truth table
Show don't cares A B C D C0 C1 C2 C3 C4 C5 C6
0 0 0 0 1 1 1 1 1 1 0
Choose implementation 0 0 0 1 0 1 1 0 0 0 0
target 0 0 1 0 1 1 0 1 1 0 1
0 0 1 1 1 1 1 1 0 0 1
If ROM, we are done 0 1 0 0 0 1 1 0 0 1 1
Don't cares imply PAL/PLA 0 1 0 1 1 0 1 1 0 1 1
may be attractive 0 1 1 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 0 0 0 0
Follow implementation 1 0 0 0 1 1 1 1 1 1 1
procedure 1 0 0 1 1 1 1 0 0 1 1
1 0 1 – – – – – – – –
Minimization using K-maps
1 1 – – – – – – – – –
Can do better
9 unique product terms (instead of 15)
Share terms among outputs
Each output not necessarily in minimized form
A A
C2 1 1 X 1 C2 1 1 X 1
1 1 X 1 1 1 X 1
D D
C 1 1 X X C 1 1 X X
0 1 X X 0 1 X X
B B
BC'
B'C
B'D
BC'D
C'D'
CD
B'D'
A
BCD'
C0 C1 C2 C3 C4 C5 C6 C7
C2 = B' D + B C' D + C' D' + W need another input and another output
W = C D + B C D'
Decompose into multi-level logic (hopefully with CAD support)
Find common sub-expressions among functions
C0 = C3 + A' B X' + A D Y
C1 = Y + A' C5' + C' D' C6
C2 = C5 + A' B' D + A' C D X = C' + D'
C3 = C4 + B D C5 + A' B' X' Y = B' C'
C4 = D' Y + A' C D'
C5 = C' C4 + A Y + A' B X
C6 = A C4 + C C5 + C4' C5 + A' B' C
CS 150 - Fall 2000 - Combinational Examples - 11
Production Line Control
Position of Sensors
A to B distance = specification – 5%
A to C distance = specification + 5%
spec
- 5%
B
C
Truth Table
Show don't cares
C0 C1 C2 Function Comments
0 0 0 1 always 1
0 0 1 A+B logical OR
3 control inputs: C0, C1, C2
0 1 0 (A • B)' logical NAND
2 data inputs: A, B
0 1 1 A xor B logical xor
1 output: F
1 0 0 A xnor B logical xnor
1 0 1 A•B logical AND
1 1 0 (A + B)' logical NOR
1 1 1 0 always 0
–7 +7
–8 +7
CS 150 - Fall 2000 - Combinational Examples - 22
2s complement (cont’d)
4
Example: 2s complement of –7 2 = 10000
subtract –7 = 1001
0111 = repr. of 7
4 0100 –4 1100
+3 0011 + (– 3) 1101
7 0111 –7 11001
4 0100 –4 1100
–3 1101 +3 0011
1 10001 –1 1111
Overflow conditions
Add two positive numbers to get a negative number
Add two negative numbers to get a positive number
–1 +0 –1 +0
–2 +1 –2 +1
1111 0000 1111 0000
–3 1110 0001 –3 1110 0001
+2 +2
1101 0010 1101 0010
–4 1100 0011 +3 –4 1100 0011 +3
–8 +7 –8 +7
5 + 3 = –8 –7 – 2 = +7
CS 150 - Fall 2000 - Combinational Examples - 26
Overflow Conditions
A B A B A B A B
Add'
Cout Cin Cout Cin Cout Cin Cout Cin
Subtract
Sum Sum Sum Sum
S3 S2 S1 S0
Overflow
CS 150 - Fall 2000 - Combinational Examples - 30
Ripple-Carry Adders
Critical Delay
The propagation of carry from low to high order stages
Cin
4 stage
@0 A @1 @N+1 adder
@0 B A0 S0 @2
@N Cin B0 C1 @2
Cout
@N+2
@0 A
@0 B @1 A1 S1 @3
B1 C2 @4
late two gate delays
arriving to compute Cout A2 S2 @5
signal B2 C3 @6
A3 S3 @7
B3 Cout @8
Critical delay
The propagation of carry from low to high order stages
1111 + 0001 is the worst case addition
Carry must propagate through all bits
Carry generate: Gi = Ai Bi
Must generate carry when A = B = 1
Carry propagate: Pi = Ai xor Bi
Carry-in will equal carry-out here
Sum and Cout can be re-expressed in terms of
generate/propagate:
Si = Ai xor Bi xor Ci
= Pi xor Ci
Ci+1 = Ai Bi + Ai Ci + Bi Ci
= Ai Bi + Ci (Ai + Bi)
= Ai Bi + Ci (Ai xor Bi)
= Gi + Ci Pi
Ci Si @ 2 gate delays
C0 C0 C0
P0 C1 P0 P0
G0 P1 P1
P2 P2
G0 P3
C0 P1 G0
P0 P2 P1
P1 P2
G1 C3 P3
G0 P2 G1
P1 C2
P2
G2 P3
G1 C4
G2
P3
G3
CS 150 - Fall 2000 - Combinational Examples - 35
Carry-Lookahead Implementation (cont’d)
Carry-lookahead adder
4 four-bit adders with internal carry lookahead
Second level carry lookahead unit extends lookahead to 16 bits
4 4 4 4 4 4 4 4
C8 4-bit adder 0
[7:4] adder
low
C8 S7 S6 S5 S4 S3 S2 S1 S0
CS 150 - Fall 2000 - Combinational Examples - 38
Arithmetic Logic Unit Design Specification
12 gates
other gates
for M=0 (logical operations, Ci is ignored)
A3 A4
Fi = S1 Bi xor (S0 xor Ai)
= S1'S0' ( Ai ) + S1'S0 ( Ai' ) +
S1 S0' ( Ai Bi' + Ai' Bi ) + S1 S0 ( Ai' Bi' + Ai Bi )
for M=1 (arithmetic operations)
Fi = S1 Bi xor ( ( S0 xor Ai ) xor Ci ) =
O1
X3
Ci+1 = Ci (S0 xor Ai) + S1 Bi ( (S0 xor Ai) xor Ci ) =