类属(Generic)
块和其环境进行通信的一个静态信息通道。
A channel for static information to be communicated to a block from its environment.
语法(Syntax)
generic ( generic_name, ... : data_type [ := expression ] );
generic ( 类属名, ... : 数据类型 [ := 设定值 ] );
说明(Description)
类属用来参数化一个设计实体。他为块提供了一个类似于常量的静态信息,但不同与常量的是类属可以被外部赋值。在同一设计实体中的不同实例可以拥有不同的类属值。实例中类属的值通过类属映射来进行赋值。
A generic is used to parameterize a design entity. They support static information to blocks in a similar way as constants, but unlike constants the values of generics can be supplied externally. Different instances of the same design entity can have different values for the generic parameters. Generics are given values in the generic map of an instance.
在实体中类属定义的值可以被实体读取,也可被相关联的结构体进行读取。
Values supported by generics declared in an entity can be read either in the entity or in the associated architectures.
实体中的类属必须在相应的元件中进行复制,从而允许元件的例化通过默认规则来进行配置。
The generics of an entity must be duplicated in the corresponding component, to allow instances of the component to be configured implicitly via the default rules.
例程(Example)
generic (BusWidth: integer := 16;
Length, Size: positive);
注释(Note)
- 许多综合工具仅支持整型类属。
- Many synthesis tools support only generics of type Integer.