1
\$\begingroup\$

I have, for example, this code snippet:

p1 : process (clk)
begin

if (a = '1') then
    a <= 0;
end if;

if (b = '1') then
    b <= 0;
end if;

end process p1;

Which if-sentece is executed first? a or b? I know that process is a concurrent statement but I don't know if within a process the execution is secuential or concurrent.

Thanks!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ IEEE Std 1076-2008 11.3 Process statement "process_statement_part ::= { sequential_statement }", 10. Sequential statements, 10.1 "The various forms of sequential statements are described in this clause. Sequential statements are used to define algorithms for the execution of a subprogram or process; they execute in the order in which they appear." \$\endgroup\$
    – user8352
    Commented Oct 3, 2016 at 13:25
  • \$\begingroup\$ A is executed first, then B, then both the outputs will update exactly simultaneously. \$\endgroup\$
    – user16324
    Commented Oct 3, 2016 at 13:44

2 Answers 2

1
\$\begingroup\$

This code does not describe a state machine, so the concepts of sequential statements or program execution don't apply here. The correct answer to your question is "無."

The sequential execution of a process will create a state machine only if there are wait statements, which are not allowed in processes with sensitivity lists. The order of statements is relevant for resolving signal assignments (last assignment to a signal wins), and for conditions based on variables (where assignments are visible to the following statements in the same process).

The two conditional statements only depend on signal values, only modify signal values and have no interdependencies, so their effects are concurrent even though they are technically part of a sequence. If you synthesize this design, you end up with completely independent circuits.

In a bigger scope, the entire process is optimized out, as there is only a single place driving a and b, and the only value ever assigned is 0.

RTL of p1

You cannot have other concurrent statements or processes drive a and b either, as that would cause a conflict.

\$\endgroup\$
0
\$\begingroup\$

Sequentially. All statements in VHDL proecess are executed one after, like if a process is a conventional SW program.

I like to tell about VHDL program as a network of processes, which execute in parallel to each other. It is exactly like modern SW program consists of threads at the top level. Yes, threads are also concurrent but statements within them are not. The difference why VHDL is simpler because all communications are hardwired (you cannot dynamically decide which process to send info or receive from) and computation is synchronized every clock (so that you know what the other processes are doing, unlike asynchronous SW processes). To be fair, synchronization is not mandatory. You can write asynchronous processes (synchronizing on signal different from the common clock), but normally you have synchronous processes in one clock domain because it makes life so much easier.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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