VHDL for the ABEL-HDL Designer
C-8 VHDL Reference Manual
Perhaps the most common mistake that is made by new VHDL users
(who have had experience with PLD-oriented languages) is the
assumption that unspecified conditions will have no effect on the logic
of the generated circuit. Perhaps the most common example of this is
in the use if conditional assignments within process statements.
Consider, for example, the following VHDL description of the same
multiplexer just presented:
entity mux is
port (s0,s1,a0,a1,b0,b1,c0,c1: in bit; --inputs
y1,y0: out bit); --output Y
end mux;
architecture behavior of mux is
begin
process(s0,s1,a0,a1,b0,b1,c0,c1)
begin
if (s1,s0) = "11" then
(y1,y0) <= (a1,a0);
elsif (s1,s0) = "10" then
(y1,y0) <= (b1,b0);
elsif (s1,s0) = "01" then
(y1,y0) <= (c1,c0);
end process;
end
This design description is also incompletely specified; no value is
specified for the condition in which y1 and y0 are both low. Unlike the
ABEL-HDL version of this circuit, however, the rules of VHDL dictate
that the value of the outputs must be held over time, rather than
transition to a low state. For this design, the circuit that results must
include a latch, and the VHDL synthesizer will construct this latch by
feeding back the outputs to create an asynchronous feedback loop.
To prevent the creation of unwanted latches, you must make sure to
include all of the possible input conditions in your design descriptions.
In the case of conditional assignments such as the multiplexer, you
should include a terminating else statement that defines the default
value:
if (s1,s0) = "11" then
(y1,y0) <= (a1,a0);
elsif (s1,s0) = "10" then
(y1,y0) <= (b1,b0);
elsif (s1,s0) = "01" then
(y1,y0) <= (c1,c0);
else
(y1,y0) <= "00";
Commentaires sur ces manuels