我已将此代码运行到 lint 检查器(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
我收到此警告消息:
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'
有什么建议可以解决这些警告吗?