eda課程設(shè)計(jì)-電子鐘_第1頁(yè)
已閱讀1頁(yè),還剩16頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、<p>  EDA課程設(shè)計(jì)-電子鐘</p><p><b>  一、設(shè)計(jì)要求</b></p><p><b>  1、基本功能要求:</b></p><p>  設(shè)計(jì)一個(gè)電子時(shí)鐘,要求可以顯示時(shí)、分、秒,用戶可以設(shè)置時(shí)間。</p><p><b>  擴(kuò)展功能要求:</b&

2、gt;</p><p>  跑表功能,鬧鐘功能,調(diào)整數(shù)碼管的亮度。</p><p><b>  二、系統(tǒng)結(jié)構(gòu)</b></p><p>  控制鍵—jian5、jian4、jian7、jian8:</p><p>  數(shù)碼管顯示段選信號(hào)輸出sg:</p><p>  ——選擇6位數(shù)碼管中的某一個(gè)顯示

3、數(shù)據(jù);</p><p>  發(fā)光二極管控制信號(hào)輸出—led(7~0)</p><p>  鬧鐘聲音輸出—speaker</p><p>  通過(guò)一個(gè)10M信號(hào)分出各種所需頻率</p><p><b>  功能介紹</b></p><p>  運(yùn)行后,選擇模式7,8位數(shù)碼管分顯示時(shí)間的時(shí)、分、秒,當(dāng)

4、前為模式0:時(shí)間顯示模式,按鍵7為模式選擇鍵,按下按鍵7,系統(tǒng)進(jìn)入模式1,第二次按下為模式2,設(shè)置時(shí)間模式,第三次按下為跑表模式,第四次為鬧鐘設(shè)置模式,第五次為亮度調(diào)節(jié)模式:設(shè)置時(shí)間模式,按鍵4控制更改數(shù)碼管的位,按鍵5控制選中數(shù)碼管的數(shù)值,時(shí)間設(shè)置完成后,按鍵按鍵8,設(shè)置時(shí)間會(huì)保存住,并在模式0中顯示;系統(tǒng)進(jìn)入模式2:秒表模式,按鍵4為開始/結(jié)束鍵,按鍵5為清零鍵;系統(tǒng)進(jìn)入模式3:鬧鐘設(shè)置模式,相關(guān)設(shè)置與模式1相同,當(dāng)當(dāng)前時(shí)間與鬧鐘設(shè)

5、置時(shí)間相同時(shí),喇叭就會(huì)響;系統(tǒng)進(jìn)入模式4:亮度調(diào)節(jié)模式,通過(guò)按鍵4設(shè)置亮度,共三種亮度;再按下按鍵7,系統(tǒng)又會(huì)進(jìn)入模式0。</p><p><b>  4、RTL圖</b></p><p><b>  三、VHDL源程序</b></p><p>  1、library ieee; --

6、通過(guò)10M分出所需頻率</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;</p><p>  entity fenpin is</p><p><b>  port (</b></p><

7、p>  clk_10M : in std_logic;</p><p>  clk_10000 : out std_logic;</p><p>  clk_100 : out std_logic;</p><p>  clk_1 : out std_logic</p><p><b>  );</b></p

8、><p>  end entity;</p><p>  architecture sub1 of fenpin is</p><p>  signal Q_1 : std_logic_vector(8 downto 0);</p><p>  signal Q_2 : std_logic_vector(6 downto 0);</p>

9、;<p>  signal Q_3 : std_logic_vector(6 downto 0);</p><p>  signal clk10000 : std_logic;</p><p>  signal clk100 : std_logic;</p><p>  signal clk1 : std_logic;</p><p

10、><b>  begin</b></p><p>  process(clk_10M)</p><p><b>  begin</b></p><p>  if clk_10M'event and clk_10M='1' then</p><p>  if Q_1=50

11、0 then</p><p>  Q_1 <= "000000000";</p><p>  clk10000 <= not clk10000;</p><p>  if Q_2=100 then </p><p>  Q_2 <= "0000000";</p><

12、p>  clk100<= not clk100;</p><p>  if Q_3=100 then </p><p>  Q_3 <= "0000000";</p><p>  clk1<=not clk1;</p><p>  else Q_3<=Q_3+1;</p><

13、;p><b>  end if;</b></p><p>  else Q_2<=Q_2+1;</p><p><b>  end if;</b></p><p>  else Q_1<=Q_1+1;</p><p><b>  end if;</b><

14、/p><p><b>  end if;</b></p><p>  end process;</p><p>  clk_10000 <= clk10000;</p><p>  clk_100 <= clk100;</p><p>  clk_1 <= clk1;</p&g

15、t;<p><b>  end sub1;</b></p><p>  2、library ieee; --掃描數(shù)碼管</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;<

16、;/p><p>  entity xianshi is</p><p>  port(clk_10000:in std_logic;</p><p>  jian4:in std_logic;</p><p>  moshi:in integer range 0 to 4;</p><p>  a0,a1,a3,a4,a6

17、,a7:in integer range 0 to 9;</p><p>  sg11:out std_logic_vector(6 downto 0);</p><p>  bt11:out std_logic_vector(7 downto 0));</p><p><b>  end;</b></p><p>  

18、architecture one of xianshi is</p><p>  signal cnt8 :std_logic_vector(2 downto 0);</p><p>  signal a :integer range 0 to 15;</p><p>  signal light: std_logic;</p><p>  

19、signal flash:integer range 0 to 2;</p><p>  signal count1,count2:integer range 0 to 10;</p><p><b>  begin</b></p><p>  p1: process(cnt8,light,a0,a1,a3,a4,a6,a7)</p>

20、;<p><b>  begin</b></p><p>  case cnt8 is</p><p>  when "000" => bt11<= "0000000"&(light);a<=a0;</p><p>  when "001" =&

21、gt; bt11<= "000000"&(light)&'0';a<=a1;</p><p>  when "010" => bt11<= "00000"&(light)&"00";a<=15;</p><p>  when &quo

22、t;011" => bt11<= "0000"&(light)&"000";a<=a3;</p><p>  when "100" => bt11<= "000"&(light)&"0000";a<=a4;</p><

23、p>  when "101" => bt11<= "00"&(light)&"00000";a<=15; </p><p>  when "110" => bt11<= '0'&(light)&"000000";a<=a6;&

24、lt;/p><p>  when "111" => bt11<= (light)&"0000000";a<=a7;</p><p>  when others => null;</p><p><b>  end case;</b></p><p>  

25、end process p1;</p><p>  p2:process(clk_10000)</p><p><b>  begin</b></p><p>  if clk_10000'event and clk_10000 ='1' then cnt8 <= cnt8+1;</p><p&

26、gt;<b>  end if;</b></p><p>  end process p2;</p><p>  p3:process(a)</p><p><b>  begin</b></p><p><b>  case a is</b></p><p

27、>  when 0 => sg11<= "0111111";</p><p>  when 1 => sg11<= "0000110";</p><p>  when 2 => sg11<= "1011011";</p><p>  when 3 => sg1

28、1<= "1001111";</p><p>  when 4 => sg11<= "1100110";</p><p>  when 5 => sg11<= "1101101";</p><p>  when 6 => sg11<= "1111101&q

29、uot;;</p><p>  when 7 => sg11<= "0000111";</p><p>  when 8 => sg11<= "1111111";</p><p>  when 9 => sg11<= "1101111";</p><p

30、>  when 10 => sg11<= "1110111";</p><p>  when 11 => sg11<= "1111100";</p><p>  when 12 => sg11<= "0111001";</p><p>  when 13 =>

31、 sg11<= "1011110";</p><p>  when 14 => sg11<= "1111001";</p><p>  when 15 => sg11<= "1000000";</p><p>  when others => null;</p>

32、;<p><b>  end case;</b></p><p>  end process p3;</p><p>  process(jian4,moshi)</p><p><b>  begin </b></p><p>  if moshi=4 then</p>

33、<p>  if jian4'event and jian4='1' then</p><p>  if flash =2 then </p><p>  flash<=0; </p><p>  else flash<=flash+1;</p><p><b>  end if;&l

34、t;/b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  process(clk_10000,flash)</p><p><b>  

35、begin</b></p><p>  if clk_10000'event and clk_10000 ='1' then</p><p>  case flash is</p><p>  when 0 => light<='1';</p><p>  when 1 =>

36、; if count1=2 then </p><p>  count1<=0; light<='1';</p><p>  else count1<=count1+1;light<='0';</p><p><b>  end if;</b></p><p> 

37、 when 2 => if count2=4 then </p><p>  count2<=0; light<='1';</p><p>  else count2<=count2+1;light<='0';</p><p><b>  end if;</b></p>

38、<p><b>  end case;</b></p><p><b>  end if;</b></p><p>  end process;</p><p><b>  end;</b></p><p>  3、library ieee;

39、 --跑表開始暫停</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;</p><p>  entity paobiao is</p><p>  port(clk_1:in std_logic;</

40、p><p>  jian8:in std_logic;</p><p>  shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1:in integer range 0 to 9;</p><p>  shishi2,shige2,fenshi2,fenge2,miaoshi2,miaoge2:out integer range 0

41、 to 9);</p><p>  end entity;</p><p>  architecture bhv of paobiao is</p><p>  signal shi:integer range 0 to 100;</p><p>  signal fen:integer range 0 to 100;</p>

42、<p>  signal miao:integer range 0 to 100;</p><p><b>  begin</b></p><p>  process(clk_1,jian8,shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1)</p><p><b>  begin

43、</b></p><p>  if jian8='1' then</p><p>  shi<=shishi1*10+shige1;</p><p>  fen<=fenshi1*10+fenge1;</p><p>  miao<=miaoshi1*10+miaoge1;</p>

44、<p>  elsif clk_1'event and clk_1='1' then </p><p>  if miao=59 then</p><p><b>  miao<=0;</b></p><p>  fen<=fen+1;</p><p>  elsif f

45、en>59 then</p><p><b>  fen<=0;</b></p><p>  shi<=shi+1;</p><p>  elsif shi>23 then</p><p><b>  shi<=0;</b></p><p>  

46、else miao<=miao+1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  miaoge2<=miao rem 10;</p><p&g

47、t;  miaoshi2<=miao/10;</p><p>  fenge2<=fen rem 10;</p><p>  fenshi2<=fen/10;</p><p>  shige2<=shi rem 10;</p><p>  shishi2<=shi/10;</p><p>

48、<b>  end;</b></p><p>  4、library ieee; --設(shè)置當(dāng)前時(shí)間</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;</p><p>  

49、entity settime is</p><p>  port(moshi:in integer range 0 to 4;</p><p>  jian4,jian5:in std_logic;</p><p>  shishi,shige,fenshi,fenge,miaoshi,miaoge:out integer range 0 to 9);</p&

50、gt;<p>  end entity;</p><p>  architecture bav of settime is</p><p>  signal a:integer range 0 to 5;</p><p>  signal shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1: integer r

51、ange 0 to 9; </p><p><b>  begin </b></p><p>  process(moshi,jian4)</p><p><b>  begin</b></p><p>  if moshi=1 then </p><p>  if jian

52、4'event and jian4='1' then</p><p>  if a < 5 then</p><p><b>  a<=a+1;</b></p><p>  else a<=0;</p><p><b>  end if;</b></p

53、><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  process(moshi,a,jian5)</p><p><b>  begin</b>&

54、lt;/p><p>  if moshi=1 then</p><p>  if a=0 then</p><p>  if jian5'event and jian5='1' then</p><p>  if miaoge1 =9 then</p><p>  miaoge1<=0;<

55、;/p><p>  else miaoge1<=miaoge1+1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if

56、a=1 then</p><p>  if jian5'event and jian5='1' then</p><p>  if miaoshi1 =5 then</p><p>  miaoshi1<=0;</p><p>  else miaoshi1<=miaoshi1+1;</p>

57、<p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if a=2 then</p><p>  if jian5'event and jian5

58、='1' then</p><p>  if fenge1 =9 then</p><p>  fenge1<=0;</p><p>  else fenge1<=fenge1+1;</p><p><b>  end if;</b></p><p><b>

59、  end if;</b></p><p><b>  end if;</b></p><p>  if a=3 then</p><p>  if jian5'event and jian5='1' then</p><p>  if fenshi1 =5 then</p

60、><p>  fenshi1<=0;</p><p>  else fenshi1<=fenshi1+1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;&l

61、t;/b></p><p>  if a=4 then</p><p>  if jian5'event and jian5='1' then</p><p>  if shige1 =9 then</p><p>  shige1<=0;</p><p>  else shige1

62、<=shige1+1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if a=5 then</p><p>  if

63、 jian5'event and jian5='1' then</p><p>  if shishi1 =2 then</p><p>  shishi1<=0;</p><p>  else shishi1<=shishi1+1;</p><p><b>  end if;</b>

64、</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  miaoge<=miao

65、ge1;</p><p>  miaoshi<=miaoshi1;</p><p>  fenge<=fenge1;</p><p>  fenshi<=fenshi1;</p><p>  shige<=shige1;</p><p>  shishi<=shishi1;</p&g

66、t;<p><b>  end;</b></p><p>  5、library ieee; --秒表功能</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;</p>&l

67、t;p>  entity miaobiao is</p><p>  port(clk_100:in std_logic;</p><p>  moshi:in integer range 0 to 4;</p><p>  jian5,jian4:in std_logic;</p><p>  fenshi,fenge,miaoshi

68、,miaoge,xmiaoshi,xmiaoge:out integer range 0 to 9);</p><p>  end entity;</p><p>  architecture bhv of miaobiao is</p><p>  signal fen,miao,xmiao:integer range 0 to 99;</p>&l

69、t;p>  signal start:std_logic:='0';</p><p>  signal reset:std_logic:='0';</p><p><b>  begin</b></p><p>  process(clk_100,jian5,jian4,moshi,reset,start)

70、</p><p><b>  begin</b></p><p>  if moshi=2 then</p><p>  if reset='1' then</p><p><b>  fen<=0;</b></p><p><b>  mia

71、o<=0;</b></p><p><b>  xmiao<=0;</b></p><p>  elsif start='1' then </p><p>  elsif clk_100'event and clk_100='1' then </p><p>

72、;  if xmiao=99 then</p><p><b>  xmiao<=0;</b></p><p>  miao<=miao+1;</p><p>  elsif miao>59 then</p><p><b>  miao<=0;</b></p>

73、<p>  fen<=fen+1;</p><p>  elsif fen>23 then</p><p><b>  fen<=0;</b></p><p>  else xmiao<=xmiao+1;</p><p><b>  end if;</b><

74、/p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  process(jian4,start)</p><p><b>  begin</b>&

75、lt;/p><p>  if jian4'event and jian4='1' then</p><p>  start<=not start;</p><p>  else start<=start;</p><p><b>  end if;</b></p><p

76、>  end process; </p><p>  process(jian5,reset)</p><p><b>  begin</b></p><p>  if jian5'event and jian5='1' then</p><p>  reset<=not reset;

77、</p><p>  else reset<= reset;</p><p><b>  end if;</b></p><p>  end process; </p><p>  xmiaoge<=xmiao rem 10;</p><p>  xmiaoshi<=xmiao/

78、10;</p><p>  miaoge<=miao rem 10;</p><p>  miaoshi<=miao/10;</p><p>  fenge<=fen rem 10;</p><p>  fenshi<=fen/10;</p><p><b>  end;</b&

79、gt;</p><p>  6、library ieee; --設(shè)置鬧鐘時(shí)間</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;</p><p>  entity naozhongset

80、is</p><p>  port(moshi:in integer range 0 to 4;</p><p>  jian4,jian5:in std_logic;</p><p>  shishi,shige,fenshi,fenge,miaoshi,miaoge:out integer range 0 to 9);</p><p> 

81、 end entity;</p><p>  architecture bav of naozhongset is</p><p>  signal a:integer range 0 to 5;</p><p>  signal fenshi1,fenge1,miaoge1: integer range 0 to 9;</p><p>  

82、signal shishi1: integer range 0 to 9:=1;</p><p>  signal shige1: integer range 0 to 9:=2;</p><p>  signal miaoshi1: integer range 0 to 9:=0;</p><p><b>  begin </b></p

83、><p>  process(moshi,jian4)</p><p><b>  begin</b></p><p>  if moshi=3 then </p><p>  if jian4'event and jian4='1' then</p><p>  if a &

84、lt; 5 then</p><p><b>  a<=a+1;</b></p><p>  else a<=0;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><

85、;b>  end if;</b></p><p>  end process;</p><p>  process(moshi,a,jian5)</p><p><b>  begin</b></p><p>  if moshi=3 then</p><p>  if a=0

86、then</p><p>  if jian5'event and jian5='1' then</p><p>  if miaoge1 =9 then</p><p>  miaoge1<=0;</p><p>  else miaoge1<=miaoge1+1;</p><p>

87、;<b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if a=1 then</p><p>  if jian5'event and jian5='1&

88、#39; then</p><p>  if miaoshi1 =5 then</p><p>  miaoshi1<=0;</p><p>  else miaoshi1<=miaoshi1+1;</p><p><b>  end if;</b></p><p><b>

89、  end if;</b></p><p><b>  end if;</b></p><p>  if a=2 then</p><p>  if jian5'event and jian5='1' then</p><p>  if fenge1 =9 then</p>

90、<p>  fenge1<=0;</p><p>  else fenge1<=fenge1+1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b>

91、;</p><p>  if a=3 then</p><p>  if jian5'event and jian5='1' then</p><p>  if fenshi1 =5 then</p><p>  fenshi1<=0;</p><p>  else fenshi1&

92、lt;=fenshi1+1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if a=4 then</p><p>  if

93、 jian5'event and jian5='1' then</p><p>  if shige1 =9 then</p><p>  shige1<=0;</p><p>  else shige1<=shige1+1;</p><p><b>  end if;</b><

94、/p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if a=5 then</p><p>  if jian5'event and jian5='1' then</p><p>  i

95、f shishi1 =2 then</p><p>  shishi1<=0;</p><p>  else shishi1<=shishi1+1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p&

96、gt;<b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  miaoge<=miaoge1;</p><p>  miaoshi<=miaoshi1;</p><p&g

97、t;  fenge<=fenge1;</p><p>  fenshi<=fenshi1;</p><p>  shige<=shige1;</p><p>  shishi<=shishi1;</p><p><b>  end;</b></p><p>  7、libr

98、ary ieee; --鬧鐘喇叭輸出</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;</p><p>  entity naozhongspeaker is</p><p>  port(c

99、lk_100:in std_logic;</p><p>  shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1:in integer range 0 to 9;</p><p>  shishi2,shige2,fenshi2,fenge2,miaoshi2,miaoge2:in integer range 0 to 9;</p>

100、<p>  speaker:out std_logic);</p><p>  end entity;</p><p>  architecture bav of naozhongspeaker is</p><p><b>  begin </b></p><p>  process(clk_100,<

101、/p><p>  shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1,</p><p>  shishi2,shige2,fenshi2,fenge2,miaoshi2,miaoge2)</p><p><b>  begin</b></p><p>  if shishi2=shi

102、shi1 and shige2=shige1 and fenshi2=fenshi1 and </p><p>  fenge2=fenge1 and miaoshi2=miaoshi1 then</p><p>  speaker<=clk_100;</p><p>  else speaker<='1';</p><

103、;p><b>  end if;</b></p><p>  end process;</p><p><b>  end;</b></p><p>  8、library ieee; --轉(zhuǎn)換模式</p><p>  use ieee.std_l

104、ogic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;</p><p>  entity moshi is</p><p>  port(jian7:in std_logic;</p><p>  moshi:out integer range 0 to 4);</p>

105、<p><b>  end;</b></p><p>  architecture one of moshi is</p><p>  signal moshis:integer range 0 to 4;</p><p><b>  begin</b></p><p>  proces

106、s(jian7)</p><p><b>  begin</b></p><p>  if jian7'event and jian7='1' then</p><p>  if moshis=4 then</p><p>  moshis<=0; </p><p>

107、  else moshis<=moshis+1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  moshi<=moshis;</p><p>

108、;<b>  end;</b></p><p>  9、library ieee; --五選一選擇器</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsigned.all;</p><p> 

109、 entity mux5_1 is</p><p>  port(moshi:in integer range 0 to 4 ;</p><p>  shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1:in integer range 0 to 9; </p><p>  shishi2,shige2,fensh

110、i2,fenge2,miaoshi2,miaoge2:in integer range 0 to 9;</p><p>  shishi3,shige3,fenshi3,fenge3,miaoshi3,miaoge3:in integer range 0 to 9; </p><p>  fenshi,fenge,miaoshi,miaoge,xmiaoshi,xmiaoge:i

111、n integer range 0 to 9; </p><p>  a0,a1,a3,a4,a6,a7:out integer range 0 to 9); </p><p>  end entity mux5_1;</p><p>  architecture bhv of mux5_1 is</p><p>&l

112、t;b>  begin</b></p><p>  process(shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1,</p><p>  shishi2,shige2,fenshi2,fenge2,miaoshi2,miaoge2,</p><p>  shishi3,shige3,fenshi3,fe

113、nge3,miaoshi3,miaoge3,</p><p>  fenshi,fenge,miaoshi,miaoge,xmiaoshi,xmiaoge,</p><p><b>  moshi)</b></p><p><b>  begin</b></p><p>  case moshi i

114、s</p><p>  when 0 => a0<=shishi1;a1<=shige1;a3<=fenshi1;a4<=fenge1;a6<=miaoshi1;a7<=miaoge1;</p><p>  when 1 => a0<=shishi2;a1<=shige2;a3<=fenshi2;a4<=fenge2;

115、a6<=miaoshi2;a7<=miaoge2;</p><p>  when 2 => a0<=fenshi;a1<=fenge;a3<=miaoshi;a4<=miaoge;a6<=xmiaoshi;a7<=xmiaoge;</p><p>  when 3 => a0<=shishi3;a1<=shige3;a

116、3<=fenshi3;a4<=fenge3;a6<=miaoshi3;a7<=miaoge3;</p><p>  when 4 => a0<=8;a1<=8;a3<=8;a4<=8;a6<=8;a7<=8;</p><p><b>  end case;</b></p><p>

117、;  end process;</p><p><b>  end;</b></p><p>  10、library ieee; --主程序置頂</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.st

118、d_logic_unsigned.all;</p><p>  entity clock is</p><p>  port(clk_10M:in std_logic;</p><p>  jian5,jian4,jian7,jian8:in std_logic;</p><p>  sg:out std_logic_vector(6 dow

119、nto 0);</p><p>  bt:out std_logic_vector(7 downto 0);</p><p>  speaker:out std_logic);</p><p>  end entity; </p><p><b>  調(diào)用聲明語(yǔ)句</b></p><p>  ar

120、chitecture bav of clock is</p><p>  component fenpin --分頻</p><p><b>  port (</b></p><p>  clk_10M : in std_logic;</p><p>  clk_10000 : o

121、ut std_logic;</p><p>  clk_100 : out std_logic;</p><p>  clk_1 : out std_logic</p><p><b>  );</b></p><p>  end component;</p><p>  component p

122、aobiao --跑表</p><p>  port(clk_1:in std_logic;</p><p>  jian8:in std_logic;</p><p>  shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1:in integer range 0 to 9;</p&g

123、t;<p>  shishi2,shige2,fenshi2,fenge2,miaoshi2,miaoge2:out integer range 0 to 9);</p><p>  end component;</p><p>  component xianshi --掃描顯示</p><p>  port(c

124、lk_10000:in std_logic;</p><p>  jian4:in std_logic;</p><p>  moshi:in integer range 0 to 4;</p><p>  a0,a1,a3,a4,a6,a7:in integer range 0 to 9;</p><p>  sg11:out std_lo

125、gic_vector(6 downto 0);</p><p>  bt11:out std_logic_vector(7 downto 0));</p><p>  end component;</p><p>  component moshi --模式轉(zhuǎn)換</p><p>  port(jia

126、n7:in std_logic;</p><p>  moshi:out integer range 0 to 4);</p><p>  end component;</p><p>  component mux5_1 --五選一選擇器</p><p>  port(moshi:in integ

127、er range 0 to 4 ;</p><p>  shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1:in integer range 0 to 9; </p><p>  shishi2,shige2,fenshi2,fenge2,miaoshi2,miaoge2:in integer range 0 to 9;</p&g

128、t;<p>  shishi3,shige3,fenshi3,fenge3,miaoshi3,miaoge3:in integer range 0 to 9; </p><p>  fenshi,fenge,miaoshi,miaoge,xmiaoshi,xmiaoge:in integer range 0 to 9; </p><p>  a0,a1,a3,a

129、4,a6,a7:out integer range 0 to 9);</p><p>  end component;</p><p>  component settime --設(shè)置當(dāng)前時(shí)間</p><p>  port(moshi:in integer range 0 to 4;</p><p>

130、  jian4,jian5:in std_logic;</p><p>  shishi,shige,fenshi,fenge,miaoshi,miaoge:out integer range 0 to 9);</p><p>  end component;</p><p>  component miaobiao is --秒

131、表</p><p>  port(clk_100:in std_logic;</p><p>  moshi:in integer range 0 to 4;</p><p>  jian5,jian4:in std_logic;</p><p>  fenshi,fenge,miaoshi,miaoge,xmiaoshi,xmiaoge:o

132、ut integer range 0 to 9);</p><p>  end component;</p><p>  component naozhongset is --鬧鐘時(shí)間設(shè)置</p><p>  port(moshi:in integer range 0 to 4;</p><p>  jian4

133、,jian5:in std_logic;</p><p>  shishi,shige,fenshi,fenge,miaoshi,miaoge:out integer range 0 to 9);</p><p>  end component;</p><p>  component naozhongspeaker is --鬧鐘喇叭輸出&l

134、t;/p><p>  port(clk_100:in std_logic;</p><p>  shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1:in integer range 0 to 9;</p><p>  shishi2,shige2,fenshi2,fenge2,miaoshi2,miaoge2:in intege

135、r range 0 to 9;</p><p>  speaker:out std_logic);</p><p>  end component;</p><p>  signal moshis:integer range 0 to 4; --信號(hào)聲明</p><p>  signal shishi1s,shige1s,fen

136、shi1s,fenge1s,miaoshi1s,miaoge1s:integer range 0 to 9;</p><p>  signal shishi2s,shige2s,fenshi2s,fenge2s,miaoshi2s,miaoge2s:integer range 0 to 9;</p><p>  signal shishi3s,shige3s,fenshi3s,fenge3

137、s,miaoshi3s,miaoge3s:integer range 0 to 9;</p><p>  signal fenshis,fenges,miaoshis,miaoges,xmiaoshis,xmiaoges: integer range 0 to 9;</p><p>  signal a0s,a1s,a3s,a4s,a6s,a7s: integer range 0 to 9

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論