Verilog:在Always语句中可以多次引用同一个寄存器吗?

问题描述

我正在编写一个Verilog HDL模块来消除按键的反弹。首先,我将使用两个名为sync_0sync_1的触发器将印刷机与时钟同步,如下所示:

Input -> sync_0 -> sync_1

我的问题是,我可以将这两个操作合并到一个始终这样的始终块中吗?

// Synchronize the switch input to the clock 
reg sync_0,sync_1;
always @(posedge clk)
    begin
        sync_0 <= switch_input;
        sync_1 <= sync_0;
    end

还是需要像这样分解:

// Synchronize the switch input to the clock 
reg sync_0,sync_1;
always @(posedge clk)
    begin
        sync_0 <= switch_input;
    end

always @(posedge clk)
    begin 
        sync_1 <= sync_0;
    end

编辑:更清楚地说,我的问题是:可以将sync_0放在非阻塞分配的左手侧和右手侧放在同一始终阻塞中。还是应该将这两个分配拆分为两个单独的Always块。两者都很好,我只是想知道哪种更好。

解决方法

语法正确。只要这些Origins and Spread https://www.snopes.com/collections/coronavirus-origins-treatments/?collection-id=238235 Prevention and Treatments https://www.snopes.com/collections/coronavirus-collection-prevention-treatments/?collection-id=238235 Prevention and Treatments II https://www.snopes.com/collections/coronavirus-collection-prevention-treatments-2/?collection-id=238235 International Response https://www.snopes.com/collections/coronavirus-international-rumors/?collection-id=238235 US Government Response https://www.snopes.com/collections/coronavirus-government-role/?collection-id=238235 Trump and the Pandemic https://www.snopes.com/collections/coronavirus-collection-trump/?collection-id=238235 Trump and the Pandemic II https://www.snopes.com/collections/coronavirus-collection-trump-2/?collection-id=238235 具有相同的敏感度列表,就可以将它们放在一个reg块中。每个always是一个独立的电路实体,具有自己的驱动锥并并行运行。工具将处理该问题。但是,在现实世界中,建议仅描述与功能相关的信号和/或在同一reg中共享相同控制结构(例如相同或几乎相同的if-else控件)的信号。根据您的情况,您当然可以将它们放在一个always中。我希望这样做,因为在屏幕上阅读时可以看到更多代码。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...