Professional Documents
Culture Documents
Verilog HDL
Final Examination
Take Home
Due Friday May 15, 2004 @ Midnight.
Name:
2) Write the Verilog code for a negative edge triggered D flip flop with an active low
asynchronous RESET. Name the module dffrn. Name the ports (in this order) Q, D,
CLK, RESET. Write the full module, declaring ALL data types. Write a testbench to
stimulate the dffrn module. Instantiate the module using named port mapping. You
chose the period of CLK.
3) Create a Verilog simulation model that represents the following circuit. Be sure to
include all pin-to-pin delays. Use specparams to define the pin-to-pin rise and fall
times. The default timing on the pin-to-pin delays is 0.125ns. Name the module
anxnna.
A
B
w1
w2
C
OUT
w3
w4
D
S1 S2
4) Write the Verilog code for the following diagram. Assume negative edge triggered
flops, and an active low synchronous reset. Use dataflow modeling (assign statements)
for the combinational elements. Use separate procedures for each flop element.
5) Write the Verilog code to implement a device that will shift in serial data and
increment a counter every time the pattern 16hAFAF is found. The counter will reset
every 1000 clock cycles. Assume positive edge triggered flop(s) and asynchronous active
high reset. The only output of the device will be the counter. The only inputs will be
data, clock, and reset. Use normal procedural statements to create the design.
6) Recode problem 5 as a finite state machine. Declare all state variables. Put the
synchronous elements in one process and the combinational in the other. Create a
separate module for the timer that is controlled by the State Machine. State names
and encoding is up to you.
7) Create a User Defined Primitive (UDP) for a positive edge triggered D Flip-Flop
with an active low reset and a notifier. Name the ports: Q, CLK, DATA, RN,
NOTIFY.
8) Instantiate the UDP in problem 7 in a higher level module. Write a testbench for
the higher level module. In the testbench, use constructs to create an output file
called simulation.txt. The simulation.txt file should be the results from
monitoring all inputs and output(s) of the UDP.
9) Write the full Verilog module that creates 4 flip-flops with the output of the first
flop feeding the input of the second flop, the output of the second flop feeding the
input of the third flop, and so forth. The ports will be declared as DATA,
CLOCK, RESETN, Q. Q will be the output. RESETN is an active low
asynchronous reset. The flops are rising edge CLOCK triggered.
10) Write the Verilog code for Problem 4 using Verilog 2001 constructs described in
section 18 of the class lectures. Declare the ports and data types in a manner that
is the least verbose. Put the combinational elements in procedures separate from
the synchronous elements. Use constructs that ensure full sensitivity lists for the
combinational elements. Write a testbench that instantiates the design 4 times.
Use bussed port names in the testbench. Use the generate loop to create the
instantiations.