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

相关推荐
我爱C编程11 小时前
【仿真测试】基于FPGA的完整16QAM通信链路实现,含频偏锁定,帧同步,定时点,Viterbi译码,信道,误码统计
fpga开发·16qam·帧同步·卷积编码·viterbi译码·维特比译码·频偏锁定
云雾J视界14 小时前
AI芯片设计实战:用Verilog高级综合技术优化神经网络加速器功耗与性能
深度学习·神经网络·verilog·nvidia·ai芯片·卷积加速器
s09071361 天前
ZYNQ DMA to UDP 数据传输系统设计文档
网络协议·fpga开发·udp
燎原星火*1 天前
QSPI IP核 基本参数
fpga开发
XINVRY-FPGA1 天前
XCVU9P-2FLGC2104I Xilinx AMD Virtex UltraScale+ FPGA
嵌入式硬件·机器学习·计算机视觉·fpga开发·硬件工程·dsp开发·fpga
FPGA_小田老师1 天前
FPGA Debug:PCIE一直自动重启(link up一直高低切换)
fpga开发·pcie debug·pcie初始化问题
hexiaoyan8271 天前
视频信号检测板卡:208-Base Camera Link 图像信号模拟器
fpga开发·图像信号模拟器·视频信号检测·视频信号分析·智能图像分析
竹君子1 天前
新能源知识库(151) RTDS和RT-LAB比较
fpga开发
brave and determined1 天前
可编程逻辑器件学习(day34):半导体编年史:从法拉第的意外发现到塑造现代文明的硅基浪潮
人工智能·深度学习·fpga开发·verilog·fpga·设计规范·嵌入式设计
FPGA_Linuxer1 天前
RFSOC PCIE 4.0读写测试
fpga开发