How to do q <= d[count:0] in Verilog?

Status
Not open for further replies.

woeichee

Newbie level 5
Joined
Jan 17, 2010
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Malaysia
Activity points
1,348
in verilog, how to do like q <= d[count:0]?

reg [3:0] count;

thanks
 

Re: Verilog

reg [3:0] count;;
reg [15:0] q;
wire [15:0] d;

always @ (posedge clk or negedge rst_n)
begin
if (~rst_n)
q <= {16{1'b0}};
else
q<= d[count:0];
end

HTH,
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…