综合成绩
优秀( )良( )
中等( )格( )
格( )
教师(签名)
批改日期
EDA技术课程设计报告
课题: 数字电子钟逻辑电路设计
院系 电子电气工程学院
专业 电气工程动化
班级 学号
姓名
指导教师
起止日期 2014121820141219
2014年 X 月
目录
课程设计务求 1
11实验目 1
12功设计 1
二整体设计思想 1
21性指标功设计 1
22总体方框 2
23FPGA芯片介绍 2
三编译调试 3
31数字钟基工作原理: 3
311调时调分信号产生 3
312计数显示电路 4
32设计思路 4
33设计步骤 5
331工程建立存盘 5
332工程项目编译 5
333时序仿真 6
334引脚锁定 6
335硬件测试 6
336实验结果 7
四程序设计 8
五实验电路图 16
51实验原理图 16
52 PCB图 16
六心体会 17
七 参考文献 18
课程设计务求
11实验目
1)掌握VHDL语言基运
2)掌握QuartusII简单操作会EDA实验箱
3)掌握基EDA课程设计操作
12功设计
求显示格式时-分钟-秒钟整点报时报时时间5 秒整点前5 秒钟开始进行报时提示LED 开始闪烁整点停止闪烁调整时间键键模块S1 S2S1 调节时次时增加时S2 调整分钟次分钟增加分钟外S8 键作系统时钟复位复位全部显示00-00-00
二整体设计思想
21性指标功设计
1)时分秒计时器
时计时器24进制计数器分秒计时器均60进制计数器秒计时器接受秒脉时秒计数器开始00计数59时秒显示器显示0001025900秒计数器数00时会产生脉输出送分计时器时分计数器数值原基础加1显示器显示0001025900分计数器数00时会产生脉输出送时计时器时时计数器数值原基础加1显示器显示0001022300
2)校时电路
开关拨校时档时电子钟秒计时工作通时分校时开关分时分进行校开关1次开关应时分计数器加1调需时分时拨动reset开关电子钟设置时间开始计时
22总体方框
23FPGA芯片介绍
SOPCNIOSII EDASOPC实验开发系统根现代电子发展方集EDASOPC系统开发体综合性实验开发系统满足高校专科生研究生SOPC教学实验开发外电子设计电子项目开发理想工具整开发系统核心板SOPCNiosIIEP2C35系统板扩展板构成根户需求配置成开发系统
SOPCNiosIIEP2C35开发板长期户需求考察结合目前市面实际应需时兼顾入门学生资深开发工程师应需求研发资源言已组成高性嵌入式系统运行目前流行RTOSuCOSuClinux等系统芯片采672引脚BGA封装EP2C35 FPGA拥33216LE105M4K片RAM(计483840bits)3518×18硬件法器4高性PLL达475户定义IO板提供容量SRAMSDRAMFlash ROM等常RS232USB20 RJ45接口标准音频接口等板已固定连接IO达260IO通接插件引出供户性言系统灵活性言您初学者资深硬件工程师会成您帮手图23示:
图23FPGA系统功框图
三编译调试
31数字钟基工作原理:
311调时调分信号产生
计数器计数程知正常计数时秒计数器(60进制)计数59 时脉秒计数器清零重新开始新轮计数进位作分计数器计数脉分计数器计数加1现电路稍做变动:秒计数器进位脉频率2Hz脉信号时接2选1数选择器两数输入端位选信号接脉键开关键开关时(0)数选择器秒计数器进位脉送分计数器时数字钟正常工作键开关时(1)数选择器外2Hz 信号作分计数器计数脉计数频率加快达正确时间时松开键开关达调时目调节时时间样实现
312计数显示电路
计数部分数选择器译码器组成时钟关键部分
1计数部分:两60进制计数器24 进制计数器组成中60 进制计数器6 进制计数器10 进制计数器构成24 进制时计数样6 进制计数器10 进制计数器:计数器计数24 时24时进行清零实现24 进制计数
2数选择器:84 输入14 输出路数选择器实验8数码(两产生隔离符号—’)
3译码器:七段译码器译码器必须译出—’实验二中译码器真值表:字母F 8421BCD 码1111译码1000111现果译出—’字母F中间横译码应0000001样数码显示—’
32设计思路
根系统设计求系统设计采顶设计方法时钟分频部分计时部分键部分调时部分显示部分五部分组成模块放顶层文件中
1)时钟计数:
首先载程序进行复位清零操作电子钟00:00:00计时开始setshi调整时钟时部分 setfen调整分钟步进1
6位数码分显示时分秒通OUTPUT( 6 DOWNTO 0 )信号点亮指定LED七段显示数码
2) 时间设置:
手动调节分钟时设计时钟意调时间样数字钟真正具功通实验板S2S1进行意调整时钟信号均1HZLED灯变化次脉计数次
3)清零功:
S8复位键低电时实现清零功高电时正常计数根意时间复位
33设计步骤
331工程建立存盘
1.开 QuartusⅡ单击File菜单选择 File→New Project Wizard话框:分输入项目工作路径项目名实体名单击Finish
2单击File菜单选择New弹出话框双击VHDL File选中文编辑方式出现Vhdl1vhd文编辑窗中键入VHDL程序输入完毕选择File→Save As出现Save As话框选择建立存放文件目录然文件名框中键入文件名Save钮
3 建立工程项目保存VHDL文件时会弹出否建立项目窗口点击Yes确定出现建立工程项目导航窗口点击Next出现屏幕中分键入新项目工作路径项目名实体名注意原理图输入设计方法中存盘原理图文件名意VHDL程序文存盘文件名必须文件实体名致输入单击Finish钮
332工程项目编译
单击工具条编译符号开始编译着进度断变化屏幕编译完成屏幕图示:
333时序仿真
建立波形文件:选择 File→NewNew窗中选中Other File标签出现屏幕中选择Vector Waveform File项出现新屏幕出现新屏幕中双击Name方空白处弹出Insert Nod or Bus话框单击该话框Node Finder……屏幕中 Filter 中选择 Pins单击List单击>>输入输出拷贝右边侧正希引脚选中部分根实际情况决定然单击屏幕右脚 OK出现屏幕单击OK
设定仿真时间宽度选择 Edit → End time…选项End time选择窗中选择适仿真时间域便足够长观察时间
波形文件存盘选择File→Save as 选项直接存盘
运行仿真器菜单中选择项直出现仿真结束
334引脚锁定
设计编程载进选定目标器件中EPF10K10作进步硬件测试设计输入输出引脚分目标器件EPF10K10部分引脚相接操作:
1.选择 Assignments → Assignments Editor 进入 Assignments Editor编辑器Category 栏选择 Pin直接单击右侧 Pin 钮
2.双击 TO 栏new出现拉栏中选择应端口信号名( D[0])然双击应栏new出现拉栏中选择应端口信号名期间引脚号
3.存储引脚锁定信息必须编译(启动 )次引脚锁定信息编译进编程载文件中准备编译 SOF 文件载试验系统FPGA中
335硬件测试
1首先载线计算机印机口目标板(开发板实验板)连接开电源
2开编辑窗配置文件选择弹出编辑窗Mode栏中选择JTAG选项方框勾注意核载文件路径文件名果文件没出现者出错单击左Add file侧钮手动选择配置文件 clock.sof
3单击载标符Start进入目标器件 FPGA 配置载操作 Progress 显示100底部处理栏中出现 Configuration Succeeded 时表示编程成功图示注意果必时次单击 Start 直编程成功
4.载完成通硬件测试进步确定设计否达技术指标未达逐步检查部分出现问题果代码出现问题须修改代码时序波形图问题须重新设置
336实验结果
键s8复位键键s1设置时键s2设置分钟载成功键s8六LED复位清零显示数秒动计时秒数满59进位分钟数满59进位显示xx5955时外接LED灯开始闪烁整点停止闪烁调试实物图图336示:
图336调试实物图
四程序设计
1 (1)秒计数器(miao)VHDL 程序描述
library ieee
use ieeestd_logic_1164all
use ieeestd_logic_unsignedall
entity miao is
port(
clkresetsetfenin std_logic
enfenout std_logic
countmiaoout std_logic_vector(7 downto 0)
)
end miao
architecture fun of miao is
signal countstd_logic_vector(7 downto 0)
signal enfen_1enfen_2std_logic
begin
countmiao
enfen<(enfen_1 or enfen_2)
process(clkresetsetfen)
begin
if(reset'0')
then count<00000000
enfen_1<'0'
elsif(clk'event and clk'1')
then if(count(3 downto 0)1001)
then if(count<16#60#)
then if(count01011001)
then count<00000000
enfen_1<'1'
else count
else count<00000000
enfen_1<'0'
end if
elsif(count<16#60#)
then count
else count<00000000
enfen_1<'1'
end if
end if
end process
end fun
(2)秒计数器(miao)仿真波形图
(3)秒计数器(miao)仿真分析
1着 clk 脉信号断countmiao 记录出 clk 脉数计数 59 时 clk 脉信号时输出端 enfen 输出高定分进 位时 countmiao 清零 2 reset 清零端 reset 低电时 countmiao 计数零重新开始计数 3setfen 分手动进位端 setfen 高定时 clk 脉时输出 enfen 高电分进位
2 (1)分计数器(fen)VHDL 程序描述
library ieee
use ieeestd_logic_1164all
use ieeestd_logic_unsignedall
entity fen is port(
imiaoclkresetsetshiin std_logic
enshiout std_logic
countfenout std_logic_vector(7 downto 0)
)
end fen
architecture fun of fen is signal enshi_1enshi_2std_logic signal countstd_logic_vector(7 downto 0)
begin
countfen
process(imiaoresetsetshi)
begin
if(reset'0') then
count<00000000
elsif(imiao'event and imiao'1') then
if(count(3 downto 0)1001) then
if(count<16#60#) then
if(count01011001) then
count<00000000
enshi_1<'1'
else count
end if
elsif(count<16#60#) then
count
else count<00000000
end if
end if
end process
end fun
(2)分计数器(fen)仿真波形图
(3)分计数器(fen)仿真分析
1imiao 秒计数器 enfen 进位输出端 enfen(imiao)高电 时 clk 高电时 countfen 开始计数 countfen 计数 59 时 enfen (imiao)clk 时enshi 高电时进位时 countfen 清零 2reset 清零端 reset 低电时countfen 计数零重新开始计数 3setshi 时手动进位端 setshi 高定时 clk 脉时输出 en 时高电时进位
3(1)时计数器(shi)VHDL 程序描述
library ieee
use ieeestd_logic_1164all
use ieeestd_logic_unsignedall
entity shi is
port(
ifenresetin std_logic
countshiout std_logic_vector(7 downto 0) )
end shi
architecture fun of shi is
signal countstd_logic_vector(7 downto 0)
begin countshi
begin
if(reset'0') then
count<00000000
elsif(ifen'event and ifen'1') then
if(count(3 downto 0)1001) then
if(count<16#23#) then count
end if
elsif(count<16#23#) then
count
end if
end if
end process
end fun
(2)时计数器(shi)仿真扫描显示译码器(saomiao)仿真
(3)时计数器(shi)仿真分析
1ifen 分计数器 enshi 进位输出端 enshi(ifen)高电时 countshi 计数countshi 计数 23 时 enshi(ifen)clk 时 countshi 会动清零 2reset 清零端 reset 低电时countfen 计数零重新开始计数
4整点报时
(1)整点报时器(baoshi)VHDL 程序描述
library ieee use ieeestd_logic_1164all
use ieeestd_logic_unsignedall
Entity baoshi is
port( clkin std_logic inputmiaoinputfenin std_logic_vector(6 downto 0)
outputout std_logic_vector(1 downto 0) )
end baoshi
architecture fun of baoshi is signal tempstd_logic_vector(1 downto 0)
signal nummiaonumfenstd_logic_vector(7 downto 0)
begin nummiao
if(clk'event and clk'1') then
if(numfen01011001) then
case nummiao is
when01011000>temp<01
when01011001>temp<10
when others>temp<00
end case
end if
if(numfen00000000) then
case nummiao is when00000000>temp<11
when others>temp<00
end case end if
end if end process
end fun 11
(2)整点报时器(baoshi)仿真波形图
(3)整点报时器(baoshi)仿真分析
input 分计数器输出端输出 5859 00(十六进制)时整点报 时器(baoshi)输出端 output 高电点亮 LED 灯 intput 5859 时点亮 LED 灯 input 00 时点亮两 LED 灯情况时LED 灯均发光
4 (1)分频器(fenpin)设计
library ieee
use ieeestd_logic_1164all
use ieeestd_logic_unsignedall entity fenpin is
port( clk_5Min std_logic
clkout std_logic )
end fenpin
architecture fun of fenpin is signal countstd_logic_vector(22 downto 0) begin
process(clk_5M)
begin
if (clk_5M'event and clk_5M'1') then
if(count10011000100101100111111) then
count<00000000000000000000000
clk<'1'
else count< count+1
clk<'0'
end if
end if
end process
end fun
5 (1)扫描显示译码器(saomiao))VHDL 程序描述
扫描显示译码器显示时钟数值装置数字时钟高低电信号 数码数值显示出八数码中六数码显示时分秒外两 做时分分秒间间隔始终显示 首先八数码进行扫描时刻数码处扫描状态 时数字时钟高低电通十六进制 BCD 码转换数码显示数值
library ieee
use ieeestd_logic_1164all
use ieeestd_logic_unsignedall
entity saomiao is
port(
clk_smxsin std_logic
shiin std_logic_vector(7 downto 0)
fenin std_logic_vector(7 downto 0)
miaoin std_logic_vector(7 downto 0)
seloutout std_logic_vector(7 downto 0)
segoutout std_logic_vector(6 downto 0) )
end saomiao
architecture fun of saomiao is
signal tempstd_logic_vector(2 downto 0)
signal segstd_logic_vector(6 downto 0)
signal selstd_logic_vector(7 downto 0)
begin
selout
variable numstd_logic_vector(3 downto 0)
begin
if (clk_smxs'event and clk_smxs'1' ) then if temp>111 then temp<000
else temp
case temp is when 111 >numshi(7 downto 4)
sel<00000111
when 110 >numshi(3 downto 0) sel<00000110
when 100 >numfen(7 downto 4)
sel<00000100
when 011 >numfen(3 downto 0) sel<00000011
when 001 >nummiao(7 downto 4)
sel<00000001
when 000 >nummiao(3 downto 0)
sel<00000000
when others>sel<00000010
end case
case num is when0000>seg<0111111
when0001>seg<0000110
when0010>seg<1011011
when0011>seg<1001111
when0100>seg<1100110
when0101>seg<1101101
when0110>seg<1111101
when0111>seg<0000111
when1000>seg<1111111
when1001>seg<1101111
when others>seg<0000000
end case
end if
end process
end fun
(2)扫描显示译码器(saomiao)仿真波形图
6数字时钟整体设计 数字时钟整体设计:
(1)数字时钟电路原理图:
(2)数字时钟电路仿真波形
五实验电路图
51实验原理图
52 PCB图
六 心体会
七 参考文献
[1]蒋立数字电路 北京:兵器工业出版社2008
[2]南京理工学电子技术中心EDA设计实验指导书2010
[3] 侯伯亨顾新VHDL硬件描述语言数字逻辑电路设计
西安:西安电子科技学出版社1999
[4]潘松黄继业EDA技术实教程北京:科学出版社2002
[5]卢杰赖毅VHDL数字电路设计北京:科学出版社2006
文档香网(httpswwwxiangdangnet)户传
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档