Verilog wire or reg for input and output
This article explains whether we should use wire or reg for input and output.
Difference
If you plan to assign your output in sequential code, such as within an
always
block, declare it as areg
(which really is a misnomer for “variable” in Verilog). Otherwise, it should be awire
, which is also the default.
Explain
-
An output reg
foo
is just shorthand foroutput foo_wire; reg foo; assign foo_wire = foo
. -
input wire
andoutput wire
are the same asinput
andoutput
: it’s just more explicit.