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.

Is while loop in vhdl synthesizable

Status
Not open for further replies.

emmagood

Member level 4
Joined
Feb 13, 2010
Messages
72
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Activity points
1,825
Hello,

is while loop in VHDL synthesizable. I was trying to implement a code and got the following error:

ERROR:Xst:1312 - Loop has iterated 64 times. Use "set -loop_iteration_limit XX" to iterate more.

It is a basic code:


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
**************************
process(binary)
variable i : integer := 0;
begin
gray(3) <= binary(3);
while i < 3 loop
gray(i) <= binary(i) xor binary(i-1);
i := i+1;
end loop;
end process;
*************************



I also tried by using the xilinx solution to increase the no. of iterations (but was unable to do so) for 8.1 i. As this is just a basic code, I am guessing that no. of iterations may not matter.

Pls advise.

Thanks,
Emma Good
 
Last edited by a moderator:

kommu4946

Member level 4
Joined
Feb 21, 2014
Messages
71
Helped
13
Reputation
26
Reaction score
11
Trophy points
1,288
Location
India
Activity points
1,846
Initialize variable i inside begin statement.Then it wont give Non-static loop limit exceeded error and also the fallowing statement gives a index out of range error when i is 0.
gray(i) <= binary(i) xor binary(i-1);
 
  • Like
Reactions: std_match

    V

    Points: 2
    Helpful Answer Positive Rating

    std_match

    Points: 2
    Helpful Answer Positive Rating

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
49,386
Helped
14,435
Reputation
29,134
Reaction score
13,225
Trophy points
1,393
Location
Bochum, Germany
Activity points
284,242
Some VHDL tools accept a while loop with constant iteration range, others don't. Either ISE expects an explicite i:=0 before the loop or it doesn't support while loops at all. But instead of guessing about it, why don't you use a for loop, which is supported by any synthesis tool?
 

Miralipoor

Member level 2
Joined
Jul 2, 2014
Messages
45
Helped
5
Reputation
10
Reaction score
5
Trophy points
8
Activity points
251
Hi,
That code seems to be combinational logic.to be sure if it is synthesizable just open your while loop and see is any physical constraint violated or not(i.e. multiple source,bad index, etc).
Regards
 

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,215
Helped
451
Reputation
902
Reaction score
413
Trophy points
1,363
Location
Sweden
Activity points
9,420
As kommu4946 pointed out, the variable initialialization is in the wrong place. The process will execute every time "binary" changes, and "i" will only start a 0 in the first execution.
"i" will increment forever, the Gray coding will only be done in the first call, and the code is not synthesizeable.

I agree with other posters that it is much better to use a "for" loop.

I think it is time for you to start using a simulator and a test bench. To do design by synthesizing and then debug in the lab is a great way to waste a lot of time.
A complex project will never be completed without a simulator.
 

emmagood

Member level 4
Joined
Feb 13, 2010
Messages
72
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Activity points
1,825
OK point accepted. Which free simulator do you advise. I have the free version of Xilinx ISE (latest). Also be kind enough to point me to any book/ site which has a collection of projects to start of with (in case I am unable to make the project, I will have a ready solution in hand). I was using 'while' loop just to see its usage.

Other than that, I apologize for the late response.



Emma.
 
Last edited:

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,860
Helped
1,817
Reputation
3,644
Reaction score
1,782
Trophy points
1,393
Location
USA
Activity points
59,412
ISE 14.7 has a simulator included called ISIM, you could try starting with that.
 

emmagood

Member level 4
Joined
Feb 13, 2010
Messages
72
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Activity points
1,825
I am looking for VHDL based resources pls. Also any compilation of projects will be highly appreciated.
Thanks.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top