HDL & Verification
What is the difference between wire and reg in Verilog?
- AA reg always becomes a flip-flop and a wire always becomes combinational logic
- Bwire represents connections driven by assign statements and the like; reg is a signal assigned inside always blocks, but a reg does not necessarily become a flip-flop
- Cwire holds numbers and reg holds characters
Show answer and explanation
Answer: B. wire represents connections driven by assign statements and the like; reg is a signal assigned inside always blocks, but a reg does not necessarily become a flip-flop
In Verilog, signals driven by assign statements or module outputs are declared wire, and signals assigned inside always blocks are declared reg. reg looks like short for register, but assigned inside always @(*) it becomes combinational logic, not a flip-flop. Whether a flip-flop results depends on whether the value is updated on a clock edge. SystemVerilog allows both to be written as logic.
- A. Despite the name, a reg can become combinational logic.
- B. Correct. A reg in always @(*) becomes combinational logic.
- C. Neither is a character type.