(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 小时前
复旦微 FMQL100TAI 开发 8 问:仿真器、系统、接口高频问题解答
人工智能·嵌入式硬件·fpga开发
北京青翼科技7 小时前
青翼基于PCIe的VU13P FPGA信号处理板
fpga开发·fpga开发板·图像处理卡·pcie板卡
szxinmai主板定制专家7 小时前
NXP LS1046A 硬件方案: LS1046A+FPGA 异构加速架构实践
大数据·图像处理·人工智能·嵌入式硬件·fpga开发
unicrom_深圳市由你创科技8 小时前
FPGA仿真正常,上板为何出错?
fpga
SDAU20051 天前
verilog计数器中增减操作之资源占用
verilog
Riwuarua1 天前
从近似0基础开始FPGA开发 -- part.14 JESD204协议、IP核与嵌入式初始化
fpga开发·jesd
Eloudy1 天前
fpga-latency 指标分析与触发机制
fpga
第二层皮-合肥2 天前
Vivado 自动生成的 AXI‑Lite 从机 IP 的操作步骤
fpga开发
blue_ice .2 天前
Verilog DDS 数字信号发生器:DAC 输出模拟波形与 ADC 回采观测
开发语言·单片机·嵌入式硬件·fpga开发
Eloudy2 天前
基于 PTP 的 FPGA→RoCE→CPU 单向延迟测量实验方案
gpu·fpga