Verilog 始终使用 (*) 符号进行阻止

发布于 2024-11-07 12:45:05 字数 717 浏览 0 评论 0原文

我有一个关于如何在 Verilog 模块中编写 always 块的简单问题。
如果我的 Verilog 模块中有以下输入:

input        [31:0] PCplus4 ;       // Value of PC + 4
input        [31:0] A;          // Value A, i.e. RSbus (Use Forwarded Value)
input        [31:0] B;          // Value B, i.e. RTbus (Use Forwarded Value)
input        [31:0] IMM;            // Extended Immediate Value
input        [25:0] TARGET;         // Target Address for Jumps
input         [3:0] BR;         // Branch Selector Input

如果我使用

always @ (*)  

代替

always @ (PCplus4  or A or B or IMM or TARGET or BR)  

Is this always @ (*) 语法对所有版本的 Verilog 都有效吗?

I have a simple question regarding how to write an always block in a Verilog module.
If I have the following inputs in my Verilog module:

input        [31:0] PCplus4 ;       // Value of PC + 4
input        [31:0] A;          // Value A, i.e. RSbus (Use Forwarded Value)
input        [31:0] B;          // Value B, i.e. RTbus (Use Forwarded Value)
input        [31:0] IMM;            // Extended Immediate Value
input        [25:0] TARGET;         // Target Address for Jumps
input         [3:0] BR;         // Branch Selector Input

Is there any difference if I use

always @ (*)  

instead of

always @ (PCplus4  or A or B or IMM or TARGET or BR)  

Is this always @ (*) syntax valid for all versions of Verilog?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

始于初秋 2024-11-14 12:45:05

always @(*) 语法于 2001 年添加到 IEEE Verilog 标准中。所有现代 Verilog 工具(模拟器、综合等)都支持此语法。

以下是 LRM (1800-2009) 的引述:

不完整的 event_expression 列表
事件控件是一个常见的源
寄存器传输级别 (RTL) 中的错误
模拟。隐含的
event_expression,@*,是一个方便的
消除这些的简写
通过添加所有网络和
读取的变量
声明(可以是一个声明
procedure_timing_ 的组)
控制语句
事件表达式。

因此,您的两行代码可能是等效的(这取决于 always 块主体中的代码)。但是,@* 语法更易于维护。

The always @(*) syntax was added to the IEEE Verilog Std in 2001. All modern Verilog tools (simulators, synthesis, etc.) support this syntax.

Here is a quote from the LRM (1800-2009):

An incomplete event_expression list of
an event control is a common source of
bugs in register transfer level (RTL)
simulations. The implicit
event_expression, @*, is a convenient
shorthand that eliminates these
problems by adding all nets and
variables that are read by the
statement (which can be a statement
group) of a procedural_timing_
control_statement to the
event_expression.

So, your two lines of code may be equivalent (it depends on the code in the body of your always block). However, the @* syntax is easier to maintain.

痴骨ら 2024-11-14 12:45:05

always @(*) 是 2001 年标准修订版中对该语言的补充。所有最新版本的质量工具都支持它。我不担心在旨在任意重用的代码中使用该构造,但是,有可能遇到不支持 always @(*) 的旧工具,特别是当内部实用程序涉及。

always @(*) was an addition to the language in the 2001 revision of the standard. It is supported by all recent releases of quality tools. I have no concerns about using the construct in code intended for arbitrary reuse, however, there is a possibility of encountering an old tool that does not support always @(*), especially when in-house utilities are involved.

风尘浪孓 2024-11-14 12:45:05

尽管两者是等效的,但使用always@(*)可以避免任何模拟综合不匹配。
假设敏感度列表中有 15 个信号,如下所示:

always@( a1 or a2 or ... or a15)

现在假设设计者错误地错过了此列表中的 a14。综合工具忽略这一事实,并假设该块内 RHS 上的所有信号都在灵敏度列表中来综合代码。而模拟工具的行为有所不同,因为它取决于敏感度列表。

Though both are equivalent, using always@(*) avoids having any simulation-synthesis mismatch.
Lets assume you have 15 signals in the sensitivity list as below:

always@( a1 or a2 or ... or a15)

Now assume that the designer has missed having a14 in this list by mistake. The synthesis tool ignores this fact and synthesizes the code assuming all the signals on RHS within this block are in the sensitivity list. Whereas the simulation tool behaves differently since it depends on the sensitivity list.

誰認得朕 2024-11-14 12:45:05

它只是列出always 块所依赖的所有线路的快捷方式。这些电线是“敏感列表”。使用它的一个优点是,合成代码不太可能关心您在敏感度列表中放入的内容(除了 pedge 和 negedge),因为电线将“物理”连接在一起。模拟器可能依赖该列表来选择哪些事件应导致块执行。如果您更改模块并忘记更新列表,您的模拟可能会偏离实际的综合行为。

It's just a shortcut for listing all of the wires that the always block depends on. Those wires are the "sensitivity list". One advantage of using it is that synthesized code is unlikely to care what you put in the sensitivity list (other than posedge and negedge) because the wires will be "physically" connected together. A simulator might rely on the list to choose which events should cause the block to execute. If you change the block and forget to update the list your simulation might diverge from the actual synthesized behavior.

梓梦 2024-11-14 12:45:05

对于第一个问题......我想说这取决于在第二种情况下,这些是您认为可以更改的唯一输入,这将导致输出触发。理想情况下,最好使用 *,因为它表示“对于输入的任何更改”,而且它有助于避免冗长的代码。

对于第二个问题......它是在verilog -2001中引入的,从那时起它就被广泛使用。

For the 1st question....i would say that depends if in second scenario that those are the only inputs you feel can change which will cause a triggering to the output. Ideally it would be better to use * as it indicates "for any change in inputs", Also it is helpful in avoiding verbose code.

For the second question.....it was introduced in verilog -2001 and ever since then it has been used extensively.

三五鸿雁 2024-11-14 12:45:05

*表示包含所有输入,因此相当于写入所有输入。
如果您希望模块是非顺序组合电路,则使用 * 符号也很有用,因为每当任何输入更改时,总会有一些东西发生变化。

* means all the inputs included, so it is equivalent to writing all the inputs.
Using the * symbol is also useful with always if you want your module to be combinational circuit not sequential, since there is something always changing whenever any input is changed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文