while loop

Discussion in 'VHDL' started by jiten, Jun 29, 2005.

  1. jiten

    jiten Guest

    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
     
    jiten, Jun 29, 2005
    #1
    1. Advertising

  2. jiten wrote:

    > 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
     
    Mike Treseler, Jun 29, 2005
    #2
    1. Advertising

  3. jiten

    jiten Guest

    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
    Mike Treseler wrote:
    > jiten wrote:
    >
    > > 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
     
    jiten, Jun 30, 2005
    #3
  4. jiten

    Neo Guest

    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.
     
    Neo, Jun 30, 2005
    #4
  5. jiten

    jiten Guest

    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
     
    jiten, Jun 30, 2005
    #5
  6. jiten

    Neo Guest

    Hey , in general a while loop is not synthesizable. do the same thing
    with an if condition.
     
    Neo, Jun 30, 2005
    #6
  7. jiten

    jiten Guest

    ya, it is working properly with "for" loop.
    can any one suggest me how can i do it with while loop.
     
    jiten, Jun 30, 2005
    #7
  8. jiten

    jiten Guest

    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?
     
    jiten, Jun 30, 2005
    #8
  9. jiten

    Neo Guest

    It requires that the number of iterations be fixed, so it should be
    deterministic.
     
    Neo, Jun 30, 2005
    #9
  10. jiten

    jiten Guest

    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;
     
    jiten, Jun 30, 2005
    #10
  11. 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

    "jiten" <> wrote in message
    news:...
    > 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;
    >
     
    Egbert Molenkamp, Jun 30, 2005
    #11
  12. jiten

    Andy Peters Guest

    jiten wrote:
    > 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
     
    Andy Peters, Jun 30, 2005
    #12
  13. jiten

    jiten Guest

    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.
     
    jiten, Jul 1, 2005
    #13
  14. jiten wrote:
    > 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."
    -------------------------------------------
     
    Mike Treseler, Jul 1, 2005
    #14
  15. jiten

    Andy Peters Guest

    jiten wrote:
    > 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
     
    Andy Peters, Jul 1, 2005
    #15
  16. jiten

    jiten Guest

    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.
     
    jiten, Jul 2, 2005
    #16
  17. jiten

    jiten Guest

    hi all,
    I've got solution.
    Just use an wait on statement in the while loop.
    thanx n regards.
     
    jiten, Jul 2, 2005
    #17
  18. jiten

    Andy Peters Guest

    jiten wrote:
    > 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
     
    Andy Peters, Jul 5, 2005
    #18
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven

    while loop in a while loop

    Steven, Mar 24, 2005, in forum: Java
    Replies:
    5
    Views:
    2,238
    Tim Slattery
    Mar 30, 2005
  2. Daniel Pitts
    Replies:
    14
    Views:
    1,237
    Patricia Shanahan
    Dec 23, 2006
  3. Uday Bidkar
    Replies:
    4
    Views:
    494
    =?ISO-8859-15?Q?Juli=E1n?= Albo
    Dec 12, 2006
  4. Roedy Green
    Replies:
    3
    Views:
    434
    Mike Schilling
    Sep 13, 2008
  5. Isaac Won
    Replies:
    9
    Views:
    381
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page