Beruflich Dokumente
Kultur Dokumente
Design Refinement
Informal System Requirement
Initial Specification
Intermediate Specification
refinement
increasing level of detail
Final Architectural Description
Physical Implementation
ECE4680 ALU design.4 2002-2-20
Design as Search
Problem A
Strategy 1 Strategy 2
-- Given design space of components & assemblies, which part will yield
the best solution?
A B 3
M mode/function
ALU
Cout Cin
S
16
ECE4680 ALU design.6 2002-2-20
Elements of the Design Process
Block Diagrams
Optimization Criteria:
Power
Gate Count Area Logic Levels
Delay
Fan-in/Fan-out Cost
[Package Count]
Pin Out Design time
Examples:
3+2=5 3+3=6
1 1 1
0 0 1 1 0 0 1 1
+ 0 0 1 0 + 0 0 1 1
0 1 0 1 0 1 1 0
Bitwise
Decimal Binary Decimal Inverse 2’s Complement
0 0000 0 1111 0000
1 0001 -1 1110 1111
2 0010 -2 1101 1110
3 0011 -3 1100 1101
4 0100 -4 1011 1100
5 0101 -5 1010 1011
6 0110 -6 1001 1010
7 0111 -7 1000 1001
8 1000 -8 0111 1000
°Examples: 7 - 6 = 7 + (- 6) = 1 3 - 5 = 3 + (- 5) = - 2
1 1 1 1 1
0 1 1 1 0 0 1 1
+ 1 0 1 0 + 1 0 1 1
0 0 0 1 1 1 1 0
Sign extension: when word is prolonged, fill sign bit into the new bits. See above example.
Result
N
Overflow
B
N
CarryOut
CarryIn
A and
or
Mux
Result
1-bit add
Full
B Adder
CarryOut
A 1-bit
°This is also called a (3, 2) adder C
Full
B Adder
°Half Adder: No CarryIn nor CarryOut
Inputs Outputs
Inputs Outputs
°CarryOut = (!A & B & CarryIn) | (A & !B & CarryIn) | (A & B & !CarryIn)
| (A & B & CarryIn)
Inputs Outputs
°Sum = (!A & !B & CarryIn) | (!A & B & !CarryIn) | (A & !B & !CarryIn)
| (A & B & CarryIn)
°Sum = (!A & !B & CarryIn) | (!A & B & !CarryIn) | (A & !B & !CarryIn)
| (A & B & CarryIn)
X Y X XOR Y
0 0 0
0 1 1
1 0 1
1 1 0
CarryIn
B CarryOut
CarryIn0
CarryIn
A0 1-bit
A Result0
B0 ALU
CarryIn1 CarryOut0
A1 1-bit Result1
Result B1 ALU
Mux
CarryIn2 CarryOut1
A2 1-bit Result2
B2 ALU
1-bit CarryIn3 CarryOut2
Full A3
B 1-bit Result3
Adder
B3 ALU
CarryOut CarryOut3
Subtract
A CarryIn
4
Zero
“ALU”
Result
Sel 4
2x1 Mux
B 0
4
1 4
4 !B CarryOut
0 1 1 1 1
0 1 1 1 7 1 1 0 0 -4
+ 0 0 1 1 3 + 1 0 1 1 -5
1 0 1 0 -6 0 1 1 1 7
Overflow Detection
°Overflow: the result is too large (or too small) to represent properly
• Example: - 8 < = 4-bit binary number <= 7
0 1 1 1 1 0
0 1 1 1 7 1 1 0 0 -4
+ 0 0 1 1 3 + 1 0 1 1 -5
1 0 1 0 -6 0 1 1 1 7
CarryIn0
A0 1-bit Result0 X Y X XOR Y
B0 ALU
0 0 0
CarryIn1 CarryOut0
A1 0 1 1
1-bit Result1
ALU 1 0 1
B1
1 1 0
CarryIn2 CarryOut1
A2 1-bit Result2
B2 ALU
CarryIn3
A3 Overflow
1-bit Result3
B3 ALU
CarryOut3
CarryOut3
CarryIn0
A0 1-bit Result0
B0 ALU
CarryIn1 CarryOut0 CarryIn
A1 1-bit Result1 A
B1 ALU
CarryIn2 CarryOut1
A2 1-bit Result2
B2 ALU
CarryIn3 CarryOut2
A3 B CarryOut
1-bit Result3
B3 ALU
CarryOut3
A[3:0] CarryIn
4
Result[3:0]
ALU
4
B[3:0]
4
A[7:4]
4
Result[7:4]
ALU
4
B[7:4]
4
CarryOut
ALU
0 4
A[7:4] B[3:0]
4 C4
4
X[7:4] Sel
ALU
0
4 1
2 to 1 MUX
B[7:4] A[7:4] Result[7:4]
4 C0 4
Y[7:4] 4
ALU
4 1
B[7:4]
4 C1
0 1 Sel C4
2 to 1 MUX
CarryOut
1 0 Cin “propagate”
Cin2 1-bit 1-bit Cin0 1 1 1 “generate”
ALU ALU
Cout1
Cout0
gi = Ai · Bi
A0 1-bit
pi = Ai + Bi Result0
B0 ALU
g0 + p0 · Cin0 = Cin1
A1 1-bit Result1
B1 ALU
g1 + p1 · g0 + p1 · p0 · Cin0 = Cin2
A2 1-bit Result2
B2 ALU
g2 + p2 · g1 + p2 · p1 · g0 + p2 · p1 · p0 · Cin0 = Cin3
A3 1-bit
Carry Lookahead Unit Result3
B3 ALU
CarryOut3
The sequential dependency of Ripple Carry is broken. All bits in Carry Lookahead
can work in parallel. The delay of N-bit Carry Lookahead adder is always a constant
of 4. But Imagine how expensive/complex the hardware would be!
ECE4680 ALU design.33 2002-2-20
°Common practices:
• Connects several N-bit Lookahead Adders to form a big adder
• Example: connects four 8-bit carry lookahead adders to form
a 32-bit partial carry lookahead adder
8-bit Carry C24 8-bit Carry C16 8-bit Carry C8 8-bit Carry C0
Lookahead Lookahead Lookahead Lookahead
Adder Adder Adder Adder
8 8 8 8
A[15:12] B[15:12] A[11:8] B[11:8] A[7:4] B[7:4] A[3:0] B[3:0] 4-bit ripple
4 4 4 4 4 4 4 4 carry adder
4 4 4 4
C4 G3 P3 C3 G2 P2 C2 G1 P1 C1 G0 P0
carry-lookahead unit at higher level
C1 = G0 | P0&c0
C2 = G1 | P1&G0 | P1&P0&c0
C3 = G2 | P2&G1 | P2&P1&G0 |P2&P1&P0&c0
C4 = G3 | P3&G2 | P3&P2&G1 |P3&P2&P1&G0 | P3&P2&P1&P0&c0
Summary
°ALU Design
• Designing a Simple 4-bit ALU
• Other ALU Construction Techniques