ECE 6120 Exam 2a - HDLs for Sequential System Controller - Prof. Roger L. Haggard, Exams of Electrical and Electronics Engineering

Instructions for exam 2a of ece 6120 - digital design using hdls, focusing on the synthesizability analysis of given verilog code fragments and the development of verilog code for the controller part of a sequential system based on an asmd chart. The controller is an explicit finite state machine with inputs clk, rst, sctl, and datae0, and outputs load, enab, and done.

Typology: Exams

Pre 2010

Uploaded on 07/30/2009

koofers-user-g4t
koofers-user-g4t 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE 6120 Digital Design Using HDLs
Exam 2a 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 (one side usage of green engineering
paper). Start each problem on a new sheet of paper. Clearly label all answers with the
problem number. Follow the 6120 HDL Guidelines for code writing style. Assume zero
delays unless otherwise specified. All code written must be synthesizable with
Quartus.
1. [15 pts] For each of the following Verilog code fragments occurring within modules,
determine whether it is synthesizable in Quartus. Answer “yes” if it is synthesizable; if
not synthesizable, answer “no” and explain why. Assume all single-letter symbols are
multibit variables, not constants. Assume that the rest of the code in each module is
properly written.
a. assign r = & (a | b);
b. always @ (a or b)
begin
r <= a + b;
if (b < 5) y <= a 2;
else r <= a b;
end
c. assign r = a >> b;
d. always @ (negedge clock)
begin
r = a - b;
if (a == b) r = 2’bxx;
end
e. always @ (a or b)
if (a == 3’b10x) y = a;
else y = b;
f. assign r = (b / 8) + a;
g. always @ (posedge clk)
begin
r <= b & c;
@ (posedge clk) y <= a;
end
pf2

Partial preview of the text

Download ECE 6120 Exam 2a - HDLs for Sequential System Controller - Prof. Roger L. Haggard and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

ECE 6120 – Digital Design Using HDLs

Exam 2a – 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 (one side usage of green engineering paper). Start each problem on a new sheet of paper. Clearly label all answers with the problem number. Follow the 6120 HDL Guidelines for code writing style. Assume zero delays unless otherwise specified. All code written must be synthesizable with Quartus.

  1. [15 pts] For each of the following Verilog code fragments occurring within modules, determine whether it is synthesizable in Quartus. Answer “yes” if it is synthesizable; if not synthesizable, answer “no” and explain why. Assume all single-letter symbols are multibit variables, not constants. Assume that the rest of the code in each module is properly written. a. assign r = & (a | b); b. always @ (a or b) begin r <= a + b; if (b < 5) y <= a – 2; else r <= a – b; end c. assign r = a >> b; d. always @ (negedge clock) begin r = a - b; if (a == b) r = 2’bxx; end e. always @ (a or b) if (a == 3’b10x) y = a; else y = b; f. assign r = (b / 8) + a; g. always @ (posedge clk) begin r <= b & c; @ (posedge clk) y <= a; end
  1. [35 pts] Concisely write the Verilog code module for the controller part of a sequential system according to the given ASMD chart. Also determine how many simulation steps are required to test all the transitions of the controller and list all these state transitions (using the state names), like: oldstate -> newstate.

The controller is an explicit finite state machine with inputs Clk (synchronizing clock), Rst (asynchronous reset to controller and datapath), Sctl (serial control), and DataE (data equals zero). The controller outputs are Load (load a register in the datapath), Enab (enable the data operation in the datapath), and Done (sequence is finished). Use one-hot state encoding.