So I know how to instantiate multiple instances of the same component in VHDL, see the example code:
component REG
port(D,CLK,RESET : in std_ulogic;
Q : out std_ulogic);
end component;
begin
GEN_REG:
for I in 0 to 3 generate
REGX : REG port map
(DIN(I), CLK, RESET, DOUT(I));
end generate GEN_REG;
end GEN;
I want to know if it's possible to retrieve the instantiation number within the code, so which "I" belongs to which instantiation, from within the instantiated code.
edit: I want to use the instantiation number, because that is also the address for which device I want to address. So I'm creating an x number of instances, each for a certain device interfaces. It would simplify some stuff when the instance itself knows which instance number it is.
edit2: Can I generic map I to some integer generic?
I
is the number of the instantiation. \$\endgroup\$