Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
if condition1 then
sequential statements
elsif condition2 then -- note strange spelling
sequential statements
. . .
else
sequential statements
end if;
If then else example
(We assume here that memreq and read are type BIT, not
BOOLEAN. Note how the condition – a boolean
expression -- must be written. )
Selected Control – (CASE statements)
case X_in is
when '0' => y_out <= '1' after tph;
when '1' => y_out <= '0' after tpl;
when 'X' => y_out <= 'X' after (tph+tpl)/2;
others => y_out <= 'X' after tpl;
end case;
A Typical use of CASE: FSM
case machine_state is
when sv0 => machine_state <= sv1
when sv1 => machine_state <= sv2;
when sv2 => machine_state <= sv3;
when sv3 => machine_state <= sv0;
end case;
Typical use of CASE: Multiplexer
case Current_state is
when sv0 | sv1 | sv2 => Z_out <= '0';
when sv3 => Z_out <= '1';
end case;
While Loops
Form:
In general,
tval := ‘1’;
for i in x_in’range loop
t_val := t_val and x_in(i) ;
end loop;
Form
WAIT;