当只使用总线的名称而不是[a:b]时,vivado是否考虑其所有位或最低有效位


module sillyfunction(input logic [3:0] d0,d1, input logic s, output logic [3:0] y, z);
assign y = d0; // does this considers 1 bit or all bits of busses?
anothersillyfunction instance(d1,z) // when this function is fed with these inputs, does it consider 1 bit of busses or all bits of busses?
endmodule

我的问题是,当我们想对指定的位执行函数时,我们会写一些类似";赋值y[1:0]=d0[1:0]&";。然而,如果我们不指定比特,vivado会考虑什么?换句话说,写";y或y[3:0]";是一样的吗?正在写";赋值y[3:0]=d0[3:0]"以及";赋值y=d0"还是一样?当一个总线只和它的名字一起使用时,系统是如何看待它的?

如果您的意图是选择整个范围,则不应使用部分选择。事实上,当涉及到有符号算术时,yy[3:0]不同。变量的选择总是无符号的。如果您将其声明为

logic signed [3:0] y;
...
if (y[3:0] < 0) .. this could never be true

最新更新