HDL & Verification
Learn Verilog and SystemVerilog basics with multiple-choice questions: synthesizable code, blocking versus nonblocking assignments, unintended latches, state machines, testbenches and assertions.
HDL & Verification: key points
Digital circuits are written in hardware description languages (HDLs) such as Verilog and SystemVerilog. The code looks like a program, but it describes hardware that operates concurrently. HDLs have their own rules: which constructs can be synthesized into circuits, when to use blocking versus nonblocking assignments, and how missing conditions create unintended latches.
Whether a circuit is correct is checked with a testbench that drives inputs. From writing state machines and automatically checking properties with assertions to measuring verification completeness with coverage and generating circuits from C with high-level synthesis, this topic covers the basics of designing and verifying with HDLs.
All HDL & Verification questions (50)
- What is a major difference between a description written in an HDL such as Verilog and a software program in a language such as C?
- What is the purpose of a module in Verilog?
- What is the difference between wire and reg in Verilog?
- What circuit does the Verilog assign statement above represent?
- What circuit does logic synthesis create from the Verilog above?
- How does Verilog's nonblocking assignment (<=) behave?
- In the code above, a = 0 and b = 1 just before a rising clock edge. What are a and b after the edge?
- Intending a two-stage shift register, someone wrote the code above with blocking assignments (=). What goes wrong?
- What is the common guideline for choosing assignment types in Verilog?
- What does writing "always @(*)" mean in Verilog?
- Intending combinational logic, someone wrote the code above. What problem can occur?
- Intending combinational logic, someone writes the code above. What does logic synthesis produce?
- Why does the code above create a latch, and what is the fix?
- Which coding style is commonly used to prevent unintended latches in combinational always blocks?
- Which Verilog construct is ignored by logic synthesis and does not become hardware (a simulation-only construct)?
- When the code above, which counts the 1s in 8-bit d, is synthesized, what kind of circuit results?
- What type of reset does the code above have, and how does it behave?
- What is the difference between synchronous and asynchronous resets?
- In circuits using asynchronous reset, why is reset release (the 0-to-1 transition) synchronized to the clock through two flip-flops before distribution?
- What is the basic structure of a state machine written in an HDL?
- In the state machine above, why does the second always block begin with "next = state;"?
- What characterizes a Mealy state machine?
- What is a characteristic of one-hot encoding for state machine states?
- For a state machine with three states, how many flip-flops are needed to store the state (binary encoding / one-hot encoding)?
- In the 4-bit counter above, when count is 15 and a rising clock edge arrives, what does count become?
- In Verilog, two 8-bit signals a and b are added and assigned to an 8-bit signal s (assign s = a + b;). What should be watched for?
- Intending a to be signed -1, someone wrote the code above, and gt became 1. Why?
- Which set of values makes up the four-state logic used in Verilog simulation?
- In simulation, a register without reset starts as X. What happens in the real chip?
- In the code above, when sel is X, Verilog simulation selects b for y. Why is this a problem for verification?
- Which statement about tri-state descriptions that output Z (high impedance) in an HDL is generally correct?
- Which describes a testbench used in HDL verification?
- What is the period of the clock generated by the testbench code above (time unit 1 ns)?
- In a testbench, changing a design input with a blocking assignment at the same instant as the rising clock edge can cause problems. Which pairs the reason with a fix correctly?
- What characterizes a self-checking testbench?
- What is the purpose of a reference (golden) model written in C or similar in verification?
- What is the main purpose of dumping simulation results to a file in a format such as VCD?
- Why should the random seed be recorded in tests that use random inputs?
- Which describes constrained random verification in SystemVerilog?
- Which describes regression testing in circuit design?
- What is an advantage of SystemVerilog's logic type?
- What is the advantage of using SystemVerilog's always_ff and always_comb instead of Verilog's always?
- What is the advantage of writing a module with a parameter as above?
- What does the generate statement above do?
- What is the role of a lint tool in HDL verification?
- What is the main purpose of simulating the post-synthesis or post-layout gate-level netlist with delay information?
- What is a structure like the code above, where a combinational output feeds back to its own input without passing through a flip-flop, called, and why should it be avoided?
- When the code above is synthesized for an FPGA, how is it generally implemented?
- In combinational logic, how does a long if/else-if chain compare with a case statement whose conditions are mutually exclusive?
- What is the difference between Verilog's equality operators "==" and "==="?