元件(Component)
元件声明了一个设计实体的虚拟接口,以供元件例化语句使用。
A component declaration declares a virtual design entity interface that may be used in the component instantiation statement.
语法(Syntax)
component component_name [ is ]
[ generic ( generic_list ); ]
[ port ( port_list ); ]
end component [ component_name ];
component 元件名 [ is ]
[ generic ( 类属表 ); ]
[ port ( 端口表 ); ]
end component [ 元件名 ];
描述(Description)
一个元件表示一个实体/结构体对。他表示一个子系统,可以被其他结构体例化来组建一个多层级的结构。元件例化类似于一个板卡上的一个芯片。
A component represents an entity/architecture pair. It specifies a subsystem, which can be instantiated in another architecture leading to a hierarchical specification. Component instantiation is analogous to a chip in a socket in a board.
元件例化前必须声明。
A component must be declared before it is instantiated.
设计实体和指定元件的绑定可以延后执行也可在配置规范或配置声明中进行。默认配置下,元件名必须和他在实体中使用的名字相同,并且实体名必须可见。同样,类属和端口的名字、模式和类型也必须一致。
The binding of a design entity to a given component may be delayed and may be placed either in the configuration specification or configuration declaration. For default configuration, the component name must match the name of the corresponding entity to be used in its place, and the entity name must be visible. Also generics and ports must match in name, mode and type.
元件可以在包、设计实体、结构体或者块声明中定义。如果元件在结构体中声明,他必须在begin语句前声明。在这种情况下,元件只能在结构体中使用(例化)。
The component can be defined in a package, design entity, architecture, or block declaration. If the component is declared in an architecture, it must be declared before the begin statement of the architecture. In such a case, the component can be used (instantiated) in the architecture only.
如果元件在包中声明,那么该元件对使用该包的所有结构体可见。
If a component is declared in a package, then such a component is visible in any architecture, which uses this package.
例程(Example)
component Counter is
generic(N: integer);
port(Clk, Rst, En: in std_logic;
Q: out std_logic_vector(N-1 downto 0));
end component;
- 一个元件声明没有特别定义那个实体/结构体对被绑定到每个实例中。如果没有定义配置声明或配置规范,则采用默认的绑定。
- A component declaration does not explicitly define which entity/architecture pair is bound to each instance. If no configuration specification or configuration declaration is defined a default binding is used.