• As the name suggests, GENERIC is a way of specifying a generic parameter.
• A static parameter that can be easily modified and adapted to different applications.
• The purpose is to make the code more flexible and reusable.
• must be declared in the ENTITY.
• More than one GENERIC parameter can be specified in an ENTITY.
Syntax
GENERIC (parameter_name : parameter_type := parameter_value);
Example
The GENERIC statement below specifies a parameter called n, of type INTEGER, whose default value is 8. Therefore, whenever n is found in the ENTITY itself or in the ARCHITECTURE (one or more) that follows, its value will be assumed to be 8.
ENTITY
ENTITY my_entity IS
GENERIC (n : INTEGER := 8; vector: BIT_VECTOR := "00001111");
PORT (...);
END my_entity;
ARCHITECTURE my_architecture OF my_entity IS
...
END my_architecture;
ARCHITECTURE
ARCHITECTURE generic_decoder OF decoder IS
BEGIN
PROCESS (ena, sel)
VARIABLE temp1 : STD_LOGIC_VECTOR (x'HIGH DOWNTO 0);
VARIABLE temp2 : INTEGER RANGE 0 TO x'HIGH;
....
information shared by www.irvs.info