Professional Documents
Culture Documents
SEMESTER A
YEAR 2022
FINAL EXAMINATION
YEAR THREE
Instruction to Candidates :
Q1. (a)
Figure 1
(ii) Write a Data Flow Verilog HDL code using an if-else statement to
represent the circuit shown in Figure 1. Assume that all delays are
negligible.
Notes: The module and ports declaration can be excluded. (8 marks)
(b) Write the Verilog HDL code of the decoder using the case statement,
concatenation operator, and continuous assignment. The 2 to 4 Binary
Decoder is shown in Figure 2. The relationship between the inputs and outputs
is illustrated in Table 1. (14 marks)
Inputs Outputs
EN A1 A2 D0 D1 D2 D3
1 X X 0 0 0 0
0 0 0 0 0 0 1
0 0 1 0 0 1 0
0 1 0 0 1 0 0
0 1 1 1 0 0 0
Figure 2 Table 1
[Total : 25 marks]
Q2. (a)
Figure 3
(i) Draw the circuit of the Verilog process shown in Figure 3. (6 marks)
(ii) Justify the reason of clr is used in the sensitivity list instead of C.
(2 marks)
(b) A client requests to design a chip for converting an 8-bit binary number to a 3
digit decimal number to be displayed on three 7 segment LEDs. Another input
signal, signednumber, is used to determine whether to interpret the binary
number as a signed or unsigned number. If signednumber is a 1, the binary
number is interpreted as a signed number, otherwise it is interpreted as an
unsigned number. An optional negative sign is displayed on a fourth 7 segment
LED as shown in Figure 4. The 7-segment BCD table as shown in Table 2. As
a design engineer, write the behavioral Verilog code for the design.
Figure 4
7-Segment BCD Decimal
1111110 0
0110000 1
1101101 2
1111001 3
0110011 4
1011011 5
1011111 6
1110000 7
1111111 8
1110011 9
0000001 -
Table 2
(17 marks)
[Total : 25 marks]
Q3. (a) Determine the state diagram for the Moore system whose output is 1 if and only
if the input shown in the Table 3 has been alternating for at least four clock
periods. (10 marks)
x 0 0 1 0 1 1 0 1 0 1 0 1 0 0
y ? ? 0 0 0 1 0 0 0 1 1 1 1 1 0
Table 3
(b) FSC Sdn Bhd is planning to develop a modulo-4 up/down counter chip using
D-flip-flop. The count is represented by the content of the flip-flop. The circuit
has a Count signal and an Up signal. The counter counts when Count is asserted,
and stops when Count is de-asserted. The Up signal determines the direction of
the count. When Up is asserted, the count increments by one at each clock cycle.
When Up is de-asserted, the count decrements by one at each clock cycle. The
Modulo-4 up/ down counter condition as shown in Table 4.
(i) Construct the Finite State table for the counter chip. (8 marks)
[Total : 25 marks]
Q4. Design a binary-to-BCD converter that converts a 10-bit binary number to a 3-digit
BCD number. Assume that the binary number is ≤ 999. Initially the binary number is
placed in Register B. When an St signal is received, conversion to BCD takes place and
the resulting BCD number is stored in the Register A (12 bits). Initially A contains 0000
0000 0000. The conversion algorithm is as follows:
(b) Develop the state diagram for the converter (Four states only).
(6 marks)
________________________________________