首页 > 解决方案 > 当仅使用总线名称而不是 [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

我的问题是,当我们想对指定的位执行功能时,我们会写一些类似“assign y[1:0] = d0[1:0];”的东西。但是,如果我们不指定位,vivado 会考虑什么?换句话说,写“y or y[3:0]”是一样的吗?正在写“assign y[3:0] = d0[3:0];” 和“分配 y = d0;” 相同?当系统只使用它的名字时,它是如何考虑总线的?

标签: system-verilogfpgavivadovivado-hls

解决方案


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

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

推荐阅读