




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
libraryieee; useieee.std_logic_1164.all; useieee.std_logic_arith.all; useieee.std_logic_unsigned.all; -FPGA内部寄存器地址定义: packageinterfaceis constantaddr_reg1:std_logic_vector(9downto0):=0000000000; constantaddr_reg2:std_logic_vector(9downto0):=0000000001; constantaddr_reg3:std_logic_vector(9downto0):=0000000010; constantaddr_reg4:std_logic_vector(9downto0):=0000000011; end; libraryieee; useieee.std_logic_1164.all; useieee.std_logic_arith.all; useieee.std_logic_unsigned.all; erface.all; entityarm_fpgais port( mcudata:inoutstd_logic_vector(7downto0);-8位数据 mcuaddress:instd_logic_vector(9downto0);-10位地址 wr:instd_logic;-写信号 rd:instd_logic; cs:instd_logic; led:outstd_logic_vector(7downto0); end; architecturearmfpgaofarm_fpgais signaladdresstemp:std_logic_vector(9downto0);-内部寄存器 signaldatatemp1,datatemp2,datatemp3,datatemp4:std_logic_vector(7downto0); signalwr_en,rd_en:std_logic;-读写使能 begin addresstemp=mcuaddress; wr_en=(wrandrd)orwr; rd_en datatemp1 datatemp2 datatemp3 datatemp4null; endcase; endif; endif; endprocess; -ARM从FPGA读取数据: process(rd,rd_en) begin ifrdeventandrd=0then ifcs=0andrd_en=0then caseaddresstempis whenaddr_reg1= mcudata mcudata mcudata mcudatanull; endcase; endif; endif; endprocess; led=mcudata;-验证传输数据,LED显示 end;-mcufpga.vhd libraryieee; useieee.std_logic_1164.all; useieee.std_logic_arith.all; useieee.std_logic_unsigned.all; -FPGA内部寄存器地址定义: packageinterfaceis constantaddr_reg1:std_logic_vector(9downto0):=0000000000; constantaddr_reg2:std_logic_vector(9downto0):=0000000001; constantaddr_reg3:std_logic_vector(9downto0):=0000000010; constantaddr_reg4:std_logic_vector(9downto0):=0000000011; end; libraryieee; useieee.std_logic_1164.all; useieee.std_logic_arith.all; useieee.std_logic_unsigned.all; erface.all; entityarm_fpgais port( mcudata:inoutstd_logic_vector(7downto0);-8位数据 mcuaddress:instd_logic_vector(9downto0);-10位地址 wr:instd_logic;-写信号 rd:instd_logic; cs:instd_logic; led:outstd_logic_vector(7downto0); end; architecturearmfpgaofarm_fpgais signaladdresstemp:std_logic_vector(9downto0);-内部寄存器 signaldatatemp:std_logic_vector(31downto0); -signalwr_en,rd_en:std_logic;-读写使能 begin addresstemp=mcuaddress; -ARM写数据到FPGA: process(wr,cs) begin -datatemp1datatemp(7downto0)datatemp(15downto8)datatemp(23downto16)datatemp(31downto24)null; endcase; endif; endprocess; -ARM从FPGA读取数据: process(rd,cs) begin ifrdeventandrd=0andcs=0then -caseaddresstempis -whenaddr_reg1=mcudatamcudatamcudatamcudatamcudata=ZZZZZZZZ; mcudata= datatemp(7downto0)when(addresstemp=addr_reg1)else datatemp(15downto8)when(addresstemp=addr_reg2)else datatemp(23downto16)when(addresstemp=addr_reg3)else datatemp(31downto24)when(addresstemp=addr_reg4)else ZZZZZZZZ; endcase; endif; endprocess; led=mcudata; end;-mcufpga.vhd libraryieee; useieee.std_logic_1164.all; useieee.std_logic_arith.all; useieee.std_logic_unsigned.all; entityarm_fpgais port( mcudata:inoutstd_logic_vector(7downto0);-8位数据 mcuaddress:instd_logic_vector(9downto0);-10位地址 wr:instd_logic;-写信号 rd:instd_logic; cs:instd_logic; led:outstd_logic_vector(7downto0); end; architecturearmfpgaofarm_fpgais signaladdresstemp:std_logic_vector(1downto0);-内部寄存器 signaldatatemp:std_logic_vector(31downto0); begin addresstemp=mcuaddress(1downto0); -ARM写数据到FPGA: datatemp(7downto0)=mcudatawhen(cs=0andwr=0andaddresstemp=00); datatemp(15downto8)=mcudatawhen(cs=0andwr=0andaddresstemp=01); datatemp(23downto16)=mcudatawhen(cs=0andwr=0andaddresstemp=10); datatemp(31downto24)=mcudatawhen(cs=0andwr=0andaddresstemp=11); -ARM从FPGA读取数据: mcudata=datatemp(7downto0)when(cs=0andrd=0andaddresstemp=00)else datatemp(15downto8)when(cs=0andrd=0andaddresstemp=01)else datatemp(23downto16)when(cs=0andrd=0andaddresstemp=10)else datatemp(31downto24)when(cs=0andrd=0andaddresstemp=11)else ZZZZZZZZ;-ZZ不可少,否则总线被FPGA锁死. led=mcudata; endarmfpga;libraryieee; useieee.std_logic_1164.all; useieee.std_logic_arith.all; useieee.std_logic_unsigned.all; entityarm_fpgais port( mcudata:inoutstd_logic_vector(7downto0);-8位数据 mcuaddress:instd_logic_vector(9downto0);-10位地址 wr:instd_logic;-写信号 rd:instd_logic; cs:instd_logic; led:outstd_logic_vector(7downto0); end; architecturearmfpgaofarm_fpgais constantaddr_reg1:std_logic_vector(9downto0):=0000000000; constantaddr_reg2:std_logic_vector(9downto0):=0000000001; constantaddr_reg3:std_logic_vector(9downto0):=0000000010; constantaddr_reg4:std_logic_vector(9downto0):=0000000011; signaladdresstemp:std_logic_vector(9downto0);-内部寄存器 signaldatatemp:std_logic_vector(31downto0); -signalwr_en,rd_en:std_logic;-读写使能 begin addresstempdatatemp(7downto0)datatemp(15downto8)datatemp(23downto16)datatemp(31downto24) datatemp0); endcase; else datatemp0); endif;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 海船船员轮机考试题库及答案
- 贸易合同履行承诺书9篇范文
- 合同履行保障安排承诺函5篇
- 2025年国际经济法的基本理论与案例分析试题及答案
- 2025年新疆农业产业链合作合同协议
- 高速公司考试题目及答案
- 初一的月考试卷及答案
- 微积分下考试题目及答案
- 锐捷网络笔试测试题及答案
- 山东初一数学月考试卷及答案
- 《书愤》课件-【中职专用】高二语文(高教版2023职业模块)
- 邻里中心项目策划工作建议书框架及标准格式
- 人工智能通识 课件 第七章 智能之躯-具身智能
- 妈妈驿站加盟合同范本
- T/CUWA 60055-2023城镇排水管道螺旋缠绕内衬法修复用硬聚氯乙烯(PVC-U)带状型材
- DB62T 25-3016-2016 建筑工程资料管理规程
- 专题06 对角互补模型(原卷版)
- 2025勤工俭学合同范本
- 《职业生涯概述》课件
- 企业会计准则实施典型案例
- 混凝土路面裂缝修补施工方案
评论
0/150
提交评论