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

相关推荐
czhaii10 小时前
51的DSP来了, 100MHz, STC32G144K246
stm32·单片机·fpga开发
FPGA_ADDA1 天前
全国产复旦微FMQL100TAI 核心板
fpga开发·信号处理·全国产·fmql100tai·zynq7国产化
Terasic友晶科技1 天前
5-基于C5G 开发板的FPGA 串口通信设计 (FT232R, Altera UART IP和Nios II系统串口收发命令)
fpga开发·串口·uart·c5g
爱敲代码的loopy1 天前
verilog-正弦波生成器
fpga开发
尤老师FPGA1 天前
DDR4系列之ECC功能(六)
fpga开发·ddr4
Terasic友晶科技1 天前
3-基于FPGA开发板OSK/TSP/C5P的串口通信设计 (CP2102N)
fpga开发·串口·uart·tsp·c5p·osk
gouqu51561 天前
FPGA开发编译
fpga开发
GilgameshJSS1 天前
STM32H743-ARM例程43-SD_IAP_FPGA
arm开发·stm32·fpga开发
FPGA_小田老师1 天前
FPGA语法基础(三):Verilog 位选择语法详解
fpga开发·verilog语法·verilog位选择
坏孩子的诺亚方舟1 天前
FPGA系统架构设计实践5_IP的封装优化
fpga·vivado·rqs·工程质量