eda技术总实验报告(编辑修改稿)内容摘要:

制计数器电路组成。 在整个时钟中最关键的是如何获得一个精确的 1HZ计时脉冲, 数字时钟显示由时( 24 进制)、分( 60 进制)、秒( 60 进制)组成,利用扫描显示译码电路在八个数码管显示。 数字时钟组成及功能: 分频率器:用来产生 1HZ计时脉冲; 二十四进制计数器:对时进行计数 六十进制计数器:对分和秒进行计数; 扫描显示译码器:完成对 7字段数码管显示的控制; 报时器:完成到时的提醒; 设计内 容及步骤: 根据电路持点,用层次设计概念。 将此设计任务分成若干模块,规定每一模块的功能和各模块之间的接口,同时加深层次化设计概念; 软件的元件管理深层含义,以及模块元件之间的连接概念,对于不同目录下的同一设计,如何熔合; 适配划分前后的仿真内容有何不同概念,仿真信号对象有何不同,有更深一步了解。 熟悉了 CPLD/FPGA设计的调试过程中手段的多样化; 按适配划分后的管脚定位,同相关功能块硬件电路接口连线; 所有模块尽量采用 VHDL语言设计。 要求: 精确显示时、分、秒。 数字时钟要求:具有对时、分、秒置数功能(利用秒脉冲置数、键盘直接置数); 能够完成整点报时功能。 二、数字时钟设计方案 设计方案方框图 功能设计 时钟计数:完成时、分、秒的正确计时并且显示所计的数字;对秒、分 60进制计数,即从 0到 59循环计数,对时 24进制计数,即从 0到 23 循环计数。 CLK 信号端 使能控制端 RESET 复位端 FPGA 芯片 时钟程序 整点报时 数码管显示 秒显示 分显示 时显示 时间设置:手动调节分钟( setfen)、小时( setshi),低电平时有效,可以对分、时进行进位调节,高电平时正常计数。 这样可以对所设计的时钟 的时间任意调。 清零功能: reset 为复位端,低电平时实现清零功能,高电平时正常计数。 这样可以对所设计的时钟的时间进行清零处理。 整点报时功能:当分由 59 进位时,会在整点报时输出端输出高电平,此信号通过LED点亮检验。 三、数字时钟计数报时 VHDL 程序设计仿真与分析 秒计数器( miao)设计 秒计数器( miao) VHDL 程序描述 library ieee。 use。 use。 entity miao is port( clk,reset,setfen:in std_logic。 enfen:out std_logic。 countmiao:out std_logic_vector(7 downto 0) )。 end miao。 architecture fun of miao is signal count:std_logic_vector(7 downto 0)。 signal enfen_1,enfen_2:std_logic。 begin countmiao=count。 enfen_2=((not setfen) and clk)。 enfen=(enfen_1 or enfen_2)。 process(clk,reset,setfen) begin if(reset=39。 039。 ) then count=00000000。 enfen_1=39。 039。 elsif(clk39。 event and clk=39。 139。 ) then if(count(3 downto 0)=1001) then if(count01100000) then if(count=01011001) then count=00000000。 enfen_1=39。 139。 else count=count+7。 end if。 else count=00000000。 enfen_1=39。 039。 end if。 elsif(count01100000) then count=count+1。 enfen_1=39。 039。 else count=00000000。 end if。 end if。 end process。 end fun。 秒计数器( miao)仿真波形图 秒计数器( miao)仿真分析 随着 clk脉冲信号的不断到来, countmiao记录出 clk的脉冲个数,计数到 59时,在下一个 clk 脉冲信号到来时,输出端 enfen 输出高定平,即向分进位,同时 countmiao清零。 reset为清零端,当 reset低电平时, countmiao计数从零重新开始计数。 setfen为分的手动进位端,当 setfen低电平时且 clk 脉冲到来时,输出 enfen 高电平,向分进位。 分计数器( fen)设计 分计数器( fen) VHDL 程序描述 library ieee。 use。 use。 entity fen is port( imiao,clk,reset,setshi:in std_logic。 enshi:out std_logic。 countfen:out std_logic_vector(7 downto 0) )。 end fen。 architecture fun of fen is signal enshi_1,enshi_2:std_logic。 signal count:std_logic_vector(7 downto 0)。 begin countfen=count。 enshi_2=((not setshi) and clk)。 enshi=(enshi_1 or enshi_2)。 process(imiao,reset,setshi) begin if(reset=39。 039。 ) then count=00000000。 elsif(imiao39。 event and imiao=39。 139。 ) then if(count(3 downto 0)=1001) then if(count1660) then if(count=01011001) then count=00000000。 enshi_1=39。 139。 else count=count+7。 end if。 else count=00000000。 end if。 elsif(count01100000) then count=count+1。 enshi_1=39。 039。 else count=00000000。 end if。 end if。 end process。 end fun。 分计数器( fen)仿真波形图 分计数器( fen)仿真分析 imiao 为秒计数器的 enfen进位输出端,当 enfen( imiao)高电平到来时,且 clk高电平时, countfen开始计数。 countfen计数到 59 时,下一个 enfen( imiao)、 clk到来时, enshi高电平,即向时进位,同时 countfen清零。 reset为清零端,当 reset低电平时, countfen计数从零重新开始计数。 setshi为时的手动进位端,当 setshi低电平时且 clk 脉冲到来时,输出 enshi 时高电平,向时进位。 时计数器( shi)设计 时计数器( shi) vHDL 程序描述 library ieee。 use。 use。 entity shi is port( ifen,reset:in std_logic。 countshi:out std_logic_vector(7 downto 0) )。 end shi。 architecture fun of shi is signal count:std_logic_vector(7 downto 0)。 begin countshi=count。 process(ifen,reset) begin if(reset=39。 039。 ) then count=00000000。 elsif(ifen39。 event and ifen=39。 139。 ) then if(count(3 downto 0)=1001) then if(count00100011) then count=count+7。 else count=00000000。 end if。 elsif(count00100011) then count=count+1。 else count=00000000。 end if。 end if。 end process。 end fun。 时计数器( shi)仿真波形图 时计数器( shi)仿真分析 ifen为分计数器的 enshi进位输出端,当 enshi( ifen)为高电平时, countshi计数。 countshi计数到 23时,当下一个 enshi( ifen)、 clk到来时, countshi会自动清零。 reset为清零端,当 reset低电平时, countfen计数从零重新开始计数。 整点报时器( baoshi)设计 整点报时器( baoshi) VHDL 程序描述 library ieee。 use。 use。 entity baoshi is port( clk:in std_logic。 inputmiao,inputfen:in std_logic_vector(7 downto 0)。 output:out std_logic )。 end baoshi。 architecture fun of baoshi is signal temp:std_logic。 signal nummiao,numfen:std_logic_vector(7 downto 0)。 begin nummiao=inputmiao。 numfen=inputfen。 output=temp。 process(clk,temp) begin if(clk39。 event and clk=39。 139。 ) then if(numfen=01011001) then case nummiao is when01011001=temp=39。 139。 when others=temp=39。 039。 end case。 end if。 if(numfen=00000000) then case nummiao is when00000000=temp=39。 139。 when others=temp=39。 039。 end case。 end if。 end if。 end process。 end fun。 整点报时器( baoshi)仿真波形图 整点报时器( baoshi)仿真分析 input为分计数器的输出端,当输出 59和 00(十六进制)时,整点报时器( baoshi)的输出端 output为高电平,点亮 LED灯。 其他情况时, LED灯均不发光。 四、数字时钟的驱动与显示设计 分 频器( fenpin)设计 分频器( fenpin)原理 由于 EDA 实验箱中的脉冲信号源为 10kHz,要得到需要脉冲可以通过定义count std_logic_vector(13 downto 0),使 count 在 “ 00000000000000”和“ 10011100001111”之间的转换实现。 在实验中,时钟脉冲 clk 为 1Hz,用于对时钟的记数;扫描显示译码器的脉 冲 clk,用来驱动 8 个 7 段扫描共阴级数码显示管。 扫描显示译码器的脉冲。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。