HDL & Verification

What is the purpose of a module in Verilog?

  1. ATo define a circuit component with input and output ports so it can be used inside other modules
  2. BTo pause program execution temporarily
  3. CTo print simulation results on the screen
Show answer and explanation

Answer: A. To define a circuit component with input and output ports so it can be used inside other modules

A module defines a block of circuitry with input and output ports, representing anything from an adder or counter to an entire CPU. A defined module can be used as a component any number of times inside other modules (instantiation), with its ports wired together to build larger circuits. Circuits are built hierarchically, much like placing and wiring parts on a board.

  • A. Correct. It is the unit for building circuits hierarchically.
  • B. It does not pause execution.
  • C. Display uses $display and similar.
Practice this topic Back to topic

More HDL & Verification questions

  1. What is the difference between wire and reg in Verilog?
  2. What circuit does the Verilog assign statement above represent?
  3. What circuit does logic synthesis create from the Verilog above?
  4. How does Verilog's nonblocking assignment (<=) behave?
  5. In the code above, a = 0 and b = 1 just before a rising clock edge. What are a and b after the edge?