Opel_Corsa
Member level 1
In the following sample code a state machine is defined:
As you see, there's one task given to each state (at the last part of the code, the with-select section). e.g. outputscr is assigned 0 when in state I0. Now, what I want to do is to define more tasks for, say, I0. For example, when in state I0, I want to assert 0 on outputscr, set var_x, and unset var_y. I'm wondering what is the syntax for doing this.
Any help is appreciated.
Code:
architecture RTL of mycode is
type state_type is (I0,I1,I2,I3,I4,I5,I6);
signal y : state_type;
signal var_x, var_y : std_logic;
begin
process(clk, reset)
begin
if (reset = '1') then
var_x <= '0';
y <= I0;
elsif (clk'event and clk = '1') then
case y is
when I1 => y <= I2;
when I2 => y <= I3;
when I3 => y <= I4;
when I4 => y <= I5;
when I5 => y <= I6;
when others => var_x <= '0';
y <= I1;
end case;
end if;
end process;
with y select
outputscr <= "00000000" when I0,
"00111000" when I1,
"00111000" when I2,
"00001100" when I3,
"00000001" when I4,
"00000110" when I5,
"10000000" when I6;
end RTL;
As you see, there's one task given to each state (at the last part of the code, the with-select section). e.g. outputscr is assigned 0 when in state I0. Now, what I want to do is to define more tasks for, say, I0. For example, when in state I0, I want to assert 0 on outputscr, set var_x, and unset var_y. I'm wondering what is the syntax for doing this.
Any help is appreciated.