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

相关推荐
GateWorld10 小时前
FPGA内部模块详解之五FPGA的“对外窗口”——可编程输入输出单元(I/O Logic)
fpga开发·iologic
ZPC821013 小时前
FPGA IP核协议清单
fpga开发
fei_sun13 小时前
FPGA与CPU数据通信(待补充)
fpga开发
m0_5982500014 小时前
FPGA硬件设计-DDR4引脚分配设计规则
fpga开发
XMAIPC_Robot14 小时前
基于RK3588 ARM+FPGA的电火花数控系统设计与测试(三)
运维·arm开发·人工智能·fpga开发·边缘计算
XMAIPC_Robot17 小时前
基于RK3588 ARM+FPGA的电火花数控硬件平台总体设计(二)
运维·arm开发·人工智能·fpga开发·边缘计算
ALINX技术博客19 小时前
【黑金云课堂笔记】第一~二期FPGA知识点总结
笔记·fpga开发
2402910033720 小时前
modelsim入门--从安装到第一个程序
fpga开发
我爱C编程20 小时前
【3.1】基于FPGA的FFT/IFFT模块开发——前言/目录
fpga开发·教程·通信·fft·傅里叶变换
ZPC821020 小时前
RDMA 与RoCE v2
fpga开发