【正文】
ogic。 clk_minhz:in std_logic。 feilv:out std_logic_vector(7 downto 0) )。 end feilvqi。 architecture one of feilvqi is signal feilv1:std_logic_vector(7 downto 0)。 signal c:std_logic。 begin process(reset,clk_minhz) begin if reset=39。139。then feilv1=00000000。 elsif clk_minhz39。event and clk_minhz=39。139。then if feilv1(3 downto 0)=1001then feilv1(3 downto 0)=0000。 if feilv1(7 downto 4)=1001then feilv1(7 downto 4)=0000。 else feilv1(7 downto 4)=feilv1(7 downto 4)+1。 end if。 else feilv1 (3 downto 0)=feilv1(3 downto 0)+1。 end if。 end if。 feilv=feilv1。 end process。 end。 library ieee。 use 。 use 。 use 。 entity gundong is port (A,B:in std_logic。 data:in std_logic_vector(15 downto 0)。 chep:in std_logic_vector(11 downto 0)。 遼東學院信息技術學院 EDA課程設計報告 17 feilv:in std_logic_vector(7 downto 0)。 clk_200HZ,clk_1HZ: in std_logic。 sel:out std_logic_vector(7 downto 0)。 y:out std_logic_vector(3 downto 0))。 end。 architecture body_chooser of gundong is signal c:std_logic。 signal count:std_logic_vector(2 downto 0)。 signal t: std_logic_vector(3 downto 0)。 begin process(clk_200hz) begin process (A,B) begin if (A39。event and A=39。139。) then c=39。139。 end if。 if b=39。139。 then c=39。039。 end if。 end process。 process(clk_200HZ) begin if(clk_200Hz39。event and clk_200HZ=39。139。)then if count111 then count=count+1。 else count=000。 end if。 end if。 end process。 process(clk_1HZ) begin if clk_1HZ39。event and clk_1HZ=39。139。 THEN IF t1100 then t=t+1。 else t=0000。 end if。 end if。 end process。 process(c,t,count) begin if c=39。139。 then case count is when 000=y=0001。sel=00000001。 遼東學院信息技術學院 EDA課程設計報告 18 when001=y=data(11 downto 8)。sel=00010000。 when010=y=data(7 downto 4)。sel=00001000。 when011=y=data(3 downto 0)。sel=00000100。 when 001=y=1010。sel=00001000。 when100=y=chep(3 downto 0)。sel=00100000。 when101=y=chep(7 downto 4)。sel=01000000。 when110=y=chep(11 downto 8)。sel=10000000。 when others=null。 end case。 elsif t=0000 then case count is when 000=y=chep(11 downto 8)。sel=10000000。 when 001=y=chep(7 downto 4)。sel=01000000。 when 010=y=chep(3 downto 0)。sel=00100000。 when011=y=data(15 downto 12)。sel=00010000。 when100=y=data(11 downto 8)。sel=00001000。 when101=y=data(7 downto 4)。sel=00000100。 when110=y=data(3 downto 0)。sel=00000010。 when 111=y=0000。sel=00000001。 when others=null。 end case。 elsif t=0001 then case count is when000=y=feilv(3 downto 0)。sel=00000001。 when001=y=feilv(7 downto 4)。sel=00000010。 when others=null。 end case。 elsif t=0010 then elsif t=0011 then elsif t=0100 then elsif t=0101 then elsif t=0110 then elsif t=0111 then elsif t=1000 then elsif t=1001 then elsif t=1010 then elsif t=1011 then elsif t=1100 then case count is when000=y=1010。sel=10000000。 when001=y=chep(11 downto 8)。sel=01000000。 遼東學院信息技術學院 EDA課程設計報告 19 when010=y=chep(7 downto 4)。sel=00100000。 when011=y=chep(3 downto 0)。sel=00010000。 when100=y=1010。sel=00001000。 when101=y=data(15 downto 12)。sel=00000100。 when110=y=data(11 downto 8)。sel=00000010。 when111=y=data(7 downto 4)。sel=00000001。 when others=null。 end case。 end if。 end process。 end body_chooser。 library ieee。 use 。 use 。 entity ymq is port(y:in std_logic_vector(3 downto 0)。 led7s:out std_logic_vector(6 downto 0))。 end。 architecture one of ymq is begin process(y) begin case y is when0000=led7s=1000000。0 when0001=led7s=1111001。1 when0010=led7s=0100100。2 when0011=led7s=0110000。3 when0100=led7s=0011001。4 when0101=led7s=0010010。5 when0110=led7s=0000010。6 when0111=led7s=1111000。7 when1000=led7s=0000000。8 when1001=led7s=0010000。9 when others=null。 end case。 遼東學院信息技術學院 EDA課程設計報告 20 附錄 B 系統(tǒng)原理圖