while loop

J

jiten

hi,
can anyone tell me while loop is synthesizable with synplify tool or
not?
plz help me out.
hoping a positive reply from all.
thanx.
jiten
 
M

Mike Treseler

jiten said:
can anyone tell me while loop is synthesizable with synplify tool or
not?

Since a synthesis process loops all by
itself, every clock tick, I can't
imagine how you would use a while loop.
Let's see the code.

Sequential statements execute in zero time.
They form a testable logical description,
not a real-time program thread.

If you want a time delay, use a counter variable.

-- Mike Treseler
 
J

jiten

hi all,
i've checked while loop without clock & with clock.
but its not getting synthesized with synplify-pro.
however,if i sunthesize with xilinx project manager it
synthesized
completely with all conditions.
Is there any problem with while loop in synplify pro.
plz help me out.
jiten
 
N

Neo

I would be very cautious with ISE results since synplify does a very
good job. check out whether it has actually synthesized or just ignored
it.
 
J

jiten

its giving error that "while loop is not terminating", but i tried all
conditions such that it can be terminated easily. even i tried exit
condition also inside the while loop.
what is the problem...............................?
plz help.
thanx
 
N

Neo

Hey , in general a while loop is not synthesizable. do the same thing
with an if condition.
 
J

jiten

ya, it is working properly with "for" loop.
can any one suggest me how can i do it with while loop.
 
J

jiten

hi all,
in sinplfy pro , i m actually getting this error
"while loop is not terminating? you can set the maximum number of
loop
iterations with the syn_looplimit attribute."
what does it means?
 
J

jiten

hi the code is like this

process(cnt,tmp,rst)
begin
if rst='1' then
cnt <= "0000";
tmp <= "000";
i <= 0;
else
w : while i< 8 loop
tmp <= tmp+1;
cnt <= cnt+1;
i <= i + 1;
end loop w;
end if;
end process;
 
E

Egbert Molenkamp

But the while loop is not terminating!
Notice that 'i' is a signal. That means that it is updated after a delta
delay.

Assume the initial value of 'i' is 0.
Then in the while the line i <= i+ 1; is executed
But it remains 0 (it will update after a delta delay).
so in the next loop iteration i is still 0.
I think during simulation you did not see any progress.

Egbert Molenkamp
 
A

Andy Peters

jiten said:
hi the code is like this

process(cnt,tmp,rst)
begin
if rst='1' then
cnt <= "0000";
tmp <= "000";
i <= 0;
else
w : while i< 8 loop
tmp <= tmp+1;
cnt <= cnt+1;
i <= i + 1;
end loop w;
end if;
end process;

Yeeesh! Where are people learning how to write such crappy code? Let
me guess: you're a software guy?

Anyways, you don't want a while loop, or a for loop, or in fact any
loop at all. You need to THINK HARDWARE. What sort of hardware do you
think your synthesize will do with your code? First of all, you
probably want to use a clock to synchronize everything; as it is now,
you have a big combinatorial mess.

Maybe something like:

mycnt : process (clk, rst) is
begin
if (rst = '1') then
cnt <= "0000";
tmp <= "000";
i <= 0;
elsif rising_edge(clk) then
if i < 8 then
cnt <= cnt + 1;
tmp <= tmp + 1;
i <= i + 1;
end if;
end if;
end process mycnt;

It's left as an exercise for the reader to choose the proper type for
cnt, tmp and i, as well as to figure out how to clear the counter once
i is 8.

-a
 
J

jiten

hi,
my problem is not with the code that how to make it executable.
i've got result without 'while' loop.
actually, i have to make a design with while loop only & to check it
with synplify tool that it will synthesize it or not.
i've check all conditions within while loop, such as i took
variables, signals, std_logic_vector, integer, exit, with & without
clock & rst condition etc., but the tool is giving following error
continuously

"while loop is not terminating?you can set the maximum number of loop
iterations with the syn_loop limit attribute -- attach it to the loop
label:file path.."

this compiler error is coming with every condition.
what to do?
thanx.
 
M

Mike Treseler

jiten said:
hi,
my problem is not with the code that how to make it executable.
i've got result without 'while' loop.

You have just answered your own question.

-- Mike Treseler




"Don't confuse me with facts,
my mind is already made up."
-------------------------------------------
 
A

Andy Peters

jiten said:
hi,
my problem is not with the code that how to make it executable.
i've got result without 'while' loop.

As Mike says, you've already got your answer.
actually, i have to make a design with while loop only & to check it
with synplify tool that it will synthesize it or not.

Why do you have to do this? Homework assignment?
i've check all conditions within while loop, such as i took
variables, signals, std_logic_vector, integer, exit, with & without
clock & rst condition etc., but the tool is giving following error
continuously

"while loop is not terminating?you can set the maximum number of loop
iterations with the syn_loop limit attribute -- attach it to the loop
label:file path.."

this compiler error is coming with every condition.
what to do?

you've already been told what to do. Accept reality and move forward.

-a
 
J

jiten

hi,
i am ready to accept the truth.
but please tell me the truth.
i just want to know
IS WHILE LOOP IS SYNTHESIZABLE WITH SYNPLIFY-PRO TOOL OR NOT?

if anybody has worked with this synplify-pro tool.
plz share his/her experience & tell me while loop is synthesizable
or not?

thanx all.
 
J

jiten

hi all,
I've got solution.
Just use an wait on statement in the while loop.
thanx n regards.
 
A

Andy Peters

jiten said:
hi all,
I've got solution.
Just use an wait on statement in the while loop.
thanx n regards.

I'm interested in seeing what sort of ugly hardware results from your
stubborn insistence on using while loops in synthesizable code.

In Other Words: just because it CAN be done, doesn't mean it SHOULD be
done.

-a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top