EDA技术课程实验报告.docx
- 文档编号:25270333
- 上传时间:2023-06-06
- 格式:DOCX
- 页数:11
- 大小:161.10KB
EDA技术课程实验报告.docx
《EDA技术课程实验报告.docx》由会员分享,可在线阅读,更多相关《EDA技术课程实验报告.docx(11页珍藏版)》请在冰豆网上搜索。
EDA技术课程实验报告
实验1:
熟悉QUZRTUS的安装及编程环境,调试简单程序并仿真
程序清单:
ENTITYmux21aIS
PORT(a,b:
INBIT;
s:
INBIT;
y:
OUTBIT);
ENDENTITYmux21a;
ARCHITECTUREoneOFmux21aIS
BEGIN
y<=aWHENs='0'ELSEb;
ENDARCHITECTUREone;
实验仿真结果:
实验2:
在进程中对变量及信号赋值,观察其时序差异
程序清单(i):
libraryieee;
useieee.std_logic_1164.all;
entitydff1is
port(clk,d1:
instd_logic;
q1:
outstd_logic);
end;
architecturebhvofdff1is
signala,b:
std_logic;
begin
process(clk)
begin
ifclk'eventandclk='1'then
a<=d1;
b<=a;
q1<=b;
endif;
endprocess;
end;
实验仿真结果(i):
程序清单(ii):
libraryieee;
useieee.std_logic_1164.all;
entitydff2is
port(clk,d1:
instd_logic;
q1:
outstd_logic);
end;
architecturebhvofdff2is
begin
process(clk)
variablea,b:
std_logic;
begin
ifclk'eventandclk='1'then
a:
=d1;
b:
=a;
q1<=b;
endif;
endprocess;
end;
实验仿真结果(ii):
小结:
时序仿真时,信号和变量均无延迟;功能仿真时,信号有延迟,延迟几个时钟周期,而变量无延迟。
实验3:
用元件例化实现加法器功能,并仿真
程序清单(i):
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
ENTITYh_adderIS
PORT(a,b:
INSTD_LOGIC;
co,so:
OUTSTD_LOGIC);
ENDh_adder;
ARCHITECTUREfh1OFh_adderIS
BEGIN
so<=NOT(aXOR(NOTb));
co<=aANDb;
ENDfh1;
程序清单(ii):
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
ENTITYor2aIS
PORT(a,b:
INSTD_LOGIC;
c:
OUTSTD_LOGIC);
ENDENTITYor2a;
ARCHITECTUREoneOFor2aIS
BEGIN
c<=aORb;
ENDone;
程序清单(iii):
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
ENTITYf_adderIS
PORT(ain,bin,cin:
INSTD_LOGIC;
cout,sum:
OUTSTD_LOGIC);
ENDf_adder;
ARCHITECTUREfd1OFf_adderIS
COMPONENTh_adder
PORT(a,b:
INSTD_LOGIC;
co,so:
OUTSTD_LOGIC);
ENDCOMPONENT;
COMPONENTor2a
PORT(a,b:
INSTD_LOGIC;
c:
OUTSTD_LOGIC);
ENDCOMPONENT;
SIGNALd,e,f:
STD_LOGIC;
BEGIN
u1:
h_adderPORTMAP(a=>ain,b=>bin,co=>d,so=>e);
u2:
h_adderPORTMAP(a=>e,b=>cin,co=>f,so=>sum);
u3:
or2aPORTMAP(a=>d,b=>f,c=>cout);
ENDfd1;
实验仿真结果:
实验4:
用图形输入法实现元件的调用
程序图
(1):
程序图
(2):
实验仿真结果:
小结:
图形输入法和元件例化的用法差异,
实验5:
宏模块应用
程序清单:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitysingtis
port(clk:
instd_logic;
dout:
outstd_logic_vector(7downto0));
end;
architecturedaccofsingtis
componentlym_rom
port(address:
instd_logic_vector(5downto0);
inclock:
instd_logic;
q:
outstd_logic_vector(7downto0));
endcomponent;
signalq1:
std_logic_vector(5downto0);
begin
process(clk)
begin
ifclk'eventandclk='1'thenq1<=q1+1;
endif;
endprocess;
u1:
lym_romportmap(address=>q1,q=>dout,inclock=>clk);
end;
实验仿真结果
实验6:
状态机应用
程序清单:
libraryieee;
useieee.std_logic_1164.all;
entitys_machineis
port(clk,reset:
instd_logic;
state_inputs:
instd_logic_vector(0to1);
comb_outputs:
outintegerrange0to15);
ends_machine;
architecturebehavofs_machineis
typefsm_stis(s0,s1,s2,s3);
signalcurrent_state,next_state:
fsm_st;
begin
reg:
process(reset,clk)
begin
ifreset='1'thencurrent_state<=s0;
elsifclk='1'andclk'eventthen
current_state<=next_state;
endif;
endprocess;
com:
process(current_state,state_inputs)
begin
casecurrent_stateis
whens0=>comb_outputs<=5;
ifstate_inputs="00"thennext_state<=s0;
elsenext_state<=s1;
endif;
whens1=>comb_outputs<=8;
ifstate_inputs="00"thennext_state<=s1;
elsenext_state<=s2;
endif;
whens2=>comb_outputs<=12;
ifstate_inputs="11"thennext_state<=s0;
elsenext_state<=s3;
endif;
whens3=>comb_outputs<=14;
ifstate_inputs="11"thennext_state<=s3;
elsenext_state<=s0;
endif;
endcase;
endprocess;
end;
实验仿真结果:
状态图:
实验7:
试验箱硬件验证
程序要求:
完成跑马灯程序编写。
其输入信号为:
clk,rst,control,输出信号共计8位,要求输入当control为‘1’时跑马灯左转,为‘0’时跑马灯右转。
当clr为‘1’时灯全灭。
程序清单:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitypmdis
port(clk,rst,control:
instd_logic;
led:
outstd_logic_vector(7downto0));
end;
architectureoneofpmdis
signallamp:
std_logic_vector(7downto0);
signalcount:
std_logic_vector(2downto0);
begin
process(clk,rst,control,count,lamp)
begin
ifrst='1'thenlamp<=(others=>'0');
elsifclk'eventandclk='1'then
ifcontrol='0'thencount<=count+1;
elsecount<=count-1;
endif;
endif;
ifrst='0'then
casecountis
when"000"=>lamp<="00000001";
when"001"=>lamp<="00000010";
when"010"=>lamp<="00000100";
when"011"=>lamp<="00001000";
when"100"=>lamp<="00010000";
when"101"=>lamp<="00100000";
when"110"=>lamp<="01000000";
when"111"=>lamp<="10000000";
whenothers=>null;
endcase;
endif;
endprocess;
led(7downto0)<=lamp(7downto0);
end;
实验仿真结果:
课程总结:
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- EDA 技术 课程 实验 报告