M
MikeWhy
Guest
I know there are better ways to structure a FSM, but is there a more
succinct way to write the following? For a discrete enumerated type and some
subtypes of its range, I want to write the short version, as for reds_t,
which is not legal VHDL, rather than the wordier but valid blues_t case.
case fsm_state is
...
when reds_t => -- illegal, but seems unambiguous enough
case reds_t'(fsm_state) is
when brown =>
fsm_state <= some_state;
when red =>
when orange =>
fsm_state <= some_state;
end case;
when blues_t'low to blues_t'high => -- wordy, but works
case blues_fsm in
...
end case;
when invalid =>
...
end;
given these declarations:
type state_t is (
black, brown, red, orange,
yellow, green, blue, violet,
gray, white, invalid
);
subtype reds_t is state_t range brown to orange;
subtype blues_t is state_t range green to violet;
signal fsm_state, some_state : state_t;
signal blues_fsm : blues_t;
======
succinct way to write the following? For a discrete enumerated type and some
subtypes of its range, I want to write the short version, as for reds_t,
which is not legal VHDL, rather than the wordier but valid blues_t case.
case fsm_state is
...
when reds_t => -- illegal, but seems unambiguous enough
case reds_t'(fsm_state) is
when brown =>
fsm_state <= some_state;
when red =>
when orange =>
fsm_state <= some_state;
end case;
when blues_t'low to blues_t'high => -- wordy, but works
case blues_fsm in
...
end case;
when invalid =>
...
end;
given these declarations:
type state_t is (
black, brown, red, orange,
yellow, green, blue, violet,
gray, white, invalid
);
subtype reds_t is state_t range brown to orange;
subtype blues_t is state_t range green to violet;
signal fsm_state, some_state : state_t;
signal blues_fsm : blues_t;
======