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

相关推荐
szxinmai主板定制专家13 小时前
基于 PC 的控制技术+ethercat+linux实时系统,助力追踪标签规模化生产,支持国产化
arm开发·人工智能·嵌入式硬件·yolo·fpga开发
坏孩子的诺亚方舟21 小时前
modelsim基础2_modelsim仿真分析
fpga·modelsim·仿真分析
tiger11921 小时前
FPGA 在大模型推理中的应用
人工智能·llm·fpga·大模型推理
博览鸿蒙1 天前
如何为春招的金三银四做好准备
fpga开发
FPGA小迷弟1 天前
FPGA处理图像需要用到的主流接口详解
学习·fpga开发·verilog·fpga·modelsim
LeoZY_1 天前
CH347 USB转JTAG功能使用笔记:CH347根据SVF文件实现任意FPGA下载
笔记·stm32·嵌入式硬件·fpga开发·硬件架构·硬件工程
博览鸿蒙1 天前
FPGA在高性能计算中的应用:数据流加速与优化
fpga开发
maverick_1111 天前
【数字图像处理与FPGA实现】00 绪,建立“算法思维“与“硬件思维“的桥梁
图像处理·fpga开发
乌恩大侠2 天前
【OAI】 USRP 在conf文件中的配置,RU选项
fpga开发
qq_小单车3 天前
xilinx-DNA
fpga开发·xilinx