Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top