配置声明(Configuration Declaration)
配置是一种如何将多层级的设计联结到一起的概念。
A configuration is a construct that defines how the design hierarchy is linked together.
语法(Syntax)
configuration configuration_name of entity_name is
[ configuration_declarations ]
for architecture_name
[ configuration_item ]
end for;
end [ configuration ] [ configuration_name ];
configuration_item = for instance_label : component_name
[ use_item
[ generic_map ]
[ port_map ]; ]
[ configuration_item ]
end for;
use_item = entity [ library_name. ] entity_name [ ( architecture_name ) ] |
configuration [ library_name. ] configuration_name
configuration 配置名 of 实体名 is
[ 配置声明 ]
for 结构体名
[ 结构体项 ]
end for;
end [ configuration ] [ 配置名 ];
结构体项 = for 实例标签 : 元件名
[ 使用项
[ 类属映射 ]
[ 端口映射 ]; ]
[ 配置项 ]
end for;
使用项 = entity [ 库名. ] 实体名 [ ( 结构体名 ) ] |
configuration [ 库名. ] 配置名
一个配置声明定义了在加工阶段如何将多层级的设计联合起来,通过列出使用的实体和结构体中的每个元件的例化信息。
A configuration declaration defines how the design hierarchy is linked together during elaboration, by listing the entities and architectures used in place of each component instantiation within an architecture.
一个简单的配置仅包含一个结构体的引用。多层级的配置允许嵌套多个配置。这种机制允许在层级底层对元件例化和设计实体进行绑定。
A simple configuration contains reference to only one architecture body. Hierarchical configurations allow to nest configurations. This mechanism allows binding component instantiations with the design entities down the hierarchy.
当元件中定义的端口数和类属不等于实体中定义的副本是,可以使用标识符来确定端口和类属的映射。这也是类属映射和端口映射的目的。
When the ports and generics in the component declaration are not equal to their counterparts in the entity declaration, one can use an explicit notification on how the ports and generics in the entity should be bound to ports and generics of the component instance. The generic map and port map are used for this purpose.
例程(Example)
-- an architecture of a microprocessor
architecture Structure of MicroProcessor is
component ALU port (...); end component;
component MUX port (...); end component;
component LATCH port (...); end component;
begin
A1: ALU port map(...);
M1: MUX port map(...);
M2: MUX port map(...);
M3: MUX port map(...);
L1: LTACH port map(...);
L2: LATCH port map(...);
end Structure;
-- a configuration of the microprocessor
library TTL, work;
use TTL.all;
use work.all;
configuration Cfg4 of MicroProcessor is
for Structure
for A1: ALU
use configuration TTL.SN74LS181;
end for;
for M1, M2, M3: MUX
use entity Multiplex4(behavior);
end for;
for all: LATCH
use entity Work.Latch;
end for;
end for;
end configuration Cfg4;
注释(Note)
- 尽管配置非常使用,但许多综合器并不支持。所以,最好写个脚本来正确地综合结构体。
- Although configurations are relevant and useful for selecting which entities and achitectures make up the design hierarchy, many synthesis tools do not support them. You better write a script to synthsize the correct architectures.
- 实体,和他的结构体和配置必须在同一个库中。
- The entity, it's architectures and configurations must be compiled in the same library.