1
\$\begingroup\$

All the VHDL-tutorials I've read mentions that one can use a sense process and a wait process, but I have been unable to grasp the difference.

That is:

Waitproc: process
    wait until clock ...
end process

Versus

Sense-proc: process (clock)
    if rising_edge(clock) then
    ...
end process

To me, these to seems do the same thing but obviously there must be a difference.

When should I use which one, and why?

\$\endgroup\$
  • \$\begingroup\$ Waitproc and Sense-proc are just optional labels. \$\endgroup\$ – Peter Karlsen Oct 3 '19 at 11:06
  • \$\begingroup\$ Uh, yes, but the waitproc lacks a sensitivity-list while the other has one, as well as the wait-statement. \$\endgroup\$ – bos Oct 3 '19 at 11:16
  • \$\begingroup\$ It looks like two ways to achieve the same result. \$\endgroup\$ – Peter Karlsen Oct 3 '19 at 11:34
  • 3
    \$\begingroup\$ Wait doesn’t synthesize. So if you want to put your VHDL in hardware, you need to use the latter. \$\endgroup\$ – user110971 Oct 3 '19 at 12:35
  • 1
    \$\begingroup\$ In testbenches and model simulation (trying out an idea or principle before designing the real one). \$\endgroup\$ – TonyM Oct 3 '19 at 15:40
3
\$\begingroup\$

In pure VHDL, there is no difference between a process with a sensistivity list (a,b,..x) and a process without one but with a 'wait on a,b,..x;' as its final line.

So no difference between:

  pFirst : process(a,b) is
  begin
    ...
  end process pFirst;

  pSecond : process is
  begin
    ...
    wait on a,b;
  end process pSecond;

You will almost always see the first form used because it is synthesizable. The wait statement is not.

Note that pSecond has the 'wait on' statement at the end of the process. At the start of simulation, all processes are carried out once, regardless of what they are sensitive to. The position of the 'wait on' statement in pSecond ensures that it does not pause for its sensitive signals until its end.

The second form is useful in testbenches where you want a non-synthesizable process to include time delays as well as sensitivity to signal(s). A process with a sensitivity list will not allow a 'wait for n us;' statement but one without a sensitivity list will.

So you can't do:

  pThird : process(a) is
  begin
    if falling_edge(a) then
      wait for 10 ns;
      cs  <=  not cs;
      wait for 2 ns;
    end if;
  end process pThird;

but you can do:

  pFourth : process is
  begin
    if falling_edge(a) then
      wait for 10 ns;
      cs  <=  not cs;
      wait for 2 ns;
    end if;
    wait on a;
  end process pFourth;

I find the latter very useful for writing bus master or bus slave models and so on.

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ Distinguishing the two types of processes is superimposed where the VHDL standard makes no distinction. Processes suspend and resume in wait statements. A process with a sensitivity list has a single implicit wait on sensitivity_list; as the last statement (IEEE Std 1076-2008 11.3 Process statement). Certain wait statement use can be synthesized (IEEE Std 1076.6-2004 RTL Synthesis (withdrawn) 6.1.3.2 Edge-sensitive storage using a single wait statement, 6.1.3.4 Edge-sensitive storage with multiple waits). These are likely still supported by all synthesis tools. \$\endgroup\$ – user8352 Oct 3 '19 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.