I have 3 different types of component. For example type0, type1 and type2. They all have the same ports but functions. I want to use a constant like 0, 1 and 3 to put the corresponding component in my top design. I want to know the way to do this.
Best regards
You could use a generate
statement, eg:
G0 : if SOME_CONSTANT = 0 generate
I0 : type0 ( ...
end generate;
G1 : if SOME_CONSTANT = 1 generate
I1 : type1 ( ...
end generate;
G2 : if SOME_CONSTANT = 2 generate
I2 : type2 ( ...
end generate;
-- etc
If you use VHDL-2008, there is a case
-generate
statement:
G : case SOME_CONSTANT generate
when 0 =>
I0 : type0 ( ...
when 1 =>
I1 : type1 ( ...
when 2 => 2
I2 : type2 ( ...
-- etc
end generate;