修复位宽不匹配
我已将此代码运行到 lint 检查器(望远镜):
1 module test(
2 output [7:0] O_O,
3 input [7:0] I_1,
4 input [7:0] I_2
5 );
6
7 wire [14:0] result;
8
9 assign result = (I_1 + I_2) << 5;
10 assign O_O = result[7:0];
11 endmodule
我收到此警告消息:
Bit-width mismatch in signal assignment (LHS: 'O_O' width 8 should match RHS: '((I_1 + I_2) << 5)' width 14). [Hierarchy:test]
为了避免此警告,我像这样更改了我的代码:
1 module test(
2 output [7:0] O_O,
3 input [7:0] I_1,
4 input [7:0] I_2
5 );
6 wire [15:0] result;
7
8 assign result = (I_1 + I_2) << 5;
9 assign O_O = result[7:0];
10 endmodule
然后收到此警告消息
Port 'O_O[4:0]' is 'tied-low'
有修复这些警告的建议吗?
I've run this code to the lint checker (spyglass):
1 module test(
2 output [7:0] O_O,
3 input [7:0] I_1,
4 input [7:0] I_2
5 );
6
7 wire [14:0] result;
8
9 assign result = (I_1 + I_2) << 5;
10 assign O_O = result[7:0];
11 endmodule
I get this warning message:
Bit-width mismatch in signal assignment (LHS: 'O_O' width 8 should match RHS: '((I_1 + I_2) << 5)' width 14). [Hierarchy:test]
To avoid this warning, I changed my code like this:
1 module test(
2 output [7:0] O_O,
3 input [7:0] I_1,
4 input [7:0] I_2
5 );
6 wire [15:0] result;
7
8 assign result = (I_1 + I_2) << 5;
9 assign O_O = result[7:0];
10 endmodule
Then got this warning message
Port 'O_O[4:0]' is 'tied-low'
Any recommendations to fix those warnings?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这有效吗?
Does this work?
必须有一种方法告诉您的 lint 检查器您希望这些位始终为零。您必须阅读文档才能了解如何操作 - 也许您可以在源代码中添加特殊注释,或者单独的配置文件来说明“在这行代码上出现此警告”
There must be a way to tell your lint checker that you intend those bits to be always zeros. You'll have to read the docs to find out how though - maybe a special comment you can add int he source, or a separate config file to say "expect this warning on this line of code"
您可以创建一个豁免文件来豁免望远镜中的所有此类警告。
You can create a waiver file to waive all such warnings in spyglass.
在警告窗口中,可以选择将此警告转移到豁免文件,即,
它将显示故意添加的内容并需要忽略,不再反映在警告窗口中。
In warning window there is option for shifting this warning to waiver file, i,e
which will show intentionally added stuff and need to ignored, doesn't reflected in warning window any more.