(Verilog) wire和reg,以及always

For combinational always blocks, always use a sensitivity list of (*). Explicitly listing out the signals is error-prone (if you miss one), and is ignored for hardware synthesis. If you explicitly specify the sensitivity list and miss a signal, the synthesized hardware will still behave as though (*) was specified, but the simulation will not and not match the hardware's behaviour. (In SystemVerilog, use always_comb.)

A note on wire vs. reg: The left-hand-side of an assign statement must be a net type (e.g., wire), while the left-hand-side of a procedural assignment (in an always block) must be a variable type (e.g., reg). These types (wire vs. reg) have nothing to do with what hardware is synthesized, and is just syntax left over from Verilog's use as a hardware simulation language.

对于组合always块,总是使用(*)的敏感性列表。明确列出信号是容易出错的(如果你漏掉一个),并且在硬件合成中会被忽略。如果你明确指定了敏感性列表但漏掉了一个信号,合成后的硬件将仍然按照(*)指定的方式工作,但仿真将不会与硬件的行为相匹配。(在SystemVerilog中,请使用always_comb)。

关于wire和reg的注意事项:assign语句的左边必须是一个网络类型(如wire),而过程赋值(在always块中)的左边必须是一个变量类型(如reg)。这些类型(wire vs. reg)与合成的硬件无关,只是Verilog作为硬件仿真语言的语法剩下的部分。

相关推荐
海涛高软18 小时前
verlog中阻塞赋值和非阻塞赋值
fpga开发
tiantianuser20 小时前
RDMA设计29:RoCE v2 发送及接收模块设计2
服务器·fpga开发·rdma·fpga设计·高速传输
9527华安1 天前
FPGA实现GTP光口视频转USB3.0 UVC,基于Aurora8B10B+FT602芯片架构,提供4套工程源码和技术支持
fpga开发·gtp·usb3.0·uvc·aurora8b10b·ft602
zy135380675731 天前
12V输入5V/2A输出升降压芯片AH4002
科技·单片机·物联网·fpga开发·硬件工程·智能电视
dadaobusi1 天前
verilog的generate
fpga开发
从此不归路1 天前
FPGA 结构与 CAD 设计(第2章)
ide·fpga开发
FPGA_小田老师1 天前
FPGA例程(5):时钟(clock)分频倍频(PLL/MMCM)实验--vivado行为级仿真、综合后仿真和实现后仿真说明
fpga开发·pll·mmcm·run simulation·前仿真·后仿真
3有青年1 天前
HPS cold reset pin和AVST configuration的功能和作用
fpga开发
3有青年2 天前
Altera FPGA操作系统支持的情况分析
fpga开发
国科安芯2 天前
卫星通讯导航FPGA供电单元DCDC芯片ASP4644S2B可靠性分析
单片机·嵌入式硬件·fpga开发·架构·安全性测试