1
\$\begingroup\$

I have sample 2bit multiplexer implemented with processes with one little different, first one has sensitivity list and second one implemented with wait.
I want to know what is difference between this two code and which one of them is more accurate?

 ARCHITECTURE Behavior OF mux2to1 IS
BEGIN
PROCESS ( a, b, s )
BEGIN
if s = '0' then
w<=a after 1.4 ns;
else
w<=b after 1.5 ns;
end if ;
END PROCESS ;
END Behavior ;

and the second code:

  ARCHITECTURE Behavior OF mux2to1 IS
    BEGIN
    PROCESS
    BEGIN
    wait on  a, b, s;
     if s = '0' then
    w<=a after 1.4 ns;
    else
    w<=b after 1.5 ns;
    end if ;
    END PROCESS ;
    END Behavior ;
\$\endgroup\$
5
\$\begingroup\$

The two processes as you have written them are almost equivalent. If you move the wait statement to the end of the second process, then they are exactly equivalent. The difference is whether or not the body of the process gets executed before the first change on any of the listed signals.


IEEE Std 1076-2008 11.3 para 4 (in part):

If a process sensitivity list appears following the reserved word process, then the process statement is assumed to contain an implicit wait statement as the last statement of the process statement part; this implicit wait statement is of the form wait on sensitivity_list ; where the sensitivity list is determined in one of two ways. If the process sensitivity list is specified as a sensitivity list, then the sensitivity list of the wait statement is that following the reserved word process. ...

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ so is it wrong if the wait statement be in first of process? \$\endgroup\$ – Daniel.V Apr 15 '17 at 18:46
  • \$\begingroup\$ No, not wrong, just different. It depends on what you want to happen. \$\endgroup\$ – Dave Tweed Apr 15 '17 at 18:50
  • \$\begingroup\$ I mean in all test-cases it's work fine or not ? \$\endgroup\$ – Daniel.V Apr 15 '17 at 18:53
  • \$\begingroup\$ Without seeing the test cases, it's impossible to say. In general, unit tests are written to be insensitive to the very first results, so it probably won't matter. \$\endgroup\$ – Dave Tweed Apr 15 '17 at 20:18
  • \$\begingroup\$ Dave Tweed is correct, IEEE Std 1076-2008 11.3 para 4 (in part): If a process sensitivity list appears following the reserved word process, then the process statement is assumed to contain an implicit wait statement as the last statement of the process statement part; this implicit wait statement is of the form wait on sensitivity_list ; where the sensitivity list is determined in one of two ways. If the process sensitivity list is specified as a sensitivity list, then the sensitivity list of the wait statement is that following the reserved word process. ... \$\endgroup\$ – user8352 Apr 15 '17 at 23:12
0
\$\begingroup\$

edit:

It seems Dave Tweed is right and I was wrong. Just try this simple example.

entity test_e is
end entity;

architecture test_a of test_e is
    signal test_s : bit;
begin
    process (test_s)
    begin
        report "process triggered";
    end process;
end architecture;

And simulate 1 time step. Even though test_s has no event, the report will still be shown.

|improve this answer|||||
\$\endgroup\$

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.