【正文】
library ieee。 use 。 use 。 entity 6 is port(res,clk : in std_logic。 cout : out std_logic_vector(2 downto 0))。 end 6。 architecture rtl of 6 is signal q : std_logic_vector(2 downto 0)。 begin process(res,clk) begin if res=39。039。 then q=000。 elsif(clk39。event and clk=39。139。) then if(q=5) then q=000。 else q=q+1。 end if。 end if。 end process。 cout=q。 end rtl。 SEL61模塊的設(shè)計 更多論文 5 即六選一選擇器,如圖 13所示,對于給定的信號,輸出對應(yīng)的數(shù),送到 七段碼譯碼器。 圖 13 library ieee。 use 。 entity sel61 is port(sel : in std_logic_vector(2 downto 0)。 a,b,c,d,e,f : in std_logic_vector(3 downto 0)。 q : out std_logic_vector(3 downto 0))。 end。 architecture rtl of sel61 is begin process(a,b,c,d,e,f,sel) variable cout : std_logic_vector(3 downto 0)。 begin case sel is when 000=cout:=a。 when 001=cout:=b。 when 010=cout:=c。 when 011=cout:=d。 when 100=cout:=e。 when others=cout:=f。 end case。 q =cout。 end process。 更多論文 6 end rtl。 DISP 模塊的設(shè)計 即七段譯碼器,如圖 14所示,對于輸入的 4位 BCD碼進(jìn)行譯碼,輸出 7位 , Q0~Q6分別外接數(shù)碼管 a~g段顯示。 圖 14 library ieee。 use 。 entity disp is port(d : in std_logic_vector(3 downto 0)。 q : out std_logic_vector(6 downto 0))。 end。 architecture one of disp is begin process(d) begin case d is when 0000=q=0111111。 when 0001=q=0000110。 when 0010=q=1011011。 when 0011=q=1001111。 when 0100=q=1100110。 when 0101=q=1101101。 when0110=q=1111101。 when 01