verilog 中的非阻塞语句执行
Non blocking Statements execution in verilog
我是 verilog 的新手,谁能解释一下这些语句是如何执行的。
always@(posedge clock) begin
A <= B ^ C;
D <= E & F;
G <= H | J;
K <= G ? ~&{A,D} : ^{A,D}
end
据我所知,首先执行的是右侧。因此,首先计算 A、D、G、K 的值。在计算 K 的值时,将根据 G 的值执行第一个或第二个表达式。谁能解释一下这个操作。还请说明最后一条语句是如何合成的,因为整个代码都在一个 always 块中并且具有正边沿时钟。提前致谢。
A nonblocking assignment evaluates the RHS expression at the
beginning of a time step and schedules the LHS update to take place at the end of the time step.
在 Verilog 中,定义明确的事件队列如下所示。对于每个 每个时间戳,所有区域都被评估 。如果在当前时间戳中有任何事件要执行,那么它们将被触发。一旦当前时间戳的所有事件都被触发,那么只有模拟时间向前移动。
这里,所有表达式的 RHS 在时钟姿态的时间戳 的开头进行计算。因此,B^C
、E&F
、H|J
、G ? ~&{A,D} : ^{A,D}
的值在模拟器内部进行评估和存储。
此后,LHS 会随着模拟进展到相同时间戳的 NBA 区域 而更新。
G的值,
Aand
Dare not updated in active region. Hence, while calculating the value of
K, the previous values of
G,
Aand
Dare taken in the Active region. Then, all the veriables;
G,
A,
Dand
K`同时更新。
我在 EDAPlayground 上做了一个示例代码。波形可能会有帮助。
就最后一条语句而言,我猜它会创建一个带有 mux 的翻牌(使用 Select=G
和输入 nand(A,D)
, xor(A,D)
)作为输入。
我是 verilog 的新手,谁能解释一下这些语句是如何执行的。
always@(posedge clock) begin
A <= B ^ C;
D <= E & F;
G <= H | J;
K <= G ? ~&{A,D} : ^{A,D}
end
据我所知,首先执行的是右侧。因此,首先计算 A、D、G、K 的值。在计算 K 的值时,将根据 G 的值执行第一个或第二个表达式。谁能解释一下这个操作。还请说明最后一条语句是如何合成的,因为整个代码都在一个 always 块中并且具有正边沿时钟。提前致谢。
A nonblocking assignment evaluates the RHS expression at the beginning of a time step and schedules the LHS update to take place at the end of the time step.
在 Verilog 中,定义明确的事件队列如下所示。对于每个 每个时间戳,所有区域都被评估 。如果在当前时间戳中有任何事件要执行,那么它们将被触发。一旦当前时间戳的所有事件都被触发,那么只有模拟时间向前移动。
这里,所有表达式的 RHS 在时钟姿态的时间戳 的开头进行计算。因此,B^C
、E&F
、H|J
、G ? ~&{A,D} : ^{A,D}
的值在模拟器内部进行评估和存储。
此后,LHS 会随着模拟进展到相同时间戳的 NBA 区域 而更新。
G的值,
Aand
Dare not updated in active region. Hence, while calculating the value of
K, the previous values of
G,
Aand
Dare taken in the Active region. Then, all the veriables;
G,
A,
Dand
K`同时更新。
我在 EDAPlayground 上做了一个示例代码。波形可能会有帮助。
就最后一条语句而言,我猜它会创建一个带有 mux 的翻牌(使用 Select=G
和输入 nand(A,D)
, xor(A,D)
)作为输入。