问个verilog的使用参数的语法
时间:10-02
整理:3721RD
点击:
parameter cin_w=14;
always@(posedge clk2 or negedge rst_n)
if(!rst_n) begin
product1_19<=(cin_w+13)'d0;
product3_17<=(cin_w+13)'d0;
product5_15<=(cin_w+13)'d0;
product7_13<=(cin_w+13)'d0;
product9_11<=(cin_w+13)'d0;
product10<=(cin_w+13)'d0;
end
always@(posedge clk2 or negedge rst_n)
if(!rst_n) begin
product1_19<=(cin_w+13)'d0;
product3_17<=(cin_w+13)'d0;
product5_15<=(cin_w+13)'d0;
product7_13<=(cin_w+13)'d0;
product9_11<=(cin_w+13)'d0;
product10<=(cin_w+13)'d0;
end
为什么不直接赋值0? 27‘b0表达式不正确吧!正确表达是27b'0000_0000_0000_0000_0000_0000_000;
如果用parameter表示width的,你可以采用{ {cin_w+13}1'b0} ,这种最稳妥
是的,谢谢了
27‘b0,这个是对的吧,我都是这么用,没半点问题。
这种参数当interger处理就行,随便加减
