ISE WebPack 11.1 syntax problem

Status
Not open for further replies.

cyboman

Member level 4
Joined
Mar 9, 2010
Messages
71
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
USA
Activity points
1,808
i have a very simple code, which i'm using as a testbench but when i check its syntax (ISE WebPack 11.1 has an option to check for it) i get an error:
ERROR:HDLCompiler:44 - Line 57: i is not a constant

Code:
	integer i;
	initial begin
		clk = 0;
		reset = 1;
		#20;
		reset = 0;
		
		// enter correct code;
		for (i = 9; i >= 0; i = i - 2) begin
			btn = correct_code[i:i-1]; // <-- this is line 57
			
		end
   end

does anybody know how i can fix this?

any help is appreciated

ps. i'm very new to digital design
 

I am not sure but try this one

wire [4:0] j;
assign j =i;

btn = correct_code[j:j-1]; // <-- this is line 57

HTH
 

shitansh said:
I am not sure but try this one

wire [4:0] j;
assign j =i;

btn = correct_code[j:j-1]; // <-- this is line 57

HTH

that didn't work. are there any other suggestions?
 

Hi,

for (i = 9; i >= 0; i = i - 2) begin
// btn = correct_code[i:i-1]; // <-- this is line 57

btn[1] = correct_code;
btn[0] = correct_code[i-1];

end


Devas
 

devas said:
Hi,

for (i = 9; i >= 0; i = i - 2) begin
// btn = correct_code[i:i-1]; // <-- this is line 57

btn[1] = correct_code;
btn[0] = correct_code[i-1];

end


Devas


devas,

can you explain why
btn = correct_code[i:i-1] doesn't work?

i did try your code and it worked.

thanks
 

Hi,

You assign a range and not an individual bit. Assigning a range requires constant expressions, e.g [1:0] and not 'variables' like [j:j-1]. This is a verilog rule.

Devas
 

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