2023年全國(guó)碩士研究生考試考研英語(yǔ)一試題真題(含答案詳解+作文范文)_第1頁(yè)
已閱讀1頁(yè),還剩57頁(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><b>  編寫的程序</b></p><p><b> ?。ㄒ唬┕δ苣K:</b></p><p>  library ieee;</p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_unsign

2、ed.all;</p><p>  use ieee.std_logic_arith.all;</p><p><b>  --實(shí)體--</b></p><p>  entity at24c08 is</p><p><b>  port(</b></p><p>  clk

3、:instd_logic;--時(shí)鐘信號(hào)</p><p>  rst:in std_logic;--復(fù)位信號(hào)</p><p>  scl:out std_logic;--i2c時(shí)鐘線</p><p>  sda:inoutstd_logic;--i2c數(shù)據(jù)線</p

4、><p>  urv_1:in std_logic;--上限值1</p><p>  urv_2:instd_logic;--上限值2</p><p>  sel:out std_logic_vector(3 downto 0);</p><p>  seg:outstd_

5、logic_vector(7 downto 0);</p><p>  beep: outstd_logic--蜂鳴器輸出信號(hào)線</p><p><b>  );</b></p><p>  end at24c08;</p><p><b>  --結(jié)構(gòu)體--</b></

6、p><p>  architecture arch_at24c08 of at24c08 is</p><p>  signal clk_sslow:std_logic;</p><p>  signal counter :std_logic_vector(23 downto 0);</p><p>  signal readda

7、ta_reg_buf:std_logic_vector(15 downto 0);</p><p>  signal readdata_ten:integer range 0 to 24564;</p><p>  signal readdata_std:std_logic_vector(15 downto 0);</p><p>  signal

8、qian:std_logic_vector(3 downto 0);</p><p>  signal bai:std_logic_vector(3 downto 0);</p><p>  signal shi:std_logic_vector(3 downto 0);</p><p>  signal ge:std_

9、logic_vector(3 downto 0);</p><p>  signal qian_0:integer range 0 to 10;</p><p>  signal bai_0:integer range 0 to 10;</p><p>  signal shi_0:integer range 0 to 10;</

10、p><p>  signal ge_0:integer range 0 to 10;</p><p><b>  --數(shù)碼管部分信號(hào)</b></p><p>  signal sel_0:std_logic_vector(3 downto 0);</p><p>  signal seg_0:s

11、td_logic_vector(7 downto 0);</p><p>  signal count:std_logic_vector(13 downto 0);</p><p>  signal clk_slow:std_logic;</p><p>  signal scan_num:std_logic_vector(1 downto

12、 0);</p><p>  signal seg_data_buf:std_logic_vector(3 downto 0);</p><p><b>  --i2c部分信號(hào)</b></p><p>  signal sda_buf:std_logic;--i2c輸入/輸出數(shù)據(jù)寄存器</p><p&g

13、t;  signal link:std_logic;--sda輸入輸出方向寄存器</p><p>  signal readdata_reg:std_logic_vector(15 downto 0);--i2c讀回的數(shù)據(jù)寄存器</p><p>  signal sda_0:std_logic;--與sda端口連接信號(hào)</p><

14、;p>  signal scl_0:std_logic;--與scl端口連接信號(hào)</p><p>  --按鍵消抖部分信號(hào)</p><p>  signal delay_cnt:std_logic_vector(19 downto 0);--消抖延時(shí)計(jì)數(shù)器</p><p>  signal start_delay:std_lo

15、gic;--按鍵延時(shí)開始</p><p><b>  --分頻部分信號(hào)</b></p><p>  signal clk_div:std_logic_vector(12 downto 0);--分頻計(jì)數(shù)器,5000分頻,10khz</p><p><b>  --蜂鳴器部分信號(hào)</b></p

16、><p>  signal beep_en:std_logic;--蜂鳴器使能信號(hào)</p><p>  signal beep_buf:std_logic;--與beep端口連接的信號(hào)</p><p><b>  --時(shí)鐘部分信號(hào)</b></p><p>  signal level_hi

17、gh:std_logic;--高電平中間值,1249</p><p>  signal level_low:std_logic;--低電平中間值,3749</p><p>  signal level_hig_edge:std_logic;--上升沿,4999</p><p>  signal level_low_e

18、dge:std_logic;--下降沿,2499</p><p><b>  --狀態(tài)機(jī)部分信號(hào)</b></p><p>  signal main_state:std_logic_vector(1 downto 0);--狀態(tài)機(jī)主狀態(tài)</p><p>  signal i2c_state:std_logic_v

19、ector(2 downto 0);--i2c狀態(tài)</p><p>  signal i2c_per_state:std_logic_vector(3 downto 0);--i2c每一步狀態(tài)</p><p><b>  --分頻部分常量</b></p><p>  constant div_parameter:std_logic

20、_vector(12 downto 0):="1001110001000";--分頻系數(shù),500</p><p><b>  --狀態(tài)機(jī)部分常量</b></p><p><b>  --操作狀態(tài)常量</b></p><p>  constant read_init:std_logic_vecto

21、r(2 downto 0):="000";--EEPORM初始化</p><p>  constant read_high:std_logic_vector(2 downto 0):="001";--讀高位數(shù)據(jù)狀態(tài)</p><p>  constant read_low:std_logic_vector(2 downto 0):=

22、"010";--讀低位數(shù)據(jù)狀態(tài)</p><p>  --i2c每一步狀態(tài)常量</p><p>  constant start:std_logic_vector(3 downto 0):="0000";</p><p><b>  --開始位</b></p><p> 

23、 constant first:std_logic_vector(3 downto 0):="0001";</p><p><b>  --數(shù)據(jù)第一位 </b></p><p>  constant second:std_logic_vector(3 downto 0):="0010";</p>

24、;<p><b>  --數(shù)據(jù)第二位</b></p><p>  constant third:std_logic_vector(3 downto 0):="0011";</p><p><b>  --數(shù)據(jù)第三位</b></p><p>  constant fourth

25、:std_logic_vector(3 downto 0):="0100";</p><p><b>  --數(shù)據(jù)第四位</b></p><p>  constant fifth:std_logic_vector(3 downto 0):="0101";</p><p><b&g

26、t;  --數(shù)據(jù)第五位</b></p><p>  constant sixth :std_logic_vector(3 downto 0):="0110";</p><p><b>  --數(shù)據(jù)第六位</b></p><p>  constant seventh:std_logic_vect

27、or(3 downto 0):="0111";</p><p><b>  --數(shù)據(jù)第七位</b></p><p>  constant eighth:std_logic_vector(3 downto 0):="1000";</p><p><b>  --數(shù)據(jù)第八位</

28、b></p><p>  constant ack:std_logic_vector(3 downto 0):="1001";</p><p><b>  --應(yīng)答位</b></p><p>  constant stop:std_logic_vector(3 downto 0):="

29、;1010";</p><p><b>  --停止位</b></p><p><b>  --結(jié)構(gòu)體開始</b></p><p><b>  begin</b></p><p>  scl <= scl_0;</p><p>  se

30、g <= seg_0;</p><p>  sda_0 <= sda_buf when (link)='1' else 'Z';</p><p>  sda <= sda_0;</p><p>  sel <= sel_0;</p><p>  beep <= beep_buf;&

31、lt;/p><p><b>  --按鍵消抖</b></p><p>  key :process(clk,rst)</p><p><b>  begin</b></p><p>  if(not rst='1') then </p><p>  delay_

32、cnt <= (others => '0');</p><p>  elsif (clk'event and clk='1') then</p><p>  if start_delay='1' then</p><p>  if(delay_cnt /= "111101000010010

33、00000") then--20ms延時(shí)</p><p>  delay_cnt <= delay_cnt+'1';</p><p><b>  else </b></p><p>  delay_cnt <= (others => '0');</p><p&g

34、t;<b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process key;</p><p><b>  --分頻部分</b></

35、p><p>  div : process(rst,clk)</p><p><b>  begin</b></p><p>  if(not rst='1') then</p><p>  clk_div <= "0000000000000";</p><p&g

36、t;  level_high <= '0';</p><p>  level_low <= '0';</p><p>  level_hig_edge <= '0';</p><p>  level_low_edge <= '0';</p><p>  e

37、lsif(clk'event and clk='1') then</p><p>  if(clk_div /= div_parameter-'1') then</p><p>  clk_div <= clk_div+'1';</p><p><b>  else </b><

38、/p><p>  clk_div <= "0000000000000";</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  level_high <= '0';</p

39、><p><b>  else </b></p><p>  if(clk_div="10011100001") then</p><p>  level_high <= '1';</p><p><b>  end if;</b></p><

40、;p><b>  end if;</b></p><p>  if(level_low_edge='1') then</p><p>  level_low_edge <= '0';</p><p><b>  else </b></p><p>  if

41、(clk_div="100111000011") then</p><p>  level_low_edge <= '1';</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if(l

42、evel_low='1') then</p><p>  level_low <= '0';</p><p><b>  else </b></p><p>  if(clk_div="111010100101") then</p><p>  level_low

43、 <= '1';</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if(level_hig_edge='1') then</p><p>  level_hig_edge <= &

44、#39;0';</p><p><b>  else </b></p><p>  if(clk_div="1001110000111") then</p><p>  level_hig_edge <= '1';</p><p><b>  end if;&l

45、t;/b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process div;</p><p>  --EEPROM操作部分</p><p>  state : process(c

46、lk,rst)</p><p><b>  begin</b></p><p>  if(not rst='1') then</p><p>  start_delay <= '0';</p><p>  scl_0 <= '1';</p><

47、;p>  sda_buf <= '1';</p><p>  link <= '0';</p><p>  readdata_reg <= "0000000000000000";</p><p>  main_state <= "00";</p>&l

48、t;p>  i2c_state <= read_init;</p><p>  i2c_per_state <= start;</p><p>  elsif(clk'event and clk='1') then</p><p>  case main_state is</p><p>  --初始

49、化EEPROM</p><p>  when "00" =>--等待讀寫要求</p><p>  scl_0 <= '1';</p><p>  sda_buf <= '1';</p><p>  link <= '0'

50、;</p><p>  i2c_state <= read_init;</p><p>  i2c_per_state <= start;</p><p>  main_state <= "10";</p><p>  --讀取EEPRO數(shù)據(jù)</p><p>  when &quo

51、t;10" =></p><p>  if(level_hig_edge='1') then</p><p>  scl_0 <= '1';</p><p><b>  else</b></p><p>  if(level_low_edge='1')

52、 then</p><p>  scl_0 <= '0';</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  case i2c_state is</p><p>  when re

53、ad_init =>--讀命令地址</p><p>  case i2c_per_state is</p><p>  when start =></p><p>  if(level_high='1') then</p><p>  sda_buf <= '0';</p&

54、gt;<p>  link <= '1';</p><p><b>  end if;</b></p><p>  if((level_low and link)='1') then</p><p>  link <= '1';</p><p> 

55、 sda_buf <= '1';</p><p>  i2c_per_state <= first;</p><p><b>  end if;</b></p><p>  when first =></p><p>  if(level_low='1') then<

56、;/p><p>  sda_buf <= '0';</p><p>  link <= '1';</p><p>  i2c_per_state <= second;</p><p><b>  end if;</b></p><p>  when s

57、econd =></p><p>  if(level_low='1') then</p><p>  sda_buf <= '0';</p><p>  link <= '1';</p><p>  i2c_per_state <= third;</p>

58、<p><b>  end if;</b></p><p>  when third =></p><p>  if(level_low='1') then</p><p>  sda_buf <= '1';</p><p>  link <= '1&#

59、39;;</p><p>  i2c_per_state <= fourth;</p><p><b>  end if;</b></p><p>  when fourth =></p><p>  if(level_low='1') then</p><p>  s

60、da_buf <= '0';</p><p>  link <= '1';</p><p>  i2c_per_state <= fifth;</p><p><b>  end if;</b></p><p>  when fifth =></p>

61、<p>  if(level_low='1') then</p><p>  sda_buf <= '0';</p><p>  link <= '1';</p><p>  i2c_per_state <= sixth;</p><p><b>  end

62、 if;</b></p><p>  when sixth =></p><p>  if(level_low='1') then</p><p>  sda_buf <= '0';</p><p>  link <= '1';</p><p&g

63、t;  i2c_per_state <= seventh;</p><p><b>  end if;</b></p><p>  when seventh =></p><p>  if(level_low='1') then</p><p>  sda_buf <= '1&#

64、39;;</p><p>  link <= '1';</p><p>  i2c_per_state <= eighth;</p><p><b>  end if;</b></p><p>  when eighth =></p><p>  if(level

65、_low='1') then</p><p>  link <= '0';</p><p>  i2c_per_state <= ack;</p><p><b>  end if;</b></p><p>  when ack =></p><p&g

66、t;  if(level_hig_edge='1') then</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  if(sda_buf=

67、9;1') then</p><p>  main_state <= "00";</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  if(level_low='1') then

68、</p><p>  link <= '0';</p><p>  i2c_state <= read_high;</p><p>  i2c_per_state <= first;</p><p><b>  end if;</b></p><p>  when

69、 others => null;</p><p><b>  end case;</b></p><p>  when read_high =>--讀回?cái)?shù)據(jù)</p><p>  case i2c_per_state is</p><p>  when first =></p>

70、<p>  if(level_hig_edge='1') then</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readd

71、ata_reg(15 downto 9) <= readdata_reg(14 downto 8);</p><p>  readdata_reg(8) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><

72、p>  i2c_per_state <= second;</p><p><b>  end if;</b></p><p>  when second =></p><p>  if(level_hig_edge='1') then</p><p>  sda_buf <= sd

73、a;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readdata_reg(15 downto 9) <= readdata_reg(14 downto 8);</p><p>  readdata_re

74、g(8) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><p>  i2c_per_state <= third;</p><p><b>  end if;</b></

75、p><p>  when third =></p><p>  if(level_hig_edge='1') then</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high=&

76、#39;1') then</p><p>  readdata_reg(15 downto 9) <= readdata_reg(14 downto 8);</p><p>  readdata_reg(8) <= sda;</p><p><b>  end if;</b></p><p>  if

77、(level_low='1') then</p><p>  i2c_per_state <= fourth;</p><p><b>  end if;</b></p><p>  when fourth =></p><p>  if(level_hig_edge='1')

78、 then</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readdata_reg(15 downto 9) <= readdata_reg(14

79、downto 8);</p><p>  readdata_reg(8) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><p>  i2c_per_state <= fifth;</p>

80、<p><b>  end if;</b></p><p>  when fifth =></p><p>  if(level_hig_edge='1') then</p><p>  sda_buf <= sda;</p><p><b>  end if;<

81、/b></p><p>  if(level_high='1') then</p><p>  readdata_reg(15 downto 9) <= readdata_reg(14 downto 8);</p><p>  readdata_reg(8) <= sda;</p><p><b>

82、  end if;</b></p><p>  if(level_low='1') then</p><p>  i2c_per_state <= sixth;</p><p><b>  end if;</b></p><p>  when sixth =></p>

83、<p>  if(level_hig_edge='1') then</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readda

84、ta_reg(15 downto 9) <= readdata_reg(14 downto 8);</p><p>  readdata_reg(8) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><p

85、>  i2c_per_state <= seventh;</p><p><b>  end if;</b></p><p>  when seventh =></p><p>  if(level_hig_edge='1') then</p><p>  sda_buf <= s

86、da;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readdata_reg(15 downto 9) <= readdata_reg(14 downto 8);</p><p>  readdata_r

87、eg(8) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><p>  i2c_per_state <= eighth;</p><p><b>  end if;</b><

88、;/p><p>  when eighth =></p><p>  if(level_hig_edge='1') then</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_hig

89、h='1') then</p><p>  readdata_reg(15 downto 9) <= readdata_reg(14 downto 8);</p><p>  readdata_reg(8) <= sda;</p><p><b>  end if;</b></p><p> 

90、 if(level_low='1') then</p><p>  i2c_per_state <= ack;</p><p><b>  end if;</b></p><p>  when ack =></p><p>  if(level_high='1') then&l

91、t;/p><p>  link <= '1';</p><p>  sda_buf <= '0';</p><p>  i2c_per_state <= first;</p><p>  i2c_state <= read_low;</p><p><b>

92、  end if;</b></p><p>  when others => null;</p><p><b>  end case;</b></p><p>  when read_low =></p><p>  case i2c_per_state is</p><p&

93、gt;  when first =></p><p>  if(level_hig_edge='1') then</p><p>  link <= '0';</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></

94、p><p>  if(level_high='1') then</p><p>  readdata_reg(7 downto 1) <= readdata_reg(6 downto 0);</p><p>  readdata_reg(0) <= sda;</p><p><b>  end if;<

95、/b></p><p>  if(level_low='1') then</p><p>  i2c_per_state <= second;</p><p><b>  end if;</b></p><p>  when second =></p><p> 

96、 if(level_hig_edge='1') then</p><p>  link <= '0';</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1'

97、) then</p><p>  readdata_reg(7 downto 1) <= readdata_reg(6 downto 0);</p><p>  readdata_reg(0) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low=&

98、#39;1') then</p><p>  i2c_per_state <= third;</p><p><b>  end if;</b></p><p>  when third =></p><p>  if(level_hig_edge='1') then</p>

99、;<p>  link <= '0';</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readdata_reg(7 d

100、ownto 1) <= readdata_reg(6 downto 0);</p><p>  readdata_reg(0) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><p>  i2c_pe

101、r_state <= fourth;</p><p><b>  end if;</b></p><p>  when fourth =></p><p>  if(level_hig_edge='1') then</p><p>  link <= '0';</p

102、><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readdata_reg(7 downto 1) <= readdata_reg(6 downto 0);<

103、;/p><p>  readdata_reg(0) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><p>  i2c_per_state <= fifth;</p><p>&l

104、t;b>  end if;</b></p><p>  when fifth =></p><p>  if(level_hig_edge='1') then</p><p>  link <= '0';</p><p>  sda_buf <= sda;</p>

105、<p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readdata_reg(7 downto 1) <= readdata_reg(6 downto 0);</p><p>  readdata_reg(0) <= sda

106、;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><p>  i2c_per_state <= sixth;</p><p><b>  end if;</b></p><p&g

107、t;  when sixth =></p><p>  if(level_hig_edge='1') then</p><p>  link <= '0';</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p

108、><p>  if(level_high='1') then</p><p>  readdata_reg(7 downto 1) <= readdata_reg(6 downto 0);</p><p>  readdata_reg(0) <= sda;</p><p><b>  end if;</

109、b></p><p>  if(level_low='1') then</p><p>  i2c_per_state <= seventh;</p><p><b>  end if;</b></p><p>  when seventh =></p><p>

110、  if(level_hig_edge='1') then</p><p>  link <= '0';</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1'

111、;) then</p><p>  readdata_reg(7 downto 1) <= readdata_reg(6 downto 0);</p><p>  readdata_reg(0) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low=

112、'1') then</p><p>  i2c_per_state <= eighth;</p><p><b>  end if;</b></p><p>  when eighth =></p><p>  if(level_hig_edge='1') then</p

113、><p>  link <= '0';</p><p>  sda_buf <= sda;</p><p><b>  end if;</b></p><p>  if(level_high='1') then</p><p>  readdata_reg(

114、7 downto 1) <= readdata_reg(6 downto 0);</p><p>  readdata_reg(0) <= sda;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p><p>  i2c

115、_per_state <= ack;</p><p><b>  end if;</b></p><p>  when ack =></p><p>  if(level_high='1') then</p><p>  link <= '1';</p>&

116、lt;p>  sda_buf <= '1';--非應(yīng)答位</p><p>  --i2c_per_state <= stop;</p><p><b>  end if;</b></p><p>  if(level_low='1') then</p>

117、<p>  link <= '1';</p><p>  sda_buf <= '0';</p><p>  i2c_per_state <= stop;</p><p><b>  end if;</b></p><p>  when stop =>

118、;</p><p>  if(level_high='1') then</p><p>  link <= '1';</p><p>  sda_buf <= '1';--停止位</p><p><b>  end if;</b></p>

119、<p>  if(level_low='1') then</p><p>  main_state <= "00";</p><p><b>  end if;</b></p><p>  when others => null;</p><p><b&

120、gt;  end case;</b></p><p>  when others => null;</p><p><b>  end case;</b></p><p>  when others => null;</p><p><b>  end case;</b>&l

121、t;/p><p><b>  end if;</b></p><p>  end process state;</p><p><b>  --數(shù)據(jù)處理部分</b></p><p>  anly1 : process(readdata_reg_buf)</p><p><b

122、>  begin</b></p><p>  readdata_ten <= conv_integer(readdata_reg_buf)*12;</p><p>  qian_0 <= readdata_ten/1000;</p><p>  bai_0 <= (readdata_ten/100) rem 10;</p&g

123、t;<p>  shi_0 <= (readdata_ten/10) rem 10;</p><p>  ge_0 <= readdata_ten rem 10;</p><p>  end process anly1;</p><p>  anly2 : process(qian_0,bai_0,shi_0,ge_0)</p>

124、;<p><b>  begin</b></p><p>  qian <= conv_std_logic_vector(qian_0,4);</p><p>  bai <= conv_std_logic_vector(bai_0,4);</p><p>  shi <= conv_std_logic_vect

125、or(shi_0,4);</p><p>  ge <= conv_std_logic_vector(ge_0,4);</p><p>  end process anly2;</p><p><b>  --數(shù)碼管顯示部分</b></p><p>  scan : process(rst,clk)</p&g

126、t;<p><b>  begin</b></p><p>  if(not rst='1') then</p><p>  count <= (others => '0');</p><p>  clk_slow <= '0';</p><p&

127、gt;  elsif(clk'event and clk='1') then</p><p>  if(count="11111011011111") then</p><p>  count <= (others => '0');</p><p>  clk_slow <= not cl

128、k_slow;</p><p><b>  else </b></p><p>  count <= count + '1';</p><p><b>  end if;</b></p><p><b>  end if;</b></p>&

129、lt;p>  end process scan;</p><p>  seg1 : process(clk_slow,rst)</p><p><b>  begin</b></p><p>  if(not rst='1') then</p><p>  scan_num <= "

130、00";</p><p>  elsif(clk_slow'event and clk_slow='1') then</p><p>  if(scan_num="11") then</p><p>  scan_num <= "00";</p><p><

131、b>  else</b></p><p>  scan_num <= scan_num + '1';</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process seg1;

132、</p><p>  seg2 : process(seg_data_buf)</p><p><b>  begin</b></p><p>  case seg_data_buf is</p><p>  when "1111" => seg_0 <= "10001110&q

133、uot;; </p><p>  when "1110" => seg_0 <= "10000110"; </p><p>  when "1101" => seg_0 <= "10100001"; </p><p>  whe

134、n "1100" => seg_0 <= "11000110"; </p><p>  when "1011" => seg_0 <= "10000011"; </p><p>  when "1010" => seg_0 <= "1

135、0011000"; </p><p>  when "1001" => seg_0 <= "10010000"; </p><p>  when "1000" => seg_0 <= "10000000"; </p><p>  whe

136、n "0111" => seg_0 <= "11111000"; </p><p>  when "0110" => seg_0 <= "10000010"; </p><p>  when "0101" => seg_0 <= "1

137、0010010"; </p><p>  when "0100" => seg_0 <= "10011001"; </p><p>  when "0011" => seg_0 <= "10110000"; </p><p>  whe

138、n "0010" => seg_0 <= "10100100"; </p><p>  when "0001" => seg_0 <= "11111001"; </p><p>  when "0000" => seg_0 <= "1

139、1000000"; </p><p>  when others => seg_0 <= "11111111"; </p><p><b>  end case;</b></p><p>  end process seg2;</p><p>  seg0 : proc

140、ess(scan_num)</p><p><b>  begin</b></p><p>  case scan_num is</p><p>  when "00" => </p><p>  sel_0 <= "1110";</p><p>

141、;  seg_data_buf <= ge;</p><p>  when "01" => </p><p>  sel_0 <= "1101";</p><p>  seg_data_buf <= shi;</p><p>  when "10" =>

142、 </p><p>  sel_0 <= "1011";</p><p>  seg_data_buf <= bai;</p><p>  when "11" => </p><p>  sel_0 <= "0111";</p><p>

143、;  seg_data_buf <= qian;</p><p>  when others => null;</p><p><b>  end case;</b></p><p>  end process seg0;</p><p><b>  --數(shù)據(jù)緩存部分</b></p

144、><p>  ss : process(clk,rst)</p><p><b>  begin</b></p><p>  if(not rst='1') then</p><p>  clk_sslow <= '0';</p><p>  counter &l

145、t;= (others => '0');</p><p>  elsif(clk'event and clk='1') then</p><p>  if(counter /= "111111111111111111111110") then</p><p>  counter <= count

146、er + '1';</p><p><b>  else </b></p><p>  counter <= (others => '0');</p><p>  clk_sslow <= not clk_sslow;</p><p><b>  end if;

溫馨提示

  • 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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 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)論