Verilog,我可以为始终块内的多个位分配一个位值(Verilog, can i assign a bit value to multiple bits inside always block)
以下是代码:
always @ (C[n-1])
begin
C[2*n-1:n]=C[n-1];
end
那可能吗? 如果没有,我该怎么办? 基本上它正在执行符号扩展。
Below is the code:
always @ (C[n-1])
begin
C[2*n-1:n]=C[n-1];
end
Is that possible? If not, how can I do it? Basically it's performing a sign extension.
原文:https://stackoverflow.com/questions/9286671
更新时间:2020-02-24 18:43
最满意答案
在Verilog中复制位的语法是{COUNT{bits}} 。 在你的情况下像{n{C[n-1]}}
The syntax for replicating a bit in Verilog is {COUNT{bits}}. In your case something like {n{C[n-1]}}
2012-02-15
相关问答
always @*等待,直到推断的灵敏度列表中的信号发生变化。 i和j是常数(从always @*评估的模拟时间的角度来看),因此你的always块在灵敏度列表中没有信号。 如果使用SystemVerilog,