结构体(Architecture)

2/22/2017来源:ASP.NET技巧人气:996

结构体(Architecture)

一个结构体用来定义内部的组织或操作。例如描述其相关联实体的行为、数据流或者结构。

An architecture defines the internal organization or Operation, i.e. describes the behaviour, data flow, or structure, of an associated entity.

语法(Syntax)

architecture 结构体名 of 实体名 is
  [ 结构体说明语句 ]
begin 
  功能描述语句
end [ architecture ] [ 结构体名 ]; 

architecture architecture_name of entity_name is
  [ architecture_declarations ]
begin 
  concurrent_statements
end [ architecture ] [ architecture_name ]; 
说明(Description)

一个结构体定义硬件模块的内部视图,例如硬件的功能、行为或者结构。一个结构体和一个定义了接口的实体相关联。

An architecture defines the internal view of a block of hardware, i.e. the functionality, behaviour or structure of the hardware. An architecture is assigned to an entity which defines the interface. 一个实体可以拥有多个结构体与之相关联。如果所有的结构体都和同一个实体相关联,则他们的名字必须不同,但是和不同实体相关联的结构体名可以相同。 An entity can have multiple alternative architectures assigned to it. All the architectures assigned to the same entity must have different names, but architectures assigned to different entities can have the same name.

例程(Example)

architecture Test of TbDff is 
  signal Clk, D, Q: std_logic := '0'; 
  component Dff 
    port(Clk, D: in std_logic; Q: out std_logic); 
  end component; 
begin 
  uut : Dff port map (Clk => Clk, D => D, Q => Q);
  Clk <= not (Clk) after 25 ns;
  stimulus : PRocessAn architecture may not be used without an entity.
All declarations defined in an entity are fully visible and accessible within each architecture assigned to this entity.
  begin
    wait for 50 ns;
	D <= '1';
    wait for 100 ns;
	D <= '0';
    wait for 50 ns;
  end process stimulus;
end Test;

注释(Notes)

结构体可以脱离开实体单独被使用An architecture may not be used without an entity.所有在实体中声明的定义都必须对其相关联的结构体可见,并且可以访问。All declarations defined in an entity are fully visible and accessible within each architecture assigned to this entity.