(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作为硬件仿真语言的语法剩下的部分。

相关推荐
步达硬件5 小时前
【FPGA】DP、HDMI、USB4、GPMI、eDP、LVDS等音视频协议及性能对比
fpga开发
-木槿昔年-21 小时前
【米尔-安路MYD-YM90X创意秀】飞龙派学习和PS串口实践
学习·fpga开发
Aaron158821 小时前
基于RFSOC+VU13P+GPU架构在雷达电子战的技术
人工智能·算法·fpga开发·架构·硬件工程·信号处理·基带工程
jifengzhiling1 天前
伺服驱动器中DSP与FPGA高效协同架构解析
fpga开发·foc电机控制
太爱学习了1 天前
FPGA图像处理之:图像畸变矫正原理及matlab与fpga实现
图像处理·matlab·fpga开发
技术性摸鱼2 天前
FPGA选型参数
fpga开发
FPGA_小田老师2 天前
ibert 7 Series GT:IBERT远近端(内外)环回测试
fpga开发·ibert·gt测试·近端pcs环回·近端pma环回·远端pcs环回·远端pma环回
尤老师FPGA2 天前
【无标题】
fpga开发
才鲸嵌入式2 天前
香山CPU(国产开源)的 SoC SDK底层程序编写,以及其它开源SoC芯片介绍
c语言·单片机·嵌入式·arm·cpu·verilog·fpga
175063319452 天前
VIVADO VLA VIO 硬件调试 降采样
fpga开发