Port Map
Advanced Member level 4

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);