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

相关推荐
brave and determined12 小时前
可编程逻辑器件学习(day24):异构计算:突破算力瓶颈的未来之路
人工智能·嵌入式硬件·深度学习·学习·算法·fpga·asic
海涛高软1 天前
yolov8目标检测训练在rk3588上部署
fpga开发
第二层皮-合肥1 天前
USB3.0专题-硬件的测试
fpga开发
hexiaoyan8271 天前
高速数据采集卡设计方案:886-基于RFSOC的8路5G ADC和8路9G的DAC PCIe卡
fpga开发·高速数据采集卡·光纤pcie卡·通用pcie卡·xc7a100t板卡
坏孩子的诺亚方舟1 天前
FPGA系统架构设计实践7_时序收敛作业概述
fpga·xilinx·时序收敛·作业流程
嵌入式软硬件攻城狮1 天前
2.FPGA板卡通过电脑映射连接上网
fpga开发·电脑
brave and determined1 天前
可编程逻辑器件学习(day22):“让ARM穿上FPGA的马甲“:赛灵思Zynq的命名哲学与技术革命
arm开发·嵌入式硬件·fpga开发·zynq·fpga设计·嵌入式设计·fpga开发流程
FPGA_小田老师2 天前
FPGA语法基础(二):SystemVerilog 数组清零方法详解
fpga开发·systemverilog·数组清零·systemverilog数组·systemverilog语法
jiushun_suanli2 天前
FPGA(现场可编程门阵列)详解
经验分享·学习·fpga开发
Terasic友晶科技2 天前
1-串行通信基础知识
fpga开发·串口通信·异步通信·串行通信·同步通信·并行通信·单工