上层模块源程序[4]及注释:
library ieee;
use ieee.std_logic_1164.all;
entity total5 is
port(uo,ut,dt,dth:in std_logic--一、二、三层楼电梯外的上下楼请求键。
o,t,th:in std_logic;--一、二、三层电梯里的按键。
pres:in std_logic;--reset信号。
clk:in std_logic;--时钟信号,1 MHz。
lightout:out std_logic_vector(6 downto 0);--数码管的输入信号。
lu,ld:out std_logic;--电梯上升,下降的灯。
arr:out std_logic);--开门的灯。
end;
architecture a of total5 is
signal templ0,templ2:std_logic;
signal templ1:integer range 3 to 1;
Signal
temp1,temp2,temp3,temp4,temp5,temp6,temp7:std_logic;
component bigmain--调用电梯控制模块。
port(upone,uptwo,downtwo,downthree
:in std_logic;
one,two,three:in std_logic;
reset:in std_logic;
clk,clk2:in std_logic;
p:out integer range 3 to 1;
lightup,lightdown:out std_logic;
arrive:out std_logic);
end component;
component fangdou --调用防抖动模块。
port(clk:in std_logic;
key:in std_logic;
keyout:out std_logic);
end component;
component fenpin--调用分频器模块。
port(clk:in std_logic;
clk1,clk2:out std_logic);
end component;
component display--调用译码显示模块。
port(clk :in std_logic;
light:in integer range 3 to 1;
segout:out std_logic_vector(6 downto 0));
end component;
begin
u1:fenpin port map(clk,templ0,templ2);
u4:fangdou port map(templ0,uo,temp1);
u5:fangdou port map(templ0,ut,temp2);
u6:fangdou port map(templ0,dt,temp3);
u7:fangdou port map(templ0,dth,temp4);
u8:fangdou port map(templ0,o,temp5);
u9:fangdou port map(templ0,t,temp6);
u10:fangdou port map(templ0,th,temp7);
u11:bigmain port map(temp1,temp2,temp3,
temp4,temp5,temp6,temp7,pres,clk,templ2,
templ1,lu,ld,arr);
u12:display port map(clk,templ1,lightout);
end;