Exercise4 Cullymaterial
Exercise4 Cullymaterial
Figure 1
1. Model the finite-state machine shown in Figure 1 using VHDL in a two-process coding style.
a) Propose a test strategy.
b) Write a VHDL description for a testbench that uses the test strategy proposed in the
previous part. Use an ASSERT statement for each tested feature.
c) Run the testbench on ModelSim and report the output waveforms.
Figure 2
2. Figure 2 describes a finite state machine with an input a and two outputs x and y. Output x is
true when the input is the same now as it was last clock cycle. Output y is true when the input is
the same now as it was for the past two clock cycles. Model the finite-state machine using
VHDL in a two-process coding style.
a) Propose a test strategy.
b) Write a VHDL description for a testbench that uses the test strategy proposed in the
previous part. Use an ASSERT statement for each tested feature.
c) Run the testbench on ModelSim and report the output waveforms.
Page 1 of 3
Figure 3
4. Figure 3 shows a divide-by-3 clock frequency divider. It is built with a finite-state machine
with no inputs.
a) For each state bit, write an equation for its next state.
b) Construct the state transition table.
c) Draw the state transition diagram, hence verify the circuit operation.
d) Does the divider need to be initialized to certain states for proper operation, or can it start from
any state? Why?
e) What output duty cycle does this divider provide.
Figure 4
6. Based on the state transition diagram obtained in problem 5 part (a), write down a synthesizable
VHDL code using a “Two Process” description. Add a synchronous ‘reset’ input if needed
according to part (b).
Page 2 of 3
7. A convolutional code is a type of error-correcting codes used in numerous applications to
achieve reliable data transfer. A convolutional encoder is described by the following state
diagram.
Figure 5
a) Write a VHDL code for the convolutional encoder using the state assignments shown in the
table above.
b) Write a testbench for the encoder showing the output code for an input message of (10011).
c) Run the testbench on ModelSim and report the output waveforms.
M. Dessouky
Page 3 of 3