I'm seeing these errors:
- You're assigning values of type 'state' to 'PS' and 'NS', but you declared them as std_logic
- You're assiging 0 to done -- probably a typo, it should be '0' (note the quotes)
To fix the problem of assigning PS to y, you can use these ideas:
- Using an constant array describing the mapping
Code:
-- in declaration area
type state_mapping is array(state) of std_logic;
constant mapping : state_mapping := (S0 => '0', S1 => '1');
-- in implementation area
y <= mapping(PS);
Or, when you find you need more complicated mappings, use a function,
Code:
-- in declaration area
function mapping(s : state) return std_logic is
begin
case s is
when S0 => return '0';
when S1 => return '1';
end case;
end;
-- in implementation area
y <= mapping(PS);