


























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!



























Exercise 5.
(a) The input signals to this system are: # dimes and # of nickels in the reservoir, ND and NN, respectively, and coin deposited, C. The outputs are: no change, E, # dimes and # of nickels to return, RD and RN, respectively.
(b) ND and NN are the number of dimes and nickels left in the machine. C tells us that a quarter has been deposited so we need to make change. E signals to the machine that it should light up a “No Change Available” sign. RD and RN tell the machine how many dimes and nickels to return.
(c) Minimized gate-level implementation:
The input C is not included in the truth table because we never return change unless C is 1. However, we do still need to compute E.
If we look at the truth table carefully, we can see that not all of the outputs will require 5-variable K-maps. RD1 and RD0 can be implemented with 4-variable K- maps, which means that we will have to AND N (^) D1 to the output those functions. Similarly, RN2 only requires a 3-variable K-map. Also, notice that RD0 and RN1 are the same.
ND0NN NN1NN0 00 01 11 10 00
01
11
10
ND0NN NN1NN
ND1=
K-map for E
K-map for RD
ND0NN NN1NN
Exercise 5.
This logic unit is a simple ALU which uses the control bits, A, B, and C, to determine the operation to be performed on D 1 and D 0.
(a) Truth table for Z:
K-map for Z:
(b) 16:1 Mux for Z:
10 11 12 13 14 15
S 3 S 2 S 1 S 0
A B C D (^1)
0 0 D (^0) D (^0) 0 D (^0) 1 D (^0) ’ D (^0) ’ 0 D (^0) 1 0 1 1
16:1 MUX
Exercise 5.
(a) Truth table for O 1 and O 0 :
I 3 I 2 I 1 O 1 O 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1
(b) Gate-level implementation:
(c) 4:1 multiplexor implementation:
Exercise 5.
(a) The day offset block takes the month as input and returns a 9-bit value which corresponds to the number of days in the year up to that month.
Block Diagram for DayOffset
Verilog module:
module DayOffset(input wire [3:0] M, output reg [8:0] D);
always@(*) begin case(M) 4'b0001: D = 0; 4'b0010: D = 31; 4'b0011: D = 59; 4'b0100: D = 90; 4'b0101: D = 120; 4'b0110: D = 151; 4'b0111: D = 181; 4'b1000: D = 212; 4'b1001: D = 243; 4'b1010: D = 273; 4'b1011: D = 304; 4'b1100: D = 334; default: D = 0; endcase end endmodule
Exercise 5.
(a) Truth table for the half-subtractor D = A - B:
A B BI D BL 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 1 1 1 1
D = A’B’BI + A’BBI’ + AB’BI’ + ABBI
Or simply:
D = A xor B xor B (^) I
BL = A’B + A’BI + BB (^) I
(b) Block diagram for a 4-bit subtractor:
(c) This multi-bit subtractor works with 2’s compliment numbers just as the full-adder does.
(d) Underflow can be detected by checking if the MSB tries to borrow from the left: B (^) L is 1.
Subtracto B B
A B
D (^3)
Subtracto B B
A B
D (^2)
Subtracto B B
A B
D (^1)
Subtracto B B
A B
D (^0)
B (^) L3 B (^) I
Exercise 5.
The basic module we will use is the half-adder. As long as the operands are 2’s compliment numbers, we can easily use the adder to subtract two numbers. We do this by inverting the bits of one operand and setting the carry-in of the first half-adder to one.
The carry-in, CI, and borrow-in, BI, can be shared, as well as the carry-out, CO, and borrow from left, BL, signals. Here are the functions for each block:
F = (A xor B xor CI)
CO = (AB + ACI + BCI)
A
B
CI
F
CO
Circuit diagram for each block
Combinational adder/subtractor block diagram
CI
A 3 B (^3)
F (^3)
A (^2)
F (^2)
A (^1)
F (^1)
A (^0)
F (^0)
Add’/ Subtract
A B A B A B A B
CI CI CI
0 1
B 3 ’ B (^2) 0 1
B 2 ’ B (^1) 0 1
B 1 ’ B (^0) 0 1
B 0 ’ Sel Sel Sel Sel
CO CO CO CO
Overflow
Exercise 5.
(a) Here is the truth table for R 0 and R 1 :
Note that since division by zero will never be requested, there are eight don’t-cares for both R 1 and R 0.
(b) K-Maps for R 1 and R 0 :
K-Map for R 1
K-Map for R 0
- i - i out - i - i - i - i - i - i - s2 s1 s - _ - _ Exercise 5.
(a) Block diagram for adder with carry lookahead:
32-bit Carry Lookahead Adder
The same idea is used for the 64-bit adder. We would use 4 of the 16-bit carry lookahead adders connected in series.
(b) The 32-bit implementation will have a critical delay of 13 time units. The 64-bit implementation will have a critical delay of 23 time units.
A[15-12] A[15-12] 4-bit Adder P G
C 12
S[15-12]
A[11-8] A[11-8] 4-bit Adder P G
C 8
S[11-8]
A[7-4] A[7-4] 4-bit Adder P G
C 4
S[7-4]
A[3-0] A[3-0] 4-bit Adder P G
C 0
S[3-0]
4 4 4 4 4 4 4 4
4 4 4 4
Lookahead Carry Unit
P 3 G 3 C 3 P 2 G 2 C 2 P 1 G 1 C 1 P 0 G (^0)
P (^) 3-0 G (^) 3-
A[31-28] A[31-28] 4-bit Adder P G
C 28
S[31-28]
A[27-24] A[27-24] 4-bit Adder P G
C 24
S[27-24]
A[23-20] A[23-20] 4-bit Adder P G
C 20
S[23-20]
A[19-16] A[19-16] 4-bit Adder P G
C 16
S[19-16]
4 4 4 4 4 4 4 4
4 4 4 4
Lookahead Carry Unit
P 3 G 3 C 3 P 2 G 2 C 2 P 1 G 1 C 1 P 0 G (^0)
P (^) 3-0 G (^) 3-
C 32
C 16 C 0
C 16
Exercise 5.
The main functionality of the ALU can be broken into four parts: 0, arithmetic, logic, and
The separate components are grouped together in the following circuit schematic:
I1 S
I1 S
I1 S
I1 S^ I0I1 S
i s1s
B
S B A S S
A
B
C_I
C_I
C_I C_O
S0 (^) S
A B A B A B S
F
Gnd
Vcc S S S S S S
Exercise 5.
The main functionality of the ALU can be broken into four parts: 0, arithmetic, logic, and
The separate components are grouped together in the following circuit schematic:
I1 S
I I1 S
I I1 S
I I1 S^ I0I1 S
i i i i s1s
B
S B A
A
B
S0 (^) S
A B A B A B S
F
Gnd
Vcc S S S S S S
A CO B S CI
U
adder
CO
I I1 S
CI S1 Vcc S