2. Generic Map
2.1 Generic Map
A generic map is the process of associating a generic value in an entity with a value in the architecture. Generics are parameters used to configure a component.
Some important points:
- Generic: A parameter to change the characteristics of an entity.
- Generic Map: Sets the value of the generic during instantiation.
- Default Value: Used if a value is not explicitly set.
2.2 Generic Map Example
entity Counter is
generic (
WIDTH: positive := 8;
ENABLED: boolean := true
);
port (
clk: in std_logic;
reset: in std_logic;
count: out std_logic_vector(WIDTH-1 downto 0)
);
end entity;
architecture RTL of MyDesign is
signal my_counter_output: std_logic_vector(7 downto 0);
begin
my_counter_inst: Counter
generic map (
WIDTH => 8,
ENABLED => true
)
port map (
clk => system_clock,
reset => reset_signal,
count => my_counter_output
);
end architecture;