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

相关推荐
神奇元创16 小时前
商用级光路加速卡:大模型推理的极速落地方案
python·神经网络·fpga开发·dsp开发
FPGA小徐1 天前
深度神经网络FPGA设计进展、实现与展望
fpga开发
FPGA小徐1 天前
FPGA数字信号处理(一)数字混频实现详解|NCO/DDS原理、有符号数避坑、直流滤除工程实战
fpga开发
Passionate.Z1 天前
基于FPGA的CLAHE自适应限制对比度直方图均衡算法硬件verilog实现
图像处理·嵌入式硬件·算法·fpga开发·fpga
Szime2 天前
AD9694 国产替代方案:四通道高速 ADC 在通信与雷达项目中的选型参考
单片机·嵌入式硬件·fpga开发
kaizq2 天前
在线MakerChip虚拟FPGA设计动态仿真实践
fpga开发·mulerun·makerchip·virtualfpgalab·在线动态仿真·imacopilot
FPGA小徐2 天前
OV5640 摄像头 DDR3 缓存 HDMI/VGA 显示系统详解与
fpga开发
Monkey of Semi2 天前
ARTIX-7 FPGA 核心板学习之FPGA Xilinx 7 series 命名规则
fpga开发
ALINX技术博客2 天前
【黑金云课堂】FPGA技术教程Vitis开发:TCP以太网通信
网络协议·tcp/ip·fpga开发
FPGA小徐2 天前
FPGA 电赛信号叠加与分离项目 完整工程包
fpga开发