I use the textbook “VHDL: Programming Following the Example” of Douglas L. Perry, fourth edition. He gave an example of a data flow programming model on page 4:
Code I:
ENTITY mux IS PORT ( a, b, c, d : IN BIT; s0, s1 : IN BIT; x, : OUT BIT); END mux; ARCHITECTURE dataflow OF mux IS SIGNAL select : INTEGER; BEGIN select <= 0 WHEN s0 = '0' AND s1 = '0' ELSE 1 WHEN s0 = '1' AND s1 = '0' ELSE 2 WHEN s0 = '0' AND s1 = '1' ELSE 3; x <= a AFTER 0.5 NS WHEN select = 0 ELSE b AFTER 0.5 NS WHEN select = 1 ELSE c AFTER 0.5 NS WHEN select = 2 ELSE d AFTER 0.5 NS; END dataflow;
Now on page 17, Code II
LIBRARY IEEE; USE IEEE.std_logic_1164.ALL; ENTITY mux4 IS PORT ( i0, i1, i2, i3, a, b : IN std_logic; PORT ( i0, i1, i2, i3, a, q : OUT std_logic); END mux4; ARCHITECTURE mux4 OF mux4 IS SIGNAL sel: INTEGER; BEGIN WITH sel SELECT q <= i0 AFTER 10 ns WHEN 0, q <= i1 AFTER 10 ns WHEN 1, q <= i2 AFTER 10 ns WHEN 2, q <= i3 AFTER 10 ns WHEN 3, q <= 'X' AFTER 10 ns WHEN OTHERS; sel <= 0 WHEN a = '0' AND b = '0' ELSE 1 WHEN a = '1' AND b = '0' ELSE 2 WHEN a = '0' AND b = '1' ELSE 3 WHEN a = '1' AND b = '1' ELSE 4; END mux4;
It is assumed that this is a behavioral model , according to one textbook. Besides the differences in the variable name, the only significant difference that I see here is that there is an additional statement
WITH sel SELECT
in the second case, and slight differences in syntax. This code II is parallel. But from other sources on the Internet (see below), I saw that the behavioral model should be consistent. Whom should I believe?
Now, from some other Internet sources, the definition of these models is as follows:
Behavioral - Circuit is described as an i / o relationship using sequential operators within a process.
Dataflow - a schema is described using parallel operators
San Jose State University
Behavioral - describes how output is derived from inputs using structured statements.
Dataflow - describes how data flows.
-Acron University of Engineering College
Here I do not understand what expressed expressions mean.
there is a process keyword in the behavior level
at the data flow level, there is a parallel operator (<=)
This has been seen on the online forum.
Is a process instruction required for a behavior model?
What is the actual difference between codes I and II? According to the author, they have different models, data flow and behavioral. I do not see how this is possible. What should I believe in?
Finally, in Perry DL, pp. 45, 46:
LIBRARY IEEE; USE IEEE.std_logic_1164ALL; ENTITY mux IS PORT (i0, i1, i2, i3, a, b : IN std_logic; PORT (q : OUT std_logic); END mux; ARCHITECTURE better OF mux IS BEGIN PROCESS ( i0, i1, i2, i3, a, b ) VARIABLE muxval : INTEGER; BEGIN muxval := 0; IF (a = '1') THEN muxval := muxval + 1; END IF; IF (b = '1') THEN muxval := muxval + 2; END IF; CASE muxval IS WHEN 0 => q <= I0 AFTER 10 ns; WHEN 1 => q <= I1 AFTER 10 ns; WHEN 2 => q <= I2 AFTER 10 ns; WHEN 3 => q <= I3 AFTER 10 ns; WHEN OTHERS => NULL; END CASE; END PROCESS; END better;
This is a serial version of MUX. According to other definitions, this should be behavioral, but the author does not say this. Could you resolve my confusion regarding these models?