
ECE 6120 – Digital Design Using HDLs
Exam 1b – Spring 2007
NOTES: Closed book, except for one Verilog summary sheet and one sheet of
handwritten notes that are allowed. Please draw and write NEATLY (If I cannot read it, I
must mark it WRONG). Do all work in pencil and put all answers on YOUR paper, not
these sheets, following the specified class format. Follow the 6120 HDL Guidelines for
code writing style. Start each problem on a new sheet of green engineering paper.
Clearly label all answers with the problem number. Assume zero delays unless otherwise
specified. All code must be synthesizable with Quartus.
1. [10 pts] State all the rules that must be followed to create a Verilog cyclic behavior
that results in purely combinational logic, without any latch or flip-flop logic.
2. [15 pts] Write Verilog example code fragments (NOT a complete module) to show
the two different methods of creating a set of three parameter values for instantiating a
module (NOT for defining the module). Briefly explain your examples.
3. [25 pts] Concisely write a complete behavioral Verilog module with a cyclic behavior
that implements a parameterized decoder. The size of the decoder will be determined
whenever it is instantiated. The single-bit active-low enable (En_L) controls the decoder
operation. The input vector (I) size may be any number of bits and the corresponding
decoded output vector (W) size will also be variable, of course. The following truth table
illustrates the operation of a 2-to4 decoder, as an example, where x means “don’t care”.
This should be the default size of the decoder.
En_L I1 I0 | W3 W2 W1 W0
------------|------------
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