(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编程2 小时前
【1.22】基于FPGA的Costas环开发课程学习总结
学习·fpga开发·costas环
FPGA_无线通信4 小时前
USB3.0 GPIF II接口
fpga开发
Terasic友晶科技4 小时前
5-DE10-Nano的HDMI方块移动案例——基于FPGA的I2C控制模块设计
单片机·嵌入式硬件·fpga开发·时钟分频·hdmi方块移动·i2c控制模块设计·配置寄存器
Joshua-a4 小时前
AGM FPGA AG10K 使用Supra新建Quartus工程开发教程
fpga开发
西安同步高经理5 小时前
脉冲信号发生器时序控制核心、延迟信号发生器、时间间隔发生器
fpga开发
FPGA_小田老师7 小时前
FPGA基础知识(二十一):xilinx FPGA中常用的原语
fpga开发·bufg·ibufds·obufds·iobuf·差分转单端·inout选择
minglie17 小时前
Tang-Nano-1K测试
fpga开发
千歌叹尽执夏7 小时前
FPGA:自定义AXI-FIFO主机接口(含versal读写工程)
fpga开发·ddr4·axi总线·versal·自定义fifo
可编程芯片开发20 小时前
基于FPGA的数字示波器设计和硬件调试,将正弦波形通过HDMI接口在屏幕上动态显示
fpga开发·hdmi·数字示波器·正弦波形
风_峰1 天前
AMD FPGA产品系列讲解
fpga开发