求程序:pld课程要求用vhdl设计时钟,只要能调表清零,在七段译码管显示。

来源:百度知道 编辑:UC知道 时间:2024/05/31 04:36:18
求程序:pld课程要求用vhdl设计时钟,只要能调表清零,在七段译码管显示。软件是maxplusII
可以分别编写:cnt24 cnt60 cnt1000 display clk_c de4_7然后连起来
也可以直接自顶向下编写。谢谢,我的邮箱:wqi9992004@163.com

数字钟的VHDL设计
1、设计任务及要求:
设计任务:设计一台能显示时、分、秒的数字钟。具体要求如下:
由实验箱上的时钟信号经分频产生秒脉冲;
计时计数器用24进制计时电路;
可手动校时,能分别进行时、分的校正;
整点报时;

2 程序代码及相应波形
Second1(秒计数 6进制和10进制)
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
Entity second1 is
Port( clks,clr:in std_logic;
Secs,Secg: out std_logic_vector(3 downto 0);
cout1:out std_logic);
End second1;
Architecture a of second1 is
Begin
Process(clks,clr)
variable ss,sg: std_logic_vector(3 downto 0);
variable co: std_logic;
Begin
If clr='1' then ss:="0000"; sg:="0000";
Elsif clks'event and clks='1' then
if ss="0101" and sg="1001" then ss:="0000"; sg:="0000";co:='1';
elsif sg<"1001" then sg:=sg+1;co:='0';
elsif sg="1001" then sg:="0000";ss:=ss+1;co