Using wire or reg with input or output in Verilog

后端 未结 5 2185
夕颜
夕颜 2020-12-07 18:40

When you declare something as input or output, how do you know if you have to also declare it as a reg or a wire?

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 19:23

    reg and wire specify how the object will be assigned and are therefore only meaningful for outputs.

    If you plan to assign your output in sequential code,such as within an always block, declare it as a reg (which really is a misnomer for "variable" in Verilog). Otherwise, it should be a wire, which is also the default.

提交回复
热议问题