【问题标题】:When the name of bus is only used instead of [a:b], does vivado consider its all bits or just least significant bit [closed]当仅使用总线名称而不是 [a:b] 时,vivado 是否考虑其所有位或仅考虑最低有效位 [关闭]
【发布时间】:2020-11-24 21:06:21
【问题描述】:
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;”相同?仅与名称一起使用时系统如何考虑总线?

【问题讨论】:

  • 与 Verilog 标准相同。如果您避免使用矢量名称的位下标,则使用整个声明的范围。如果您有问题,请提供其描述。

标签: system-verilog fpga vivado vivado-hls


【解决方案1】:

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

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

【讨论】:

  • 非常简洁明了。您可以阅读很多教科书页面,但归结为您那里的两行。
猜你喜欢
  • 1970-01-01
  • 2021-01-24
  • 1970-01-01
  • 1970-01-01
  • 2012-07-03
  • 2017-09-04
  • 1970-01-01
  • 1970-01-01
  • 2017-04-05
相关资源
最近更新 更多