VHDL语言结构体的三种描述风格是

如题所述

三种风格即行为描述、结构体描述、数据流描述。
下面给你举个例子,你就明白了。
这是一个两位相等比较器的例子
entity equ2 is
port(a,b:in std_logic_vector(1 downto 0);
equ:out std_logic);
end equ2;
--结构体结构描述:用元件例化,即网表形式来实现;
architecture netlist of equ2 is
component nor2
port(a,b :in std_logic;
c :out std_logic);
end component;
component xor2
port(a,b :in std_logic;
c :out std_logic);
end component;
signal x: std_logic_vector(1 downto 0);
begin
U1:xor2 port map(a(0),b(0),x(0));
U2:xor2 port map(a(1),b(1),x(1));
U3:nor2 port map(a(0),b(1),equ);
end netlist;
--结构体数据流描述:用布尔方程来实现:
architecture equation of equ2 is
begin
equ<=(a(0) xor b(0)) nor(a(1) xor b(1));
end equation;
--结构体行为描述:用顺序语句来实现:
architecture con_behave of equ2 is
begin
process(a,b)
begin
if a=b then
equ<='1';
else
equ<='0';
end if;
end procerss;
end con_behave;
--结构体行为描述:用并行语句来实现:
architecture seq_behave of equ2 is
begin
equ<='1' when a=b else '0';
end sqq_behave;
温馨提示:答案为网友推荐,仅供参考
相似回答