首页 » 技术SOS » 模拟IC » Verilog parameter Question

Verilog parameter Question

工程师
2011-04-29 15:13:04
如下 .v source code module CMPx_1to4p (a,v1,v2,v3,v4,o); parameter width = 12; input [width-1:0] a,v1,v2,v3,v4 ; wire o1,o2,o3,o4; output o ; assign o1 = ( a[width-1:0] == v1[width-1:0] ) ? 1'b1 : 1'b0 ; assign o2 = ( a[width-1:0] == v2[width-1:0] ) ? 1'b1 : 1'b0 ; assign o3 = ( a[width-1:0] == v3[width-1:0] ) ? 1'b1 : 1'b0 ; assign o4 = ( a[width-1:0] == v4[width-1:0] ) ? 1'b1 : 1'b0 ; assign o = o1 | o2 | o3 | o4 ; endmodule 當我在另一個 Top.v 內要 使用 CMPx_1to4p.v file 如下: TOP ( A,B,C,D ) input A,B; output C,D; CMPx_1to4p U1 ( .a (), .v1 (), .v2 (), .v3 (), .v4 (), .o () ); endmodule 上述 TOP.v 內的 CMPx_1to4p 該如何定義讓 parameter width = 12; 變為 width = 8 ??? 或者是若再使用 CMPx_1to4p submodule 時 parameter width = 12; 變為 width = 4 ??? 即,我不想變動 CMPx_1to4p.v File 內的內容 就可以改變 width 值!
分享
关键词: Verilog, parameter  
高工
2022-11-19 09:00:21
1楼

整理一下再发出来吧

专家
2022-11-19 09:04:08
2楼

排版一下再发出来能更清晰的看到问题

专家
2022-12-04 10:49:27
3楼

整理一下

高工
2022-12-04 10:55:31
4楼

高工
2023-03-18 23:02:30
5楼

看不清啊