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

相关推荐
点灯大师李14 小时前
Zynq FPGA UART程序固化完整流程文档
fpga开发
坤驰科技14 小时前
测风激光雷达数据采集解决方案
fpga开发
博览鸿蒙15 小时前
FPGA 可以转 IC 设计吗?需要具备哪些条件
fpga开发
GateWorld16 小时前
真双端口RAM在FPGA中使用
fpga开发·ram·实战经验·tdp-ram使用
stars-he19 小时前
FPGA学习笔记(9)以太网UDP数据报文发送电路设计(三)
笔记·学习·fpga开发
stars-he20 小时前
FPGA学习笔记-拔河游戏电路设计
笔记·学习·fpga开发
minglie121 小时前
myhdl
fpga开发
cycf2 天前
PCIE BAR空间解读(六)
fpga开发
FPGA小迷弟2 天前
ModelSim操作教程 详细操作手册【一】
fpga开发·fpga·modelsim·fpga仿真·rtl仿真
minglie12 天前
cocotb 配合 iverilog 搭建 Verilog 仿真工程
fpga开发