




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 现代餐饮店铺转让合同含环保设施及节能技术
- 海外社交媒体跨境电商品牌合作推广协议
- 智能制造基地厂房股权转让合作协议
- 水上救援专用船租赁服务协议
- 高端制造基地厂房租赁代购及产业导入合同
- 场地及综合体大楼公共设施装修工程协议
- 2025茶叶销售代理合同全新版
- 2025合同范本物业管理服务合同 示例
- 2025合作合同书 共同经营协议
- 离散数学试题及答案文库
- 高级护理实践知到智慧树章节测试课后答案2024年秋浙江中医药大学
- 【数学】现实中的变量教学设计 2024-2025学年北师大版数学七年级下册
- 税收政策与社会公平分配问题探讨-洞察分析
- 2025届安徽省合肥市重点中学中考二模生物试题含解析
- 森林生态旅游与康养基础知识单选题100道及答案
- DB33T 2239-2020 经颅磁刺激戒毒康复应用管理规范
- 2025年陕西锌业有限公司招聘笔试参考题库含答案解析
- 露营地自然灾害应急预案
- 医疗损害责任民法典
- 品管圈PDCA大赛作品-普外科提高腹腔镜术后24小时内肠道通气率医院品质管理案例
- 智能交通信号控制系统维护方案
评论
0/150
提交评论