数字秒表设计程序

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_unsigned.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
ENTITY PAOBIAO IS
PORT(
CLK,CLR,PAUSE:IN STD_LOGIC;
cs1:OUT std_logic_vector(6 DOWNTO 0);
cs2:OUT std_logic_vector(6 DOWNTO 0);
s1:OUT std_logic_vector(6 DOWNTO 0);
s2:OUT std_logic_vector(6 DOWNTO 0);
m1:OUT std_logic_vector(6 DOWNTO 0);
m2:OUT std_logic_vector(6 DOWNTO 0)); END PAOBIAO;
ARCHITECTURE PAOBIAO_ARCH OF PAOBIAO IS
signal ics1,ics2,is1,im1:UNSIGNED (3 DOWNTO 0);
signal is2,im2:UNSIGNED (2 DOWNTO 0);
BEGIN
PROCESS(CLK,ics1,ics2,is1,im1,is2,im2)
BEGIN
IF (CLK'EVENT AND CLK='1') THEN
IF CLR='1' THEN
ics1<=(others=>'0');ics2<=(others=>'0');is1<=(others=>'0');im1<=(o thers=>'0');is2<=(others=>'0');im2<=(others=>'0');
ELSIF PAUSE='0' THEN
IF (ics1=9) then ics1<=(others=>'0');
IF (ics2=9) then ics2<=(others=>'0');
IF (is1=9) then is1<=(others=>'0');
IF (is2=5) then is2<=(others=>'0');
IF (im1=9) then im1<=(others=>'0');
IF (im2=5) then
ics1<=(others=>'0');ics2<=(others=>'0');is1<=(others=>'0');im1<=(o thers=>'0');is2<=(others=>'0');im2<=(others=>'0');
ELSE im2<=im2+1;END IF;
ELSE im1<=im1+1;END IF;
ELSE is2<=is2+1;END IF;
ELSE is1<=is1+1;END IF;
ELSE ics2<=ics2+1;END IF;
ELSE ics1<=ics1+1; END IF;
ELSE
ics1<=ics1;ics2<=ics2;is1<=is1;im1<=im1;is2<=is2;im2<=im2;
END IF;
END IF;
CASE ics1 is
WHEN "0000" => cs1<="1111110"; WHEN "0001" => cs1<="0110000"; WHEN "0010" => cs1<="1101101"; WHEN "0011" => cs1<="1111001"; WHEN "0100" => cs1<="0110011"; WHEN "0101" => cs1<="1011011"; WHEN "0110" => cs1<="1011111"; WHEN "0111" => cs1<="1110000"; WHEN "1000" => cs1<="1111111"; WHEN "1001" => cs1<="1111011"; WHEN OTHERS =>null;
END CASE;
CASE ics2 is
WHEN "0000" => cs2<="1111110"; WHEN "0001" => cs2<="0110000"; WHEN "0010" => cs2<="1101101"; WHEN "0011" => cs2<="1111001"; WHEN "0100" => cs2<="0110011"; WHEN "0101" => cs2<="1011011"; WHEN "0110" => cs2<="1011111"; WHEN "0111" => cs2<="1110000";
WHEN "1001" => cs2<="1111011"; WHEN OTHERS =>null;
END CASE;
CASE is1 is
WHEN "0000" => s1<="1111110"; WHEN "0001" => s1<="0110000"; WHEN "0010" => s1<="1101101"; WHEN "0011" => s1<="1111001"; WHEN "0100" => s1<="0110011"; WHEN "0101" => s1<="1011011"; WHEN "0110" => s1<="1011111"; WHEN "0111" => s1<="1110000"; WHEN "1000" => s1<="1111111"; WHEN "1001" => s1<="1111011"; WHEN OTHERS =>null;
END CASE;
CASE is2 is
WHEN "000" => s2<="1111110"; WHEN "001" => s2<="0110000"; WHEN "010" => s2<="1101101"; WHEN "011" => s2<="1111001";
WHEN "101" => s2<="1011011"; WHEN OTHERS =>null;
END CASE;
CASE im1 is
WHEN "0000" => m1<="1111110"; WHEN "0001" => m1<="0110000"; WHEN "0010" => m1<="1101101"; WHEN "0011" => m1<="1111001"; WHEN "0100" => m1<="0110011"; WHEN "0101" => m1<="1011011"; WHEN "0110" => m1<="1011111"; WHEN "0111" => m1<="1110000"; WHEN "1000" => m1<="1111111"; WHEN "1001" => m1<="1111011"; WHEN OTHERS =>null;
END CASE;
CASE im2 is
WHEN "000" => m2<="1111110"; WHEN "001" => m2<="0110000"; WHEN "010" => m2<="1101101"; WHEN "011" => m2<="1111001";
WHEN "101" => m2<="1011011";
WHEN OTHERS =>null;
END CASE;
END PROCESS;
END PAOBIAO_ARCH;。

相关文档
最新文档