system-verilog - 当仅使用总线名称而不是 [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;” 相同?当系统只使用它的名字时,它是如何考虑总线的?
解决方案
如果您的意图是选择整个范围,则不应使用部分选择。实际上,y
与y[3:0]
有符号算术不同。变量的选择始终是无符号的。如果您将其声明为
logic signed [3:0] y;
...
if (y[3:0] < 0) .. this could never be true
推荐阅读
- db2 - 从 CURRENT_TIMESTAMP (DB2) 中减去 HOURS
- python - 使用 request.GET 在 python 中获取多个 url
- swift - 无法使用 xcode 为我的 iphone 应用程序打开 PDF
- ssrs-2014 - 错误:数据集的查询执行失败。我的查询对我的数据集 SSRS 是否正确?
- java - Java 不兼容类型:int 无法转换为 int[]
- javascript - IndexedDB 事务中的循环
- machine-learning - YOLO(暗网):如何检测整个目录的图像?
- json - jq非规范化嵌套字段
- flutter - 在 Flutter 中通用将颜色设置为 App 中的 Text Widget,而无需每次都提及 Widget 内部的主题
- python - 如何点击img元素?