priyanka24
Advanced Member level 4
Hi..
am trying to implement unary code in verilog.i got the simulation results correctly.but when me doing synthesis as i want to see RTL view of my design i got error as follows:
"ERROR:Xst:2634 - "unary.v" line 29: For loop stop condition should depend on loop variable or be static."
my code is as follows.help me if can as to go further i need synthesizable code.
module unary(q,unary_out,unary_len);
integer j;
output reg [2:0]unary_len;
reg [2:0]seq;
input [1:0] q;
output reg [2:0] unary_out;
always @(q)
begin
for(j=1;j<=q;j=j+1)
begin
unary_out[j]=0;
end
unary_out[0]=1;
unary_len=j;
end
endmodule
am trying to implement unary code in verilog.i got the simulation results correctly.but when me doing synthesis as i want to see RTL view of my design i got error as follows:
"ERROR:Xst:2634 - "unary.v" line 29: For loop stop condition should depend on loop variable or be static."
my code is as follows.help me if can as to go further i need synthesizable code.
module unary(q,unary_out,unary_len);
integer j;
output reg [2:0]unary_len;
reg [2:0]seq;
input [1:0] q;
output reg [2:0] unary_out;
always @(q)
begin
for(j=1;j<=q;j=j+1)
begin
unary_out[j]=0;
end
unary_out[0]=1;
unary_len=j;
end
endmodule