元件例化语句应用

用元件例化语句描述图示的电路结构,给出代码,给出编译成功截图。
vhdl_com

--底层设计:

library ieee;

use ieee.std_logic_1164.all;



entity and1 is

    port ( a, b : in std_logic;

           c : out std_logic);

end and1;



architecture bhv1 of and1 is

begin

    c <= a and b;

end bhv1;



----------------------------------------------



library ieee;

use ieee.std_logic_1164.all;



entity or1 is

    port ( a, b : in std_logic;

           c : out std_logic);

end or1;



architecture bhv2 of or1 is

begin

    c <= a or b;

end bhv2;



----------------------------------------------



--顶层设计:

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_unsigned.all;



entity TASK is

    port( A : in std_logic;

          B : in std_logic;

          C : in std_logic;

          D : in std_logic;

          F : out std_logic);    

end TASK;



architecture BHV of TASK is

component and1

    port( A, B : in std_logic;

          C : out std_logic);

end component;



component or1

    port( A, B : in std_logic;

          C : out std_logic);

end component;





signal y1, y2 : std_logic;

begin

    u1 : and1 port map(a, b, y1);

    u2 : or1 port map(c, d, y2);

    u3 : and1 port map(y1, y2, f);

end BHV;




扫一扫在手机打开当前页