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

相关推荐
ALINX技术博客22 分钟前
【黑金云课堂】FPGA技术教程Vitis开发:PS端UART与CAN通信
fpga开发·fpga
FPGA小迷弟18 小时前
FPGA工程师常见面试问题,有参考答案,必学!!!
fpga开发·面试·职场和发展·verilog·fpga·modelsim
followless1 天前
linux server中搭建questasim 10.6c & ise14.7
linux·fpga开发
乌恩大侠1 天前
【AI-RAN】WNC O-RU 配置、英伟达 AI-RAN、
fpga开发·o-ru
小麦嵌入式3 天前
FPGA入门(一):手把手教你用 Vivado 创建工程并仿真
stm32·单片机·嵌入式硬件·mcu·fpga开发·硬件架构·硬件工程
m0_46644103詹湛3 天前
(一)FPGA :基础概念详解(Xilinx平台)
笔记·学习·fpga开发·verilog
xyx-3v4 天前
ZYNQ 简介
fpga开发
xyx-3v4 天前
Zynq-7000
fpga开发
xyx-3v4 天前
zynq7010和zynq7020的区别
fpga开发
xyx-3v4 天前
LUT(Look-Up Table,查找表)的定义与核心概念
fpga开发