数字时钟毕业设计说明书 下载本文

内容发布更新时间 : 2024/5/19 14:15:15星期一 下面是文章的全部内容请认真阅读。

中北大学2012届毕业设计说明书

end if; end if; end process; end;

图3.1 五万分频器电路模块符号

图3.2 五万分频器功能仿真波形

3.2 一千分频器电路实现

在这里我们设计了一千分频器电路模块。其对应的VHDL代码、模块符号及功能仿真波形分别如下:

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;

ENTITY FP1000 is port(fh:in std_logic; fl:buffer std_logic);

7

中北大学2012届毕业设计说明书

end;

architecture one of FP1000 is

signal m0,m1,m2:std_logic_vector(3 downto 0); begin process(fh) begin

if fh'event and fh='1' then if m0<\

elsif m1<\elsif m2<\

then m2<=m2+1;m1<=\

else m1<=\end if; end if; end process; end;

图3.3 一千分频器电路模块符号

图3.4一千分频器功能仿真波形

8

中北大学2012届毕业设计说明书

4 计数电路实现

计数电路的功能是分别对秒、分、时的计数。秒计数电路或分计数电路为六十进制计数器,时计数电路为二十四进制计数器。

4.1 秒计数器电路的实现

在这里我们设计了秒计数电路模块。其对应的VHDL代码、模块符号及功能仿真波形分别如下:

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;

ENTITY con60f is port(clk,reset:in bit;

q0,q1:out std_logic_vector(3 downto 0); carry:out std_logic); end;

architecture one of con60f is

signal m0,m1:std_logic_vector(3 downto 0); begin

process(clk,reset) begin

if reset='0'then m0<=\elsif clk'event and clk='1' then if m0=\ m1<=\

elsif m0=\else m0<=m0+1;carry<='0'; end if;

9

中北大学2012届毕业设计说明书

end if; end process; q0<=m0;q1<=m1; end;

图4.1 秒计数电路模块符号

图4.2 秒计数电路功能仿真波形

4.2 分计数器电路的实现

在这里我们设计了秒计数电路模块。其对应的VHDL代码、模块符号及功能仿真波形分别如下:

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; ENTITY con60m is

10

中北大学2012届毕业设计说明书

port(clk,reset,en:in bit;

q0,q1:out std_logic_vector(3 downto 0); carry:out std_logic); end;

ARCHITECTURE one of con60m is signal m0,m1:std_logic_vector(3 downto 0); begin

process(clk,reset,en) begin

if reset='0'then m0<=\elsif clk'event and clk='1' then if en='1'then

if m0=\ m1<=\

elsif m0=\else m0<=m0+1;carry<='0'; end if; end if; end if; end process; q0<=m0;q1<=m1; end;

图4.3 分计数器电路模块符号

11