Range must be bounded by constant expressions in verilog

Status
Not open for further replies.

BIPINLIKHAR

Newbie level 2
Joined
Jan 25, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,298
my code for 2's complement copy the input after first 1 is encountered.so i need a variable range which gives an error.my input is a, b=~a exor it with '1' gives out1.so copy after firstt1 in out1.It requires a variable range.pls help and guide.
input [8:0] a;
output [8:0] out;
reg [8:0] out;
output [8:0] out1;
reg [8:0] out1;
reg [8:0] b;
reg [8:0] c;
integer i;
integer x;
always @ (a)
begin
b=~a;
out[0]=b[0]^1;
for(i=1;i<9;i=i+1)
begin
if (out==1'b1)
begin
x=i;
out1[x:0]=out[x:0];
i=9;
end
end

out1[8:x]=b[8:x];
 

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