EDA 电 子 设 计
实验报告
学院:
班级:
学号:
学生姓名:
指导教师:
实验二 Verilog HDL简单门电路的实现
实验内容:
参考相关资料,编写半加器、全加器、或非门、译码器的Verilog HDL程序,并实现其仿真;
1、半加器
module add_h(a,b,sum,cout);
input a,b;
output sum,cout;
and(cout,a,b);
xor(sum,a,b);
endmodule
2、全加器
Module add_fu(a,b,cin,sum,cout);
Input a,b,cin;
Output sum,cout;
Assign {cout,sum}=a+b+cin;
endmodule
3、或非门
module(a,b,out);
input a,b;
output out;
reg out;
always@(a,b)
begin
case({a,b})
2'b00: out=1'b0;
2'b01:out=1'b1;
2'b10:out=1'b1;
2'b11:out=1'b1;
default: out=1'b0;
endcase;
end
endmodule
4、译码器的Verilog HDL程序:
module decoder_38(out,key_in);
output[7:0] out; //3 8译码器输出有8钟状态,所以要8个LED灯。
//如果没有8个LED灯也没有关系,只是有的状态就看不到了
input[2:0] key_in; //(1 2 3)key1 key2 key3 作为数据输入
reg[7:0] out;
always @(key_in)
begin
case(key_in)
3'd0: out=8'b11111110; //LED作为状态显示,低电平有效
3'd1: out=8'b11111101;
3'd2: out=8'b11111011;
3'd3: out=8'b11110111;
3'd4: out=8'b11101111;
3'd5: out=8'b11011111;
3'd6: out=8'b10111111;
3'd7: out=8'b01111111;
endcase
end
endmodule
6、BCD 码—七段数码管显示译码
module decode4_7(decodeout,indec);
output[6:0] decodeout;
input[3:0] indec;
reg[6:0] decodeout;
always @(indec)
begin
case(indec) //用case 语句进行译码
4'd0:decodeout=7'b1111110;
4'd1:decodeout=7'b0110000;
4'd2:decodeout=7'b1101101;
4'd3:decodeout=7'b1111001;
4'd4:decodeout=7'b0110011;
4'd5:decodeout=7'b1011011;
4'd6:decodeout=7'b1011111;
4'd7:decodeout=7'b1110000;
4'd8:decodeout=7'b1111111;
4'd9:decodeout=7'b1111011;
default: decodeout=7'bx;
endcase
end
Endmodule
仿真:
实验三组合逻辑电路的Verilog HDL实现
实验内容:
1:参考相关资料,编写BCD-七段显示译码器、数据选择器、数据分配器、数字比较器的Verilog HDL程序,并实现其仿真;
2:在实验箱上设计八位七段数码管动态显示电路
1、BCD-七段显示译码器
module LED7(IN,led7);
input [3:0] IN; //定义LED7的4位数据输入端口
output [6:0] led7;// 定义LED7的7位数据输出端口
reg[6:0] led7; //定义一个模块内部的暂存变量
led7[6:0] always @(IN) begin //主块开始
case(IN)
4'b0000: led7<=7'b0111111;//输入为“0”时, 数码管显示“0”
4'b0001: led7<=7'b0000110;//以下同理
4'b0010: led7<=7'b1011011;
4'b0011: led7<=7'b1001111;
4'b0100: led7<=7'b1100110;
4'b0101: led7<=7'b1101101;
4'b0110: led7<=7'b1111101;
4'b0111: led7<=7'b0000111;
4'b1000: led7<=7'b1111111;
4'b1001: led7<=7'b1101111;
default: led7<=0; //输入不在“0—9”时,数码管显示“0”
endcase
end //主块结束
endmodule
2、数据选择器(4选1)
Module sele4_1(a,b,c,d,sel,f);
Input a,b,c,d;
Input [1:0]sel;
Output f;
Assign f=sele4_1_fun(a,b,c,d,sel);
Function sele4_1_fun;
Input a,b,c,d;
Input [1:0]sel;
Case(sel)
2’b00:sele4_1_fun=a;
2’b01:sele4_1_fun=b;
2’b10:sele4_1_fun=c;
2’b11:sele4_1_fun=d;
Endcase
Endfunction
Endmodule
3、数据分配器(8路)
module demux4(y0,y1,y2,y3,din,a);
output y0,y1,y2,y3;
input din;
input [1:0]a;
reg y0,y1,y2,y3;
always@(din,a)
begin
y0=0;
y1=0;
y2=0;
y3=0;
case(a[1:0])
2'b00:y0=din;
2'b01:y1=din;
2'b10:y2=din;
2'b11:y3=din;
default:;
endcase
end Endmodule
4、数字比较器(8位)
lLIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY comp4_1 IS
PORT(A:IN STD_LOGIC_VECTOR(3 DOWNTO 0);
B:IN STD_LOGIC_VECTOR(3 DOWNTO 0);
YA,YB,YC: OUT STD_LOGIC);
END comp4_1;
ARCHITECTURE behave OF comp4_1 IS
BEGIN
PROCESS (A,B)
BEGIN
IF (A > B) THEN
YA <='1';
YB <='0';
YC <='0';
ELSIF(A < B) THEN
YA <='0';
YB <='1';
YC <='0';
ELSE
YA <='0';
YB <='0';
YC <='1';
END IF;
END PROCESS;
END behave;
实验四时序逻辑电路的Verilog HDL实现
实验内容:
1:参考相关资料,编写JK触发器、8位数据锁存器、数据寄存器的Verilog HDL程序,并实现其仿真;
2:在实验箱上设计含异步清零和同步使能的计数器
1、JK触发器
module jkff_rs(clk,j,k,q,rs,set);
input clk,j,k,set,rs;output reg q;
always @(posedge clk or negedge rs or negedge set)
begin if(~rs) q<=1'b0;
else if(~set) q<=1'b1;
else case({j,k})
2'b00 : q<=q;
2'b01 : q<=1'b0;
2'b10 : q<=1'b1;
2'b11 : q<=~q;
default : q<=1'bx;
endcase
end
endmodule
2、8位数据锁存器
module latch_8(qout,data,clk);
output[7:0] qout;
input[7:0] data; input clk;
reg[7:0] qout;
always @(clk or data)
begin
if(clk) qout<=data;
end
endmodule
3、8位数据寄存器程序:
module latch_8(qout,data,clk);
output[7:0] qout;
input[7:0] data; input clk;
reg[7:0] qout;
always @(clk or data)
begin
if(clk) qout<=data;
end
endmodule
仿真:
实验总结:通过此门课程的学习,通过老师的讲解,我初步接触了Verilog HDL的语言,也学习了如何使用Quartus软件进行编程,编译,并进行仿真。这次EDA实践让我了解了现代数字电路系统设计相对于传统电子系统设计的模式的优势,采用模块法自顶向下设计的原则,一边设计一边调试,结构清晰,并且使系统的开发速度更快。对于VHDL 语言,它与以前学习的计算机C语言编程语言有一定的相似性,也有不同,有很多细节方面的东西需要我们注意,课后多熟悉、练习,不然就会有编译错误,影响编译效率。虽然这门课程已经结束,但是我将进一步的学习Verilog HDL语言的学习和Quartus软件的使用,因为我发现动手实验的过程中我收获颇丰。
第二篇:EDA实验报告
淮阴工学院
《EDA技术与应用》课程设计报告
选题名称: 电子时钟设计
系(院): 计算机工程学院
专 业:计算机科学与技术(嵌入式系统软件设计)
班 级: 嵌入式1102
姓 名: 李凤超 学 号: 1101306226
指导教师: 马岱
学年学期: 20## ~ 2013 学年 第 2 学期
2013 年 7 月 1 日
设计任务书
摘要: 随着大规模集成电路技术和计算机技术的不断发展,在涉及通信、国防、航天、医学、工业自动化、计算机应用、仪器仪表等领域的电子系统设计工作中,EDA技术的含量正以惊人的速度上升;电子类的高新技术项目的开发也逾益依赖于EDA技术的应用。即使是普通的电子产品的开发,EDA技术常常使一些原来的技术瓶颈得以轻松突破,从而使产品的开发周期大为缩短、性能价格比大幅提高。
本实验中我们运用EDA课程中所学的知识,设计了一个拥有时间校正和闹钟功能的24小时制多功能数字时钟,可以手动调时、分、秒。在整点或者半点时刻实现闹铃报时。通过本实验,我们初步了解EDA的设计过程;初步掌握用VHDL语言的设计方法和设计思想;初步熟悉QURTUS 6.0软件平台的编程和仿真,并通过实验板下载模拟实现初步了解了硬件实现的方法。
关键词:数字时钟、VHDL、 QURTUS 6.0
目 录
1课题综述............................................................... 1
1.1 课题意义...................................................................... 1
1.2 课题要求...................................................................... 1
2 系统分析............................................................... 2
2.1 基本原理...................................................................... 2
2.1 系统设计框图.................................................................. 2
3 软件设计............................................................... 3
3.1 计时显示模块.................................................................. 3
3.2 闹钟模块...................................................................... 5
3.3 时分校正模块.................................................................. 6
3.4 电路图及源程序................................................................ 8
4引脚配置及实验结果.................................................... 16
致谢.................................................................... 19
参考文献................................................................ 20
1课题综述
1.1 课题意义
随着大规模集成电路技术和计算机技术的不断发展,在涉及通信、国防、航天、医学、工业自动化、计算机应用、仪器仪表等领域的电子系统设计工作中,EDA技术的含量正以惊人的速度上升;电子类的高新技术项目的开发也逾益依赖于EDA技术的应用。即使是普通的电子产品的开发,EDA技术常常使一些原来的技术瓶颈得以轻松突破,从而使产品的开发周期大为缩短、性能价格比大幅提高。不言而喻,EDA技术将迅速成为电子设计领域中的极其重要的组成部分。
1.2 课题要求
1、计数24小时的时钟
2、六位数码管显示“时-分-秒”
3、带有闹钟功能;
4、时分校正
2 系统分析
2.1 基本原理
本次设计的多功能数字钟具有基本的计时功能和时间校正功能,同时可以进行定时闹铃。计时功能采用24小时计时,显示时、分、秒。其中分钟和秒模块采用60进制实现;小时设计了24进制的计数器.时间校正部分,分为时校时和分校时,分别通过控制时校正按钮和分校正按钮来实现.闹铃部分,先通过模式切换按钮进入闹钟定时,然后通过与时间校正相同的方法来进行闹铃时间的预置,当预置到达时间时,时钟将通过蜂鸣器进行闹铃。
2.1 系统设计框图
如图2-1:
图2-1
3软件设计
3.1 计时显示模块
(1) 计时功能采用24小时计时,显示时、分、秒。其中分钟和秒模块采用60进制实现;小时设计了24进制的计数器。图3-1为计时模块的元件符号。
md1: 模式选择 0为计时
dout:数码管输出
sel: 数码管选通
图3-1计时模块的元件符号
(2)程序代码:
--------------------------------数码管显示--------------------------
disp:process(sel,md1,hou1,hou2,min1,min2,sec1,sec2,seth1,seth2,setm1,setm2,sets1,sets2)
begin
if sel="101" then
case h1 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when others =>dout<="1000000";
end case;
elsif sel="100" then
case h2 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when "0110"=>dout<="1111101";
when "0111"=>dout<="0000111";
when "1000"=>dout<="1111111";
when "1001"=>dout<="1101111";
when others=>dout<="1000000";
end case;
elsif sel="011" then
case m1 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when others=>dout<="1000000";
end case;
elsif sel="010" then
case m2 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when "0110"=>dout<="1111101";
when "0111"=>dout<="0000111";
when "1000"=>dout<="1111111";
when "1001"=>dout<="1101111";
when others=>dout<="1000000";
end case;
elsif sel="001" then
case s1 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when others=>dout<="1000000";
end case;
elsif sel="000" then
case s2 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when "0110"=>dout<="1111101";
when "0111"=>dout<="0000111";
when "1000"=>dout<="1111111";
when "1001"=>dout<="1101111";
when others=>dout<="1000000";
end case;
end if;
if md1='0' then---------------计时时间显示和设置模式
h1<=hou1;h2<=hou2;
m1<=min1;m2<=min2;
s1<=sec1;s2<=sec2;
else -------------闹铃时间显示和设置模式
h1<=seth1;h2<=seth2;
m1<=setm1;m2<=setm2;
s1<=sets1;s2<=sets2;
end if;
end process disp;
3.2 闹钟模块
(1)闹铃部分,先通过模式切换按钮进入闹钟定时,然后通过与时间校正相同的方法来进行闹铃时间的预置,当达到整点时,时钟将通过蜂鸣器进行闹铃报时。图3-2是闹钟模块的元件符号。
图3-2 闹钟模块的元件符号
(2)程序代码:
---------------------------------------------闹铃--------------------------------------------------
speaker:process(clk1,hou1,hou2,min1,min2)
begin
if clk1'event and clk1='1'then
if seth1=hou1 and seth2=hou2 and setm1=min1 and setm2=min2 then
if(min2="1001"and min1="0110" and sec2="1001" and sec1="0110" )or ((min2="1001"and min1="010" and sec2="1001" and sec1="0110" ))
then
speak<='0';
else speak<='1';
end if;
end if;
end if;
end process speaker;
3.3 时分校正模块
(1)时间校正部分,为时分秒校时,分别通过控制时校正按钮和分校正按钮、秒校正按钮来实现。图3-3为校正时间元件符号。
SW5:校正秒
SW6:校正小时
SW7:校正分钟
图3-3 校正时间元件符号
(2)程序代码:
-------------------------------------------时间设置小时部分-----------------------------------------
sethour1:process(clk,seth2)
begin
if clk'event and clk='1' then
if seth1="0010"and seth2="0011" then
seth1<="0000";
elsif seth2="1001" then
seth1<=seth1+1;
end if;
end if;
end process sethour1;
-------------------------------------------
sethour2:process(clk,md1,md2,seth1)
begin
if clk'event and clk='1' then
if (seth1="0010"and seth2="0011")or seth2="1001"then
seth2<="0000";
elsif md1='1' and md2="10" then
seth2<=seth2+1;
end if;
end if;
end process sethour2;
-------------------------------------------时间设置分钟部分
setmin1:process(clk,setm1,setm2)
begin
if clk'event and clk='1' then
if setm1="0101"and setm2="1001"then
setm1<="0000";
elsif setm2="1001"then
setm1<=setm1+1;
end if;
end if;
end process setmin1;
----------------------------------------------
setmin2:process(clk,md1,md2,setm2)
begin
if clk'event and clk='1'then
if setm2="1001"then
setm2<="0000";
elsif md1='1' and md2="01"then
setm2<=setm2+1;
end if;
end if;
end process setmin2;
-------------------------------------------时间设置秒部分
setss1:process(clk,sets2)
begin
if clk'event and clk='1' then
if sets1="0101"and sets2="1001" then
sets1<="0000";
elsif sets2="1001"or (md1='0' and md2="011")then
sets1<=sets1+1;
end if;
end if;
end process setss1;
----------------------------------------------
setss2:process(clk,md1,md2)
begin
if clk'event and clk='1'then
if sets2/="1001" or (md1='1' and md2="011")then
sets2<=sets2+1;
else sets2<="0000";
end if;
end if;
end process setss2;
3.4 电路图及源程序
(1)电路图
图3-4 电子时钟电路图
(2)源程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity clock is
port(clk:in std_logic;----------------------时钟脉冲
clk1:in std_logic;---------------------数码管选通时钟脉冲
md1:in std_logic;----------------------模式选择:0为计时,1为闹钟
md2:in std_logic_vector(2 downto 0);---010为时校正(定时),001为分校正(定时)011为秒校正(定时)
speak:out std_logic;-------------------闹钟 0
dout:out std_logic_vector(6 downto 0);--数码管七段码输出
selout:out std_logic_vector(2 downto 0));---数码管选通输出
end clock;
architecture one of clock is
signal sel:std_logic_vector(2 downto 0);--------模6计数信号(数码管选通输入)
signal hou1:std_logic_vector(3 downto 0);-------小时十位
signal hou2:std_logic_vector(3 downto 0);-------小时个位
signal min1:std_logic_vector(3 downto 0);-------分钟十位
signal min2:std_logic_vector(3 downto 0);-------分钟个位
signal seth1:std_logic_vector(3 downto 0);------定时小时十位
signal seth2:std_logic_vector(3 downto 0);------定时小时个位
signal setm1:std_logic_vector(3 downto 0);------定时分钟十位
signal setm2:std_logic_vector(3 downto 0);------定时分钟个位
signal sets1:std_logic_vector(3 downto 0);------定时秒钟十位
signal sets2:std_logic_vector(3 downto 0);------定时秒钟个位
signal sec1:std_logic_vector(3 downto 0);-------秒十位
signal sec2:std_logic_vector(3 downto 0);-------秒个位
signal h1:std_logic_vector(3 downto 0); ------输出小时十位
signal h2:std_logic_vector(3 downto 0); ------输出小时个位
signal m1:std_logic_vector(3 downto 0); ------输出分钟十位
signal m2:std_logic_vector(3 downto 0); ------输出分钟个位
signal s1:std_logic_vector(3 downto 0); ------输出秒十位
signal s2:std_logic_vector(3 downto 0); ------输出秒个位
-------------------------------------------------
begin
----------------------------------------------模6计数(数码管选通)
choice:process(clk1)
begin
if clk1'event and clk1='1' then
if sel="101" then
sel<="000";
else
sel<=sel+1;
end if;
end if;
end process choice;
selout<=sel;
-----------------------------------------------小时十位
h110:process(clk,hou2,min1,min2,sec1,sec2,md1,md2)
begin
if clk'event and clk='1' then
if (hou1="0010" and hou2="0011")and(min1="0101" and min2="1001") and
(sec1="0101" and sec2="1001") then
hou1<="0000";
elsif hou1="0010"and hou2="0011"and md1='0' and md2="010" then hou1<="0000";
elsif (hou2="1001"and(min1="0101" and min2="1001") and (sec1="0101" and
sec2="1001"))or (hou2="1001"and md1='0' and md2="010") then
hou1<=hou1+1;
end if;
end if;
end process h110;
-----------------------------------------------小时个位
h220:process(clk,min1,min2,sec1,sec2,md1,md2,hou1)
begin
if clk'event and clk='1' then
if (hou1="0010" and hou2="0011")and(min1="0101" and min2="1001") and
(sec1="0101" and sec2="1001") then
hou2<="0000";
elsif hou2="1001"and(min1="0101" and min2="1001") and (sec1="0101" and
sec2="1001") then
hou2<="0000";
elsif (hou2="1001"and md1='0' and md2="10")or (hou1="0010"and hou2="0011"and md1='0' and md2="010") then
hou2<="0000";
elsif ((min1="0101" and min2="1001") and (sec1="0101" and sec2="1001"))or
(md1='0' and md2="010") then
hou2<=hou2+1;
end if;
end if;
end process h220;
-----------------------------------------------分钟十位
m110:process(clk,min2,sec1,sec2,md1,md2)
begin
if clk'event and clk='1' then
if (min1="0101" and min2="1001") and (sec1="0101" and sec2="1001") then
min1<="0000";
elsif min1="0101"and min2="1001"and (md1='0' and md2="001")then
min1<="0000";
elsif (min2="1001"and (sec1="0101" and sec2="1001")) or (min2="1001"and
md1='0' and md2="001")then
min1<=min1+1;
end if;
end if;
end process m110;
----------------------------------------------分钟个位
m220:process(clk,sec1,sec2,md1,md2)
begin
if clk'event and clk='1' then
if min2="1001"and (sec1="0101" and sec2="1001")then
min2<="0000";
elsif min2="1001"and (md1='0' and md2="001")then
min2<="0000";
elsif (sec1="0101" and sec2="1001") or(md1='0' and md2="001")then
min2<=min2+1;
end if;
end if;
end process m220;
---------------------------------------------秒十位
s110:process(clk,sec2,md1,md2)
begin
if clk'event and clk='1' then
if (sec1="0101" and sec2="1001")then
sec1<="0000";
elsif sec2="1001"or (md1='0' and md2="011")then
sec1<=sec1+1;
end if;
end if;
end process s110;
--------------------------------------------秒个位
s220:process(clk,md1,md2)
begin
if clk'event and clk='1' then
if (sec2/="1001" or(md1='0' and md2="011"))then sec2<=sec2+1;
else sec2<="0000";
end if;
end if;
end process s220;
-------------------------------------------时间设置小时部分
sethour1:process(clk,seth2)
begin
if clk'event and clk='1' then
if seth1="0010"and seth2="0011" then
seth1<="0000";
elsif seth2="1001" then
seth1<=seth1+1;
end if;
end if;
end process sethour1;
-------------------------------------------
sethour2:process(clk,md1,md2,seth1)
begin
if clk'event and clk='1' then
if (seth1="0010"and seth2="0011")or seth2="1001"then
seth2<="0000";
elsif md1='1' and md2="10" then
seth2<=seth2+1;
end if;
end if;
end process sethour2;
-------------------------------------------时间设置分钟部分
setmin1:process(clk,setm1,setm2)
begin
if clk'event and clk='1' then
if setm1="0101"and setm2="1001"then
setm1<="0000";
elsif setm2="1001"then
setm1<=setm1+1;
end if;
end if;
end process setmin1;
----------------------------------------------
setmin2:process(clk,md1,md2,setm2)
begin
if clk'event and clk='1'then
if setm2="1001"then
setm2<="0000";
elsif md1='1' and md2="01"then
setm2<=setm2+1;
end if;
end if;
end process setmin2;
-------------------------------------------时间设置秒部分
setss1:process(clk,sets2)
begin
if clk'event and clk='1' then
if sets1="0101"and sets2="1001" then
sets1<="0000";
elsif sets2="1001"or (md1='0' and md2="011")then
sets1<=sets1+1;
end if;
end if;
end process setss1;
----------------------------------------------
setss2:process(clk,md1,md2)
begin
if clk'event and clk='1'then
if sets2/="1001" or (md1='1' and md2="011")then
sets2<=sets2+1;
else sets2<="0000";
end if;
end if;
end process setss2;
---------------------------------------------闹铃
speaker:process(clk1,hou1,hou2,min1,min2)
begin
if clk1'event and clk1='1'then
if seth1=hou1 and seth2=hou2 and setm1=min1 and setm2=min2 then
if(min2="1001"and min1="0110" and sec2="1001" and sec1="0110" )or ((min2="1001"and min1="010" and sec2="1001" and sec1="0110" ))
then
speak<='0';
else speak<='1';
end if;
end if;
end if;
end process speaker;
-------------------------------------------数码管显示
disp:process(sel,md1,hou1,hou2,min1,min2,sec1,sec2,seth1,seth2,setm1,setm2,sets1,sets2)
begin
if sel="101" then
case h1 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when others =>dout<="1000000";
end case;
elsif sel="100" then
case h2 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when "0110"=>dout<="1111101";
when "0111"=>dout<="0000111";
when "1000"=>dout<="1111111";
when "1001"=>dout<="1101111";
when others=>dout<="1000000";
end case;
elsif sel="011" then
case m1 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when others=>dout<="1000000";
end case;
elsif sel="010" then
case m2 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when "0110"=>dout<="1111101";
when "0111"=>dout<="0000111";
when "1000"=>dout<="1111111";
when "1001"=>dout<="1101111";
when others=>dout<="1000000";
end case;
elsif sel="001" then
case s1 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when others=>dout<="1000000";
end case;
elsif sel="000" then
case s2 is
when "0000"=>dout<="0111111";
when "0001"=>dout<="0000110";
when "0010"=>dout<="1011011";
when "0011"=>dout<="1001111";
when "0100"=>dout<="1100110";
when "0101"=>dout<="1101101";
when "0110"=>dout<="1111101";
when "0111"=>dout<="0000111";
when "1000"=>dout<="1111111";
when "1001"=>dout<="1101111";
when others=>dout<="1000000";
end case;
end if;
if md1='0' then---------------计时时间显示和设置模式
h1<=hou1;h2<=hou2;
m1<=min1;m2<=min2;
s1<=sec1;s2<=sec2;
else -------------闹铃时间显示和设置模式
h1<=seth1;h2<=seth2;
m1<=setm1;m2<=setm2;
s1<=sets1;s2<=sets2;
end if;
end process disp;
end;
4引脚配置及实验结果
(1)引脚配置图,如图4-1所示:
图4-1 电子时钟的引脚配置图
(2)实验结果
1.电子时钟显示,如图4-2所示:
图4-2 电子时钟显示
2.当SW5SW6SW7=010,时校正显示,如图4-3所示:
图4-3 时校正显示
3.当SW5SW6SW7=001,分校正显示,如图4-4所示:
图4-4 分校正显示
4.当SW5SW6SW7=011,秒校正显示,如图4-5所示:
图4-5 秒校正显示
总结
在整个设计过程中,通过查阅相关资料,我们一步步建立了对EDA设计的理解。通过解决在编程、调试以及仿真过程中的种种问题,也加深了我们对软件设计环境的熟悉程度。
通过仿真,我们也感性地认识到了曾经忽视的问题,比如器件间信号传递的时延以及产生毛刺会对电路功能实现的影响。而最让我们印象深刻的是一点是,在编程当中,虽然某些程序的结构获得的效果以及软件仿真的结果是一致的,但在实际硬件实现是却会有很大的不同。
同时在编译仿真成功的条件下,对于引脚的设置也至关重要,正确的引脚设置,能保证程序功能的有效调试和运行。在实验中,通过查找相关芯片的引脚配置手册,成功的下载到实验箱,完成功能的硬件调试。而这一切,都让我们获益良多。
致谢
这次的EDA课程设计,使我收益颇丰,从查看硬件原理图到软件编程、硬件调试,中间遇到了很多问题,这促使我通过各种途径来解决问题:到图书馆查阅资料,上网搜索以及请教指导老师等等,克服了一个个的难题,最终做成了数字时钟的设计,
这次课程设计是本科学习阶段很有价值的理论与实践相结合的机会,这次课程设计能顺利完成,除了要感谢学校给我们这次实践的机会和良好的硬件设施外,我还要由衷的感谢一直陪伴在实验室的马岱老师孜孜不倦的教诲、细心的指导和耐心的讲解,以及同学的热情帮助,让我学会了很多东西。
这次EDA的课程设计,提高了我运用所学的专业基础课来解决实际问题的能力,学会了看电路图并设计软件,真正的做到了软硬件结合的能力。
参考文献
1 江国强.EDA技术与应用. 北京:电子工业出版社社,2012.7
2 李莉.电子设计自动化(EDA). 北京:中国电力出版社,2009.10
3 郭照南.电子技术与EDA技术课程设计 湖南:中南大学出版社 2010.4
4 夏路易.基于EDA的电子技术课程设计 北京:电子工业出版社 2009.1
5 曹昕燕.EDA技术实验与课程设计 北京 :清华大学出版社 2006.5
指导教师评语