SeqVHDL
SeqVHDL
Example:
process (c,d) is
begin
a <= 2;
b <= a+c;
a <= d+1;
e <= a*2;
end process;
a 1 2+1
b 1 1+1
c 1 1
d 2 2
e 1 1*2
Example:
process (c,d) is
begin
variable Av, Bv, Ev : integer := 0;
Av := 2;
Bv := Av+C;
Av := Dv+1;
Ev := Av*2;
a <= Av;
b <= Bv;
e <= Ev;
end process;
1
Sequential Circuits in VHDL SeqVHDL
a b c d e Av Bv Ev
process suspended 1 1 1 1 1 0 0 0
process resumes 1 1 1 2 1 0 0 0
Av := 2 1 1 1 2 1 2 0 0
Bv := Av + c 1 1 1 2 1 2 3 0
Av := d + 1 1 1 1 2 1 3 3 0
Ev := Av*2 1 1 1 2 1 3 3 6
a <= Av 1 1 1 2 1 3 3 6
b <= Bv 1 1 1 2 1 3 3 6
e<= Ev 1 1 1 2 1 3 3 6
process suspends 3 3 1 2 6 3 3 6
Concurrency of Processes.
Concurrent signal Assignments are simple processes that do not require the use of the
process syntax.
Example:
process ( A, B) is
begin is the same as C < = A and B;
C < = A and B;
end process;
The assignment C < = A and B; executes each time either A or B or both change.
Two assignments represent two independent processes.
C <= A and B;
A < = B or C;
If the B variable changes C and A will be recalculated. If any of the two values has been
changed as a result, another re-calculation takes place. The recalculations are repeated
indefinitely, unless a steady state, in which no new values are produced, is reached.
However, were the two assignments been included in a process structure then they would be
executed sequentially according the rules governing the signal assignment in processes.
2
Sequential Circuits in VHDL SeqVHDL
Example:
Conditional Assignments are short ways of expressing simple processes using the conditional
statement if ..then. For example, a 2-1 multiplexer can be described in two equivalent ways:
Both these statements can be used inside the process (but not outside).
The CASE statement should be used when running through a set of mutually exclusive
conditions. All conditions have to be accounted for or one has to use the qualifier OTHERS to
cover the possibilities not considered explicitly.
Example:
signal switch : std_logic_vector (3 downto 0);
case switch is
when “0000” =>
statement1;
statement2;
when “0010” =>
statement 3;
when OTHERS
statement4;
end case;
3
Sequential Circuits in VHDL SeqVHDL
if a = ‘1’ then
statement1;
statement2;
elseif b = ‘1’ then
statement3;
else
statement4;
end if;
For a = ‘1’ , b = ‘1’ only the statements 1 and 2 will execute. However, for a = ‘0’ , b = ‘1’ the
statement3 will execute. The statement4 will execute only when a = ‘0’ and b=’0’.