Port Map
Advanced Member level 4
- Joined
- Aug 24, 2013
- Messages
- 118
- Helped
- 15
- Reputation
- 30
- Reaction score
- 14
- Trophy points
- 1,298
- Activity points
- 2,089
sometimes we need to display a state machine's state on LEDs or signals.
the syntax below helps us to display the number of state machine on LEDs.
Syntax: T'pos(X) Returns the position number of X within the type T.
example:
the syntax below helps us to display the number of state machine on LEDs.
Syntax: T'pos(X) Returns the position number of X within the type T.
example:
Code:
type tState is (S1,S2,S3);
signal sMainState:tState:=S1;
signal sLeds :std_logic_vector(2 downto 0);
....
...
sLeds <=conv_std_logic_vector(tState'pos(sMainState),sLeds'length);