Is wait statements better?? 
Author Message
 Is wait statements better??

Hi,

   I am trying to figure out whether using a wait statements instead
of having a sensitivity list can speed up simulation for the following
piece of code..

   Code-A:
   ------
   process(clk)
   begin
   if (clk = '1' and clk'event) then
   A <= B;
   end if;
   end process;

   Code-B:
   -------
   process
   begin
   wait until (clk = '1' and clk'event);
   A <= B;
   end process;

   Will the simulator enter process in Code-A twice every cycle (clk).
And once every cycle for Code-B (clk).

Regards,
Shubro



Fri, 17 Sep 2004 23:26:02 GMT  
 Is wait statements better??

Quote:
>   I am trying to figure out whether using a wait statements instead
>of having a sensitivity list can speed up simulation for the following
>piece of code..

>   Code-A:
>   ------
>   process(clk)
>   begin
>   if (clk = '1' and clk'event) then
>   A <= B;
>   end if;
>   end process;

>   Code-B:
>   -------
>   process
>   begin
>   wait until (clk = '1' and clk'event);
>   A <= B;
>   end process;

>   Will the simulator enter process in Code-A twice every cycle (clk).
>And once every cycle for Code-B (clk).

Both processes are equivalent, and SAME from a simulation and synthesis
viewpoint.
No advantage to either.  I believe taht Modelsim reinterprets Code-B to Code-A,
for faster simulation.
On code-b, you could also write it as:
   process
   begin
   wait until clk = '1';  
   A <= B;
   end process;
-------------------------------------
Ben Cohen     Publisher, Trainer, Consultant    (310) 721-4830  

Author of following textbooks:
* Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn
0-9705394-2-8
* Component Design by Example ",  2001 isbn  0-9705394-0-1
* VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn 0-7923-8474-1
* VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn 0-7923-8115
------------------------------------------------------------------------------


Sat, 18 Sep 2004 03:38:50 GMT  
 Is wait statements better??

Quote:
> Hi,

>    I am trying to figure out whether using a wait statements instead
> of having a sensitivity list can speed up simulation for the following
> piece of code..

How do you insert a reset into "Code-B"?  I always use the first
example, with the reset in the sensitivity list:

     Code-K:
     -------
     process(clk,Rst)
     begin
       if Rst = 1
         then
           A <=      '0';
         elsif rising_edge(clk)
           A <=   B;
       end if;
     end process;

Perhaps you're right for non-synthesized code though.

----
  Keith

Quote:
>    Code-A:
>    ------
>    process(clk)
>    begin
>    if (clk = '1' and clk'event) then
>    A <= B;
>    end if;
>    end process;

>    Code-B:
>    -------
>    process
>    begin
>    wait until (clk = '1' and clk'event);
>    A <= B;
>    end process;

>    Will the simulator enter process in Code-A twice every cycle (clk).
> And once every cycle for Code-B (clk).

> Regards,
> Shubro



Sat, 18 Sep 2004 05:12:27 GMT  
 Is wait statements better??

Quote:
>How do you insert a reset into "Code-B"?  I always use the first
>example, with the reset in the sensitivity list:

COde-B will give you  a synchronous reset instead.
wait until clk = '1';
il (reset= '1') then
   Q <= '0';
else
  Q <= D;
end if;
---------------------------------------------------------------------------
Ben Cohen     Publisher, Trainer, Consultant    (310) 721-4830  

Author of following textbooks:
* Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn
0-9705394-2-8
* Component Design by Example ",  2001 isbn  0-9705394-0-1
* VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn 0-7923-8474-1
* VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn 0-7923-8115
------------------------------------------------------------------------------


Sat, 18 Sep 2004 08:53:35 GMT  
 Is wait statements better??


Quote:
> >How do you insert a reset into "Code-B"?  I always use the first
> >example, with the reset in the sensitivity list:

> COde-B will give you  a synchronous reset instead.
> wait until clk = '1';
> il (reset= '1') then
>    Q <= '0';
> else
>   Q <= D;
> end if;

Duh! I'll buy that.  ;-)  I generally do async resets, so...

----
  Keith



Sat, 18 Sep 2004 11:53:52 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Synthesis of wait statements

2. wait statement question

3. wait statement

4. wait statement on Xilinx Foundation.

5. wait statements in sub-programs for synthesis

6. Process without wait statement

7. Wait until statement problem in synthesis

8. Final conclusion of wait until statement discussion

9. procedure + wait statement

10. VHDL FLI/Tcl in Modelsim and wait statement

11. Wait statements and while loops

12. Synthesis of wait statements

 

 
Powered by phpBB® Forum Software