1、LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;USE IEEE.STD_LOGIC_ARITH.ALL;ENTITY div IS -50000 和 50000000 分频PORT(clk,clear,stop: IN STD_LOGIC;clk_out1,clk_out2:OUT STD_LOGIC);END div;ARCHITECTURE a OF div ISSIGNAL tmp1: INTEGER RANGE 0 TO 24999;SIGNAL tmp2: INTEGER RANGE
2、0 TO 499;SIGNAL clktmp1: STD_LOGIC;SIGNAL clktmp2: STD_LOGIC;BEGINclk_out1clk0,clear=reset,stop=pause,clk_out1=clk1,clk_out2=clk2);cat0led1led1led1led1led1led1led1led2led2led2led2led2led2led2led2led2led2led2figuresfiguresfigures=“0000000“;END CASE;END PROCESS p5;row=data;col=st1;d0=“0000000001111111
3、“WHEN pic = “00000“ELSE“0000100001110111“WHEN pic = “00001“ELSE“0000110001110011“WHEN pic = “00010“ELSE“0001110001100011“WHEN pic = “00011“ELSE“0001111001100001“WHEN pic = “00100“ELSE“0011111001000001“WHEN pic = “00101“ELSE“0011111101000000“WHEN pic = “00110“ELSE“0111111100000000“WHEN pic = “00111“E
4、LSE“0111111100000000“WHEN pic = “01000“ELSE“0111111100000000“WHEN pic = “01001“ELSE“0111111100000000“WHEN pic = “01010“ELSE“0111111100000000“WHEN pic = “01011“ELSE“0111111100000000“WHEN pic = “01100“ELSE“0111111100000000“WHEN pic = “01101“ELSE“0111111100000000“WHEN pic = “01110“ELSE“0111111100000000
5、“WHEN pic = “01111“ELSE“0111111100000000“WHEN pic = “10000“ELSE“0000000000000000“;d1=“0000000000111110“WHEN pic = “00000“ELSE“0000000000111110“WHEN pic = “00001“ELSE“0000000000111110“WHEN pic = “00010“ELSE“0000000000111110“WHEN pic = “00011“ELSE“0000000000111110“WHEN pic = “00100“ELSE“00000000001111
6、10“WHEN pic = “00101“ELSE“0000000000111110“WHEN pic = “00110“ELSE“0000000000111110“WHEN pic = “00111“ELSE“0000100000110110“WHEN pic = “01000“ELSE“0000110000110010“WHEN pic = “01001“ELSE“0001110000100010“WHEN pic = “01010“ELSE“0001111000100000“WHEN pic = “01011“ELSE“0011111000000000“WHEN pic = “01100
7、“ELSE“0011111000000000“WHEN pic = “01101“ELSE“0011111000000000“WHEN pic = “01110“ELSE“0011111000000000“WHEN pic = “01111“ELSE“0011111000000000“WHEN pic = “10000“ELSE“0000000000000000“;d2=“0000000000011100“WHEN pic = “00000“ELSE“0000000000011100“WHEN pic = “00001“ELSE“0000000000011100“WHEN pic = “000
8、10“ELSE“0000000000011100“WHEN pic = “00011“ELSE“0000000000011100“WHEN pic = “00100“ELSE“0000000000011100“WHEN pic = “00101“ELSE“0000000000011100“WHEN pic = “00110“ELSE“0000000000011100“WHEN pic = “00111“ELSE“0000000000011100“WHEN pic = “01000“ELSE“0000000000011100“WHEN pic = “01001“ELSE“000000000001
9、1100“WHEN pic = “01010“ELSE“0000000000011100“WHEN pic = “01011“ELSE“0000000000011100“WHEN pic = “01100“ELSE“0000100000010100“WHEN pic = “01101“ELSE“0000110000010000“WHEN pic = “01110“ELSE“0001110000000000“WHEN pic = “01111“ELSE“0001110000000000“WHEN pic = “10000“ELSE“0000000000000000“;d3=“0000000000
10、001000“WHEN pic = “00000“ELSE“0000000000001000“WHEN pic = “00001“ELSE“0000000000001000“WHEN pic = “00010“ELSE“0000000000001000“WHEN pic = “00011“ELSE“0000000000001000“WHEN pic = “00100“ELSE“0000000000001000“WHEN pic = “00101“ELSE“0000000000001000“WHEN pic = “00110“ELSE“0000000000001000“WHEN pic = “0
11、0111“ELSE“0000000000001000“WHEN pic = “01000“ELSE“0000000000001000“WHEN pic = “01001“ELSE“0000000000001000“WHEN pic = “01010“ELSE“0000000000001000“WHEN pic = “01011“ELSE“0000000000001000“WHEN pic = “01100“ELSE“0000000000001000“WHEN pic = “01101“ELSE“0000000000001000“WHEN pic = “01110“ELSE“0000000000
12、001000“WHEN pic = “01111“ELSE“0000100000000000“WHEN pic = “10000“ELSE“0000000000000000“;d4=“0000100000000000“WHEN pic = “00000“ELSE“0000100000000000“WHEN pic = “00001“ELSE“0000100000000000“WHEN pic = “00010“ELSE“0000100000000000“WHEN pic = “00011“ELSE“0000100000000000“WHEN pic = “00100“ELSE“00001000
13、00000000“WHEN pic = “00101“ELSE“0000100000000000“WHEN pic = “00110“ELSE“0000100000000000“WHEN pic = “00111“ELSE“0000100000000000“WHEN pic = “01000“ELSE“0000100000000000“WHEN pic = “01001“ELSE“0000100000000000“WHEN pic = “01010“ELSE“0000100000000000“WHEN pic = “01011“ELSE“0000100000000000“WHEN pic =
14、“01100“ELSE“0000100000000000“WHEN pic = “01101“ELSE“0000100000000000“WHEN pic = “01110“ELSE“0000100000000000“WHEN pic = “01111“ELSE“0000000000001000“WHEN pic = “10000“ELSE“0000000000000000“;d5=“0001110000000000“WHEN pic = “00000“ELSE“0001110000000000“WHEN pic = “00001“ELSE“0001110000000000“WHEN pic
15、= “00010“ELSE“0001110000000000“WHEN pic = “00011“ELSE“0001110000000000“WHEN pic = “00100“ELSE“0001110000000000“WHEN pic = “00101“ELSE“0001110000000000“WHEN pic = “00110“ELSE“0001110000000000“WHEN pic = “00111“ELSE“0001110000000000“WHEN pic = “01000“ELSE“0001110000000000“WHEN pic = “01001“ELSE“000111
16、0000000000“WHEN pic = “01010“ELSE“0001110000000000“WHEN pic = “01011“ELSE“0001110000000000“WHEN pic = “01100“ELSE“0001010000001000“WHEN pic = “01101“ELSE“0001000000001100“WHEN pic = “01110“ELSE“0000000000011100“WHEN pic = “01111“ELSE“0000000000011100“WHEN pic = “10000“ELSE“0000000000000000“;d6=“0011
17、111000000000“WHEN pic = “00000“ELSE“0011111000000000“WHEN pic = “00001“ELSE“0011111000000000“WHEN pic = “00010“ELSE“0011111000000000“WHEN pic = “00011“ELSE“0011111000000000“WHEN pic = “00100“ELSE“0011111000000000“WHEN pic = “00101“ELSE“0011111000000000“WHEN pic = “00110“ELSE“0011111000000000“WHEN pi
18、c = “00111“ELSE“0011011000001000“WHEN pic = “01000“ELSE“0011001000001100“WHEN pic = “01001“ELSE“0010001000011100“WHEN pic = “01010“ELSE“0010000000011110“WHEN pic = “01011“ELSE“0000000000111110“WHEN pic = “01100“ELSE“0000000000111110“WHEN pic = “01101“ELSE“0000000000111110“WHEN pic = “01110“ELSE“0000
19、000000111110“WHEN pic = “01111“ELSE“0000000000111110“WHEN pic = “10000“ELSE“0000000000000000“;d7=“0111111100000000“WHEN pic = “00000“ELSE“0111011100001000“WHEN pic = “00001“ELSE“0111001100001100“WHEN pic = “00010“ELSE“0110001100011100“WHEN pic = “00011“ELSE“0110000100011110“WHEN pic = “00100“ELSE“01
20、00000100111110“WHEN pic = “00101“ELSE“0100000000111111“WHEN pic = “00110“ELSE“0000000001111111“WHEN pic = “00111“ELSE“0000000001111111“WHEN pic = “01000“ELSE“0000000001111111“WHEN pic = “01001“ELSE“0000000001111111“WHEN pic = “01010“ELSE“0000000001111111“WHEN pic = “01011“ELSE“0000000001111111“WHEN
21、pic = “01100“ELSE“0000000001111111“WHEN pic = “01101“ELSE“0000000001111111“WHEN pic = “01110“ELSE“0000000001111111“WHEN pic = “01111“ELSE“0000000001111111“WHEN pic = “10000“ELSE“0000000000000000“;p6:PROCESS(clk1,reset)BEGINIF reset = 1 THENst1=“00000000“;ELSIF clk1event AND clk1 = 1 THENIF st1 = “00
22、000000“ OR st1 = “01111111“ THENst1=“11111110“; data=d0;ELSIF st1 = “11111110“ THENst1=“11111101“; data=d1;ELSIF st1 = “11111101“ THENst1=“11111011“; data=d2;ELSIF st1 = “11111011“ THENst1=“11110111“; data=d3;ELSIF st1 = “11110111“ THENst1=“11101111“; data=d4;ELSIF st1 = “11101111“ THENst1=“11011111
23、“; data=d5;ELSIF st1 = “11011111“ THENst1=“10111111“; data=d6;ELSIF st1 = “10111111“ THENst1=“01111111“; data=d7;END IF;END IF;END PROCESS p6;p7:process(clk2,reset,pause)BEGINIF reset = 1 THENpic=“00000“;ELSIF clk2event AND clk2 =1 THENIF dir = 0 THENIF pic /= “10000“ THENpic=pic+1;END IF;ELSEIF pic /= “00000“ THENpic=pic-1;END IF;END IF;END IF;END PROCESS p7; END b;