10 VHDL Concurrent Statements
10 VHDL Concurrent Statements
The “<=“ operator is not the only means by which we can perform combinational
assignments in VHDL.
There are other concurrent signal assignment operators that make writing VHDL a bit
easier.
We have the concurrent signal assignment statement “<=“ for representing logic
equations in VHDL.
Example (this is a 4-to-1 multiplexer):
library ieee;
use ieee.std_logic_1164.all;
entity mux4to1_version1 is
port (x1, x2, x3, x4 : in std_logic; -- inputs
s : in std_logic_vector(1 downto 0); -- controls
f : out std_logic); -- output
end entity;
It offers a higher level of abstraction that the concurrent signal assignment (which is
at the gate level; e.g., AND, OR and NOT gates).
Notice that we always have a default assignment in case none of the conditions are
true.
library ieee;
use ieee.std_logic_1164.all;
entity mux4to1_version2 is
port (x1, x2, x3, x4 : in std_logic; -- inputs
s : in std_logic_vector(1 downto 0); -- controls
f : out std_logic); -- output
end entity;
Several conditions may be true, but the first true condition encountered will
determine the resulting signal assignment.
entity priority8 is
port (x : in std_logic_vector(7 downto 0); -- input lines
valid : out std_logic; -- output valid?
y : out std_logic_vector(2 downto 0)); -- encoded output.
end priority8;
We can write VHDL for a 4-to-1 multiplexer using selected signal assignment which is
more abstract, representing the operation of a multiplexer:
entity mux4to1_version3 is
port (x1, x2, x3, x4 : in std_logic;
s : in std_logic_vector(1 downto 0);
f : out std_logic);
end entity;
The selected signal assignment is different that the conditional signal assignment in
that (1) there is no priority and (2) all choices are evaluated at once (and therefore
only one choice can be true at any time).
All possible choices need to be specified, but we can capture values that we are not
interested in using the others keyword.
The “others” keyword conveniently captures all the other possible values of the
select signal.
Note: we should always include the “when others;” in the selected signal
assignment.
In the explanation of our new conditional and selected signal assignment statements,
we saw the assignment of constants to signals and to vectors of signals.
To assign a vector of signals all at once, we assign each bit, but enclose the bits inside
of double quotation marks:
In all the examples so far, we have only seen how to declare signals in the port section
of the entity declaration.
Sometimes, we will have signals internal to our implementation. These signals get
declared in the declarative section of the architecture:
(We will see more on this later)…
begin prototype
-- implementation section
end prototype;