微机接口实验报告3and4.docx
- 文档编号:29586187
- 上传时间:2023-07-24
- 格式:DOCX
- 页数:16
- 大小:308.69KB
微机接口实验报告3and4.docx
《微机接口实验报告3and4.docx》由会员分享,可在线阅读,更多相关《微机接口实验报告3and4.docx(16页珍藏版)》请在冰豆网上搜索。
微机接口实验报告3and4
微机接口技术实验报告
I/O地址译码器的VHDL设计
与
简易中断优先权分析器的VHDL设计
系别:
计算机科学与技术
完成时间:
2012-6-4
实验一:
I/O地址译码器的VHDL设计
一:
实验题目与要求:
使用一片74LS00(4X二输入与非门),一片74LS30(八输入与非门)和一片74LS138(3-8译码器)设计一个固定地址译码器.
1)使用10位地址线(A0–A9)
2)译码器对以下8个地址段产生CS信号:
280H—287H,288H—28FH,290H—297H,298H—29FH2A0H—2A7H,2A8H—2AFH,2B0H—2B7H,2B8H—2BFH
3)控制信号AEN,IOR,IOW(三个信号均为低电平有效)参与译码,可实现对指定单元的读写.
要求:
1)所有地址段的CS信号,都要经过仿真验证.
2)验证控制信号AEN,IOR,IOW的作用.
二:
实验电路图
三:
实验源代码:
libraryieee;
useieee.std_Logic_1164.all;
entityaddressis
port(
addr:
instd_Logic_Vector(3to9);
aen,iow,ior:
instd_Logic;
cs:
outstd_Logic_Vector(7downto0)
);
endaddress;
architectureaddress_bodyofaddressis
signalen:
std_Logic;
signalout_temp:
std_Logic_Vector(7downto0);
begin
out_temp(7downto0)<=
"11111110"whenaddr(3to5)="000"else
"11111101"whenaddr(3to5)="001"else
"11111011"whenaddr(3to5)="010"else
"11110111"whenaddr(3to5)="011"else
"11101111"whenaddr(3to5)="100"else
"11011111"whenaddr(3to5)="101"else
"10111111"whenaddr(3to5)="110"else
"01111111"whenaddr(3to5)="111";
process(addr,aen,iow,ior,out_temp,en)
begin
en<=not((notaddr(6))andaddr(7)and(not(addr(8)))andaddr(9)and(notaen)and(not(iowandior)));--八输入与非,四个二输入与非
foriin7downto0loop
cs(i)<=out_temp(i)oren;--更新cs(i)用新的值和旧的值相或
endloop;
endprocess;
endarchitectureaddress_body;
测试源代码:
--------------------------------------------------------------------------------
--Company:
--Engineer:
--
--CreateDate:
19:
01:
3305/29/2012
--DesignName:
--ModuleName:
D:
/interface/wangyang/test.vhd
--ProjectName:
wangyang
--TargetDevice:
--Toolversions:
--Description:
--
--VHDLTestBenchCreatedbyISEformodule:
address
--
--Dependencies:
--
--Revision:
--Revision0.01-FileCreated
--AdditionalComments:
--
--Notes:
--Thistestbenchhasbeenautomaticallygeneratedusingtypesstd_logicand
--std_logic_vectorfortheportsoftheunitundertest.Xilinxrecommends
--thatthesetypesalwaysbeusedforthetop-levelI/Oofadesigninorder
--toguaranteethatthetestbenchwillbindcorrectlytothepost-implementation
--simulationmodel.
--------------------------------------------------------------------------------
LIBRARYieee;
USEieee.std_logic_1164.ALL;
--Uncommentthefollowinglibrarydeclarationifusing
--arithmeticfunctionswithSignedorUnsignedvalues
--USEieee.numeric_std.ALL;
ENTITYtestIS
ENDtest;
ARCHITECTUREbehaviorOFtestIS
--ComponentDeclarationfortheUnitUnderTest(UUT)
COMPONENTaddress
PORT(
addr:
INstd_logic_vector(3to9);
aen:
INstd_logic;
iow:
INstd_logic;
ior:
INstd_logic;
cs:
OUTstd_logic_vector(7downto0)
);
ENDCOMPONENT;
--Inputs
signaladdr:
std_logic_vector(3to9):
=(others=>'0');
signalaen:
std_logic:
='0';
signaliow:
std_logic:
='0';
signalior:
std_logic:
='0';
--Outputs
signalcs:
std_logic_vector(7downto0);
--Noclocksdetectedinportlist.Replace
--appropriateportname
constantperiod:
time:
=10ns;
BEGIN
--InstantiatetheUnitUnderTest(UUT)
uut:
addressPORTMAP(
addr=>addr,
aen=>aen,
iow=>iow,
ior=>ior,
cs=>cs
);
--Clockprocessdefinitions
--Stimulusprocess
stim_proc:
process
begin
--holdresetstatefor100ns.
waitfor100ns;
addr<="0000101";
aen<='0';
iow<='1';
ior<='0';
waitfor100ns;
addr<="0010101";
aen<='0';
iow<='1';
ior<='0';
waitfor100ns;
addr<="0100101";
aen<='0';
iow<='1';
ior<='0';
waitfor100ns;
addr<="0110101";
aen<='0';
iow<='1';
ior<='0';
waitfor100ns;
addr<="1000101";
aen<='0';
iow<='1';
ior<='0';
waitforperiod*10;
addr<="1010101";
aen<='0';
iow<='1';
ior<='0';
waitfor100ns;
addr<="1100101";
aen<='0';
iow<='1';
ior<='0';
waitfor100ns;
addr<="1110101";
aen<='0';
iow<='1';
ior<='0';
--insertstimulushere
wait;
endprocess;
END;
四:
实验结果截图:
五:
实验体会:
通过此次实验,学会了ISE的基本使用方法,学会了基本的接口电路的设计,学会了建立工程、接口电路或功能模块的设计方法,通过仿真进行验证,设计综合和查看综合结果,通过测试文件证明vhdl的正确性,对接口课程的理解也加深了。
实验二:
简易中断优先权分析器的VHDL设计
一:
实验题目与要求:
1)参考教材8259A优先权分析器逻辑框图.
2)不考虑IMR屏蔽功能,8路中断直接进入优先权分析器.
3)ISR的内容以3位二进制编码,从外部输入比较器
4)不考虑多重中断.既假定每次只有一个中断发生.
要求:
1)仿真验证优先权分析器的实际效果.
二:
实验原理及电路图:
1:
8259A的内部结构框图:
8259A的电路原理图:
三:
实验源代码:
libraryieee;
useieee.std_Logic_1164.all;
entityaddressis
port(
ir:
instd_Logic_Vector(7downto0);
isr:
instd_Logic_Vector(2downto0);
--addr:
instd_Logic_Vector(7downto0);
d_int:
outstd_Logic
);
endaddress;
architectureaddress_bodyofaddressis
signaltmp:
std_Logic_Vector(7downto0);
signalir_code:
std_Logic_Vector(2downto0);
signalint1:
std_Logic;
signalint2:
std_Logic;
begin
ir_code(2downto0)<=
"000"whenir(7downto0)="00000001"else
"001"whenir(7downto0)="00000010"else
"010"whenir(7downto0)="00000100"else
"011"whenir(7downto0)="00001000"else
"100"whenir(7downto0)="00010000"else
"101"whenir(7downto0)="00100000"else
"110"whenir(7downto0)="01000000"else
"111"whenir(7downto0)="10000000";
process(isr,ir,int1,int2)
begin
if(isr>ir_code)then
int1<='1';
elseint1<='0';
endif;
int2<='0';
foriin7downto0loop
int2<=tmp(i)orir(i)orint2;
endloop;
d_int<=int2andint1;
endprocess;
endarchitectureaddress_body;
测试程序源代码:
--------------------------------------------------------------------------------
--Company:
--Engineer:
--
--CreateDate:
21:
15:
5405/29/2012
--DesignName:
--ModuleName:
D:
/interface/wangyang2/testbench33.vhd
--ProjectName:
wangyang2
--TargetDevice:
--Toolversions:
--Description:
--
--VHDLTestBenchCreatedbyISEformodule:
address
--
--Dependencies:
--
--Revision:
--Revision0.01-FileCreated
--AdditionalComments:
--
--Notes:
--Thistestbenchhasbeenautomaticallygeneratedusingtypesstd_logicand
--std_logic_vectorfortheportsoftheunitundertest.Xilinxrecommends
--thatthesetypesalwaysbeusedforthetop-levelI/Oofadesigninorder
--toguaranteethatthetestbenchwillbindcorrectlytothepost-implementation
--simulationmodel.
--------------------------------------------------------------------------------
LIBRARYieee;
USEieee.std_logic_1164.ALL;
--Uncommentthefollowinglibrarydeclarationifusing
--arithmeticfunctionswithSignedorUnsignedvalues
--USEieee.numeric_std.ALL;
ENTITYtestbench33IS
ENDtestbench33;
ARCHITECTUREbehaviorOFtestbench33IS
--ComponentDeclarationfortheUnitUnderTest(UUT)
COMPONENTaddress
PORT(
ir:
INstd_logic_vector(7downto0);
isr:
INstd_logic_vector(2downto0);
d_int:
OUTstd_logic
);
ENDCOMPONENT;
--Inputs
signalir:
std_logic_vector(7downto0):
=(others=>'0');
signalisr:
std_logic_vector(2downto0):
=(others=>'0');
--Outputs
signald_int:
std_logic;
--Noclocksdetectedinportlist.Replace
--appropriateportname
constantperiod:
time:
=10ns;
BEGIN
--InstantiatetheUnitUnderTest(UUT)
uut:
addressPORTMAP(
ir=>ir,
isr=>isr,
d_int=>d_int
);
--Clockprocessdefinitions
--Stimulusprocess
stim_proc:
process
begin
--holdresetstatefor100ns.
isr<="000",
"010"after50ns,
"000"after100ns,
"001"after150ns,
"111"after200ns,
"110"after350ns;
ir<="00000001",
"00000100"after50ns,
"00000010"after100ns,
"00001000"after150ns,
"00010000"after200ns,
"00100000"after250ns,
"01000000"after300ns,
"10000000"after350ns;
--insertstimulushere
wait;
endprocess;
END;
四:
实验结果截图:
五:
实验体会:
通过此次实验,对8259A的认识更加深刻,能够利用Vhdl语言设计简单的中断优先权分析器,对8259A的工作方式,操作指令字,内部结构,引脚,以及编程都有了不少认识。
锻炼了分析问题和综合解决问题的能力,对接口课程的学习有了实践上的帮助,对理论进行了证实,也增加了团队合作能力和沟通能力。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 微机 接口 实验 报告 and4