【文章內(nèi)容簡(jiǎn)介】
reena,yellowa,greena1: out std_logic。 redb,greenb,yellowb,greenb1: out std_logic)。 end entity dingceng。 clkd— 脈沖輸入 resetd— 復(fù)位信號(hào) con— 手動(dòng)控制信號(hào) 吳思林:基于 FPGA 交通燈控制器設(shè)計(jì) 12 con1d— 狀態(tài)控制信號(hào) count1, count2, count3, count4— 七段數(shù)碼管顯示 reda,greena,yellowa, greena1, redb,greenb,yellowb,greenb1— 發(fā)光二極管輸出 4 實(shí)驗(yàn)程序設(shè)計(jì) 一個(gè)完整的 VHDL語(yǔ)言程序通常包括實(shí)體( Entity)、構(gòu)造體、配置、包集合( Package)和庫(kù)( Library) 5個(gè)部分組成。下面結(jié)合實(shí)際的程序來(lái)加以說(shuō)明。 library ieee。 use 。 use 。 entity dingceng is port(clkd,resetd,cond,con1d:in std_logic。 count1:out std_logic_vector(6 downto 0)。 count2:out std_logic_vector(6 downto 0)。 count3:out std_logic_vector(6 downto 0)。 count4:out std_logic_vector(6 downto 0)。 reda,greena,yellowa,greena1: out std_logic。 redb,greenb,yellowb,greenb1: out std_logic)。 end entity dingceng。 architecture one of dingceng is ponent clk_10 port(clk:in std_logic。 clk_div10 : out std_logic)。 end ponent。 ponent counter port (clk0:in std_logic。 con:in std_logic。 reset:in std_logic。 countnum:buffer integer range 0 to 89)。 end ponent。 ponent controller port ( clk1 : in std_logic。 2020 屆電子信息工程專業(yè)畢業(yè)設(shè)計(jì)(論文) 13 con1 : in std_logic。 con2: in std_logic。 countnum : in integer range 0 to 89。 numa,numb : out integer range 0 to 25。 ra,ga,ya,ga1: out std_logic。 rb,gb,yb,gb1 : out std_logic)。 end ponent。 ponent fenwei port ( numin:in integer range 0 to 25。 numa,numb:out integer range 0 to 9 )。 end ponent。 ponent yima port(clk2:in std_logic。 bb: in integer range 0 to 9。 ya:out std_logic。 yb:out std_logic。 yc:out std_logic。 yd:out std_logic。 ye:out std_logic。 yf:out std_logic。 yg:out std_logic)。 end ponent。 signal a,b,c:std_logic。 signal ww:integer range 0 to 89。 signal yy1,yy2:integer range 0 to 25。 signal tt1,tt2,tt3,tt4:integer range 0 to 9。 begin u0: clk_10 port map(clk=clkd,clk_div10=a)。 u1: clk_10 port map(clk=clkd,clk_div10=b)。 u2: clk_10 port map(clk=b,clk_div10=c)。 u3:counter port map(clk0=c,con=cond,reset=resetd,countnum=ww)。 u4:controller port map (clk1=c,con1=cond,con2=con1d,countnum=ww,numa=yy1,numb=yy2,ra=reda,ga=greena,ya=yellowa,ga1=greena1,rb=redb,gb=greenb,yb=yellowb,gb1=greenb1)。 u5:fenwei port map(numin=yy1,numa=tt1,numb=tt2)。 u6:fenwei port map (numin=yy2,numa=tt3,numb=tt4)。 u7:yima 吳思林:基于 FPGA 交通燈控制器設(shè)計(jì) 14 port map(clk2=b,bb=tt1,ya=count1(0),yb=count1(1),yc=count1(2),yd=count1(3),ye=count1(4),yf=count1(5),yg=count1(6))。 u8:yima port map (clk2=b,bb=tt2,ya=count2(0),yb=count2(1),yc=count2(2),yd=count2(3),ye=count2(4),yf=count2(5),yg=count2(6))。 u9:yima port map(clk2=b,bb=tt3,ya=count3(0),yb=count3(1),yc=count3(2),yd=count3(3),ye=count3(4),yf=count3(5),yg=count3(6))。 u10:yima port map(clk2=b,bb=tt4,ya=count4(0),yb=count4(1),yc=count4(2),yd=count4(3),ye=count4(4),yf=count4(5),yg=count4(6))。 end architecture one。 library ieee。 use 。 use 。 use 。 entity clk_10 is port( clk : in std_logic。 clk_div10 : out std_logic)。 end clk_10。 architecture one of clk_10 is signal clk_temp : std_logic。 begin process(clk) variable counter : std_logic_vector(2 downto 0)。 constant md : std_logic_vector(2 downto 0) := 101。 begin if(clk39。event and clk=39。139。) then if(counter = md)then counter := (others =39。039。)。 clk_temp = not clk_temp。 end if。 counter := counter + 1 。 end if。 end process。 2020 屆電子信息工程專業(yè)畢業(yè)設(shè)計(jì)