首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

求救:我们电子课程设计作一个数字钟,大家给看看

initial 是面向仿真的,好象不能综合
数字种的程序到处都是。都不用自己写
多多帮助
你的HDL跟所用的DEVICE是没有关系的。
你得在软件中指定你的FPGA就行了。

你的设计中有一些问题,最好所有的计数器使用同一个时钟,
这样出来的电路更稳定,不会有竞争问题。

因为使用FPGA,所以最好用one-hot的状态机。

[此贴子已经被作者于2005-3-16 16:16:14编辑过]

求救:我们电子课程设计作一个数字钟,大家给看看

用的芯片是altera的EP1K30TC144-3 作一个能显示时.分.秒的数字钟 有人用verilog编了一个程序 结果出来的device是max7000系列的 不能用 我又不会改 大家给看看吧 module Dclock(clkin, //时钟输入1M hour, //时输出 minute, //分输出 second, //秒输出 hourup, //时增加 hourdown, //时减少 minuteup, //分增加 minutedown, //分减少 alarm); //闹钟 input clkin,hourup,hourdown,minuteup,minutedown; output alarm; output [5:0] hour,minute,second; reg [5:0] hour,minute,second; reg [19:0] clkcounter; reg sclk; reg mclk; reg hclk; reg alarm; initial begin hour=0; minute=0; second=0; clkcounter=0; sclk=0; mclk=0; hclk=0; alarm=0; end ////输入1M的时钟产生周期1s的时钟信号 always @(posedge clkin) begin if(clkcounter==100) begin clkcounter<=0; sclk<=1; end else begin clkcounter<=clkcounter+1; sclk<=0; end end //////秒计数/////////////// always @(posedge sclk) begin if(second==60) begin second<=0; mclk<=1; end else begin second<=second+1; mclk<=0; end end ////分计数////////// always @(posedge mclk/* or posedge minuteup or posedge minutedown*/) begin if(minute==60) begin hclk<=1; minute<=0; end else begin hclk<=0; minute<=minute+1; end end //////时计数///////////////// always @(posedge hclk/* or posedge hourup or posedge hourdown*/) begin if(hour==24) begin hour<=0; end else begin hour<=hour+1; end end ////闹钟///////////////////// always @(posedge clkin) begin if(minuteup==0) begin if(minutedown==0) begin if(hourup==0) begin if(hourdown==0) begin case(minute) 55:begin if(clkcounter<50) alarm<=1; else alarm<=0; end 56:begin if(clkcounter<50) alarm<=1; else alarm<=0; end 57:begin if(clkcounter<50) alarm<=1; else alarm<=0; end 58:begin if(clkcounter<50) alarm<=1; else alarm<=0; end 59:begin if(clkcounter<50) alarm<=1; else alarm<=0; end 60:alarm<=1; default:alarm<=0; endcase end end end end end endmodule
恩,我们好象也做过,!我考试时还要自己现场编呢1!
请问数字钟的程序在哪可以找到?
顶!!!
southcreek说的有道理
返回列表