新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > 基于FPGA的数字秒表设计与仿真

基于FPGA的数字秒表设计与仿真

作者:时间:2012-12-27来源:网络收藏

when “0101”=>dataoutput=“0100100”;

when “0110”=>dataoutput=“0100000”;

when “0111”=>dataoutput=“0001111”;

when “1000”=>dataoutput=“0000000”;

when “1001”=>dataoutput=“0000100”;

when others=>dataoutput=“1111111”;

end case;

end process;

3 功能验证以及下载实现

完成以上各个子模块的后,该的模块就基本完成了,剩下的工作就是通过一个顶层文件将各个子模块连接起来。在顶层文件中可以将以上各个子模块看作一个个黑匣子,只将其输入输出端对应相连就可以了。下面是该顶层文件的VHDL源程序:

architecture Behavioral of topfile is

signal clk:std_logic:='0';

signal enableout:std_logic:='0';

signal data0,data1,data2,

data3,data4,data5:std_logic_vector(3

downto 0):=“0000”;

component abc

port(clk:in std_logic;

dout:out std_logic);

end component;

component enable

port(enablein:in std_logic;

enableout:out std_logic);

end component;

component highlevel

port(rst,clk,clear:in std_logic;

output1,output2,output3,

output4,output5,output6:out

std_logic_vector(3 downto 0);

carryout:out std_logic);

end component;

component yima

port(datainput:in std_logic_vector(3 downto 0);

dataoutput: out std_logic_vector(6 downto 0));

end component;

begin

u0:abc port map(clkin,clk);

u1:enable port map(enablein,enableout);

u2:highlevel port map(enableout,clk,clear,data0,data1,data2,data3,data4,data5);

u3:yima port map(data0,dataout0);

u4:yima port map(data1,dataout1);

u5:yima port map(data2,dataout2);

u6:yima port map(data3,dataout3);

u7:yima port map(data4,dataout4);

u8:yima port map(data5,dataout5);

end Behavioral;

由于各个子模块都已经经过验证无误,并且顶层文件中不涉及复杂的时序关系,相当于只是将各个模块用导线连接起来,只要各个端口的连接对应正确即可,所以不需写专门的test bench进行验证。完成以上后,即可进行逻辑综合,综合无误后进行管脚适配,生成。bit文件然后下载到实验板上测试。经过反复多次测试,以上设计完全满足了预期的设计指标,开始/停止按键和清零按键都能准确的控制秒表的运行,七段显示数码管也能够准确的显示计时结果。通过与标准秒表对比,该设计的计时误差在0.03s以内,而这其中也包括实验板上晶振由于长期使用所带来的误差。

4 结束语

本文所介绍设计方法,采用了当下最流行的EDA设计手段。在Xinlinx 开发环境下,采用至上而下的模块化设计方法,使得系统开发速度快、成本低、系统性能大幅度提升。通过实验验证,本文设计的计时准确、性能稳定,可以很容易嵌入其他复杂的数字系统,充当计时模块。

利用EDA设计工具,结合的可编程实验板,轻松实现电子芯片的设计,现场观察实验结果,大大缩短了产品的设计周期和调试周期,提高了设计的可靠性和成功率,体现了逻辑器件在数字设计中优越性。


上一页 1 2 下一页

评论


相关推荐

技术专区

关闭