Y
Yang Luo
Guest
here is an example, 4'd1,how to use parameter to express?
parameter ADDR_W = 4;
parameter DATA_W = 3;
input [ADDR_W-1:0] i_addr ;
reg [DATA_W-1:0] r_width;
always @(posedge i_clk or negedge i_rst_n)
begin
if (!i_rst_n) begin
r_width <= {DATA_W{1'd0}};
end
else if(i_re) begin
case(i_addr)
4'd0: r_width <= 3'd2;
4'd1: r_width <= 3'd3;
....
default: r_width <= {DATA_W{1'd0}};
endcase
end
end
parameter ADDR_W = 4;
parameter DATA_W = 3;
input [ADDR_W-1:0] i_addr ;
reg [DATA_W-1:0] r_width;
always @(posedge i_clk or negedge i_rst_n)
begin
if (!i_rst_n) begin
r_width <= {DATA_W{1'd0}};
end
else if(i_re) begin
case(i_addr)
4'd0: r_width <= 3'd2;
4'd1: r_width <= 3'd3;
....
default: r_width <= {DATA_W{1'd0}};
endcase
end
end