Professional Documents
Culture Documents
303
Lecture 05.1
Dr. Sajid Muhaimin Choudhury, Assistant Professor
Department of Electrical and Electronics Engineering
Bangladesh University of Engineering and Technology
EEE 303 – Digital Electronics
Adder Design
+
EEE 303 – Digital Electronics + Dr. Sajid Muhaimin Choudhury 9
Department of EEE, BUET
EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 10
Department of EEE, BUET
Full Adder – Logic Diagram
S = A B Cin
Cout = AB + ACin + BCin
EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 12
Department of EEE, BUET
N-bit Ripple Carry Adder
tripple = NtFA
Carry Generate:
Only if A and B both are 1
G = A.B
Carry Propagate
Either A or B is 1
P = A+B
G i = Ai B i
• Propagate: Column i will propagate a carry in to the carry out if Ai or Bi is 1.
Pi = Ai + Bi
• Carry out: The carry out of column i (Ci) is:
Ci = Gi + Pi Ci-1
EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 20
Department of EEE, BUET
Block Propagate
Block Propagate and
and Generate Generate
Now use column Propagate and Generate
signals to compute Block Propagate and
Block Generate signals for k-bit blocks, i.e.:
• Compute if a k-bit group will propagate a carry in (of the
block) to the carry out (of the block)
• Compute if a k-bit group will generate a carry out (of the
block)
• Generally,
Pi:j = PiPi-1 Pi-2Pj
Gi:j = Gi + Pi (Gi-1 + Pi-1 (Gi-2 + Pi-2Gj )
Ci = Gi:j + Pi:j Cj-1
4-bit CLA C27 4-bit CLA C23 C7 4-bit CLA C3 4-bit CLA
Cout Cin
Block Block Block Block
Arithmetic Overflow
Lecture 05.2
Dr. Sajid Muhaimin Choudhury, Assistant Professor
Department of Electrical and Electronics Engineering
Bangladesh University of Engineering and Technology
4 Bit Adder – with 7483 / 74283 Integrated Circuit
A0 A4
A7A6 A5A4A3A2 A1A0
A1 A5
B7B6 B5B4B3B2 B1B0
A2 S0 A6 S4
S8S7S6 S5S4S3S2 S1S0 A3 S1 S5
A7
B0 S2 B4 S6
B1 S3 B5 S7
B2 B6
B3 B7
S8
Subtraction
• A-B:
• A-B:
Lecture 05.3
Dr. Sajid Muhaimin Choudhury, Assistant Professor
Department of Electrical and Electronics Engineering
Bangladesh University of Engineering and Technology
ALU: Arithmetic Logic Unit
ALU should perform:
• Addition
• Subtraction
• AND
• OR
Example: Perform A + B
ALUControl = 00
Result = A + B
Flag Description
N Result is Negative
Z Result is Zero
C Adder produces Carry
out
V Adder oVerflowed
Arithmetic shifter: same as logical shifter, but on right shift, fills empty spaces with the old
most significant bit (msb)
• Ex: 11001 >>> 2 =
• Ex: 11001 <<< 2 =
Rotator: rotates bits in a circle, such that bits shifted off one end are shifted into the other end
• Ex: 11001 ROR 2 =
• Ex: 11001 ROL 2 =
Arithmetic shifter:
• Ex: 11001 >>> 2 = 11110
• Ex: 11001 <<< 2 = 00100
Rotator:
• Ex: 11001 ROR 2 = 01110
• Ex: 11001 ROL 2 = 00111
• A << N = A × 2N
• Example: 00001 << 2 = 00100 (1 × 22 = 4)
• Example: 11101 << 2 = 10100 (-3 × 22 = -12)
• A >>> N = A ÷ 2N
• Example: 01000 >>> 2 = 00010 (8 ÷ 22 = 2)
• Example: 10000 >>> 2 = 11100 (-16 ÷ 22 = -4)
x
8
A3 A2 A1 A0
P
B0
B1
0
A3 A2 A1 A0 0
x B3 B2 B1 B0 B2
A3B0 A2B0 A1B0 A0B0
A3B1 A2B1 A1B1 A0B1 0
B3
A3B2 A2B2 A1B2 A0B2
+ A3B3 A2B3 A1B3 A0B3
0
P7 P6 P5 P4 P3 P2 P1 P0
P7 P6 P5 P4 P3 P2 P1 P0
0
N
R'
Division: A/B = Q + R/B
R’ = 0
for i = N-1 to 0
R = {R’ << 1, Ai}
D=R-B
if D < 0, Qi=0, R’=R
else Qi=1, R’=D
Each row computes one iteration of the division algorithm.
R=R’
EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 103
Department of EEE, BUET
4 x 4 Divider
Legend
R B
R B
Cout Cin Cout Cin
+
D
D
N R'
0
N
R'
107
– Simplify Logic 0 0 1 0 2 0 : 0 0 1 0
0 0 1 1 3 0 : 0 0 1 1
• Observation: 0 1 0 0 4 0 : 0 1 0 0
0 1 0 1 5 0 : 0 1 0 1
0 1 1 0 6 0 : 0 1 1 0
0 1 1 1 7 0 : 0 1 1 1
1 0 0 0 8 0 : 1 0 0 0
1 0 0 1 9 0 : 1 0 0 1
Add 6 to a 4 bit binary 1 0 1 0 10 1 : 0 0 0 0
number to get its BCD 1010+0110
1 0 1 1 11 1 : 0 0 0 1
1 1 0 0 12 1 : 0 0 1 0
1011+0110
1 1 0 1 13 1 : 0 0 1 1
1 1 1 0 14 1 : 0 1 0 0
1 1 1 1 15 1 : 0 1 0 1