作者

QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118

参考

PCI Express in Qsys Example Designs
https://fpgawiki.intel.com/wiki/Modular_SGDMA
Modular SGDMA Video Frame Buffer

设计

Cyclone IV GX不像Arria10的pcie-avmm带自带SGDMA,只能用altera提供的Modular SGDMA,这个模块还是以verilog源代码形式提供,其实是个学习verilog的好例子,整体架构如下,很清晰了,Modular SGDMA控制数据在DDR和PC直接互相传输。

再看Modular SGDMA内部实现,将数据从一个MM端口,搬运到另一个MM端口,数据流单向流动,怎么搬运由Descriptors和CSR端口来控制,这两个端口为寄存器,可通过PCIe BAR来访问。

Modular SGDMA的Dispatcher实现如下,

PCI Express-to-Avalon-MM地址翻译

这里就是Bar的地址翻译,

看下IP配置,这里的偏移都是0,altera设置死了,无法更改,手册说的是Hard-code,硬编码的。

Avalon-MM-to-PCI Express地址翻译

For example, if the core is configured with an address translation table with the
following attributes:
■ Number of Address Pages—16
■ Size of Address Pages—1 MByte
■ PCI Express Address Size—64 bits
then the values in Figure 4–12 are:
■ N = 20 (due to the 1 MByte page size)
■ Q = 16 (number of pages)
■ M = 24 (20 + 4 bit page selection)
■ P = 64
In this case, the Avalon address is interpreted as follows:
■ Bits [31:24] select the TX slave module port from among other slaves connected to
the same master by the system interconnect fabric. The decode is based on the base
addresses assigned in Qsys.
■ Bits [23:20] select the address translation table entry.
■ Bits [63:20] of the address translation table entry become PCI Express address bits
[63:20].
■ Bits [19:0] are passed through and become PCI Express address bits [19:0].
看下IP核配置,首先选择翻译表项,最大支持512个,每个表项的长度也可设置。注意,翻译表的位置在CRA的0x1000处。截图来自quartus14.1。

产生PCI Express中断

RX模块有16个Avalon-MM中断输入(RXmirq_irq[n:0],n ≤ 15),设置这16个信号或者设置对应PCIe邮箱寄存器,会在中断寄存器相应位置1,中断使能寄存器在0x50处,中断状态寄存器在0x40处,中断发生后,软件必须清除相应的中断状态寄存器位。IP支持传统中断和MSI中断,
The PCI Express Avalon-MM bridge selects either MSI or legacy interrupts automatically based on the standard interrupt controls in the PCI Express configuration space registers. The Interrupt Disable bit, which is bit 10 of the
Command register (at configuration space offset 0x4) can be used to disable legacy interrupts. The MSI Enable bit, which is bit 0 of the MSI Control Status register in the MSI capability register (bit 16 at configuration space offset 0x50), can be used to enable MSI interrupts.
Only one type of interrupt can be enabled at a time. However, to change the selection of MSI or legacy interrupts during operation, software must ensure that no interrupt request is dropped. Therefore, software must first enable the new selection and then disable the old selection. To set up legacy interrupts, software must first clear the Interrupt Disable bit and then clear the MSI enable bit. To set up MSI interrupts, software must first set the MSI enable bit and then set the Interrupt Disable bit.
看下Qsys中配置,有一个Auto-enable PCIe interrupt的配置,需要测试一下。

看下手册关于邮箱寄存器的描述,写和读在不同的位置,应该是为了避免信号冲突。

中断处理函数中必须清除中断状态寄存器和SGDMA的中断状态寄存器

产生Avalon-MM中断

Generation of Avalon-MM interrupts requires the instantiation of the CRA slave module where the interrupt registers and control logic are implemented. The CRA slave port has an Avalon-MM Interrupt (CraIrq_irq in Qsys systems) output signal. A write access to an Avalon-MM mailbox register sets one of the P2A_MAILBOX_INTn bits in the “PCI Express to Avalon-MM Interrupt Status Register Address: 0x3060” on page 6–11 and asserts the CraIrq_o or CraIrq_irq output, if enabled. Software can enable the interrupt by writing to the “PCI Express to Avalon-MM Interrupt Enable Register Address: 0x3070” on page 6–11 through the CRA slave. After servicing the interrupt, software must clear the appropriate serviced interrupt status bit in the PCI-Express-to-Avalon-MM Interrupt Status register and ensure that there is no other interrupt pending.

Altera Cyclone 4 GX FPGA PCIe SGDMA设计相关推荐

  1. tx2 fpga pcie无法读写_Cyclone V SOC(ARM+FPGA)开发文档_之开发流程详解

    双击可查看大图(手动狗头) 目录 Altera Cyclone V soc开发文档 之软硬件开发 1 Cyclone V开发流程介绍 5 专业术语 5 Cyclone V软件开发介绍 6 U-BOOT ...

  2. 完全替代ALTERA EP4CE10, 国产AGM FPGA 的AG10K系列与之pin to pin 兼容

    AGM FPGA与ALTERA Cyclone 4 系列FPGA pin to pin兼容. AG10K与EP4CE10是完全兼容的,软件移植的非常简单,有技术问题,欢迎一起交流探讨. AG10K F ...

  3. Altera FPGA/CPLD设计 基础篇+高级篇(附随书光盘)

    获取方法: 微信公众号:OpenFPGA   后台回复 Altera设计 基础篇介绍 <Altera FPGA/CPLD设计(基础篇)>是王诚.蔡海宁.吴继华编著的一本图书.该书可作为高等 ...

  4. 奋斗的小孩系列 FPGA学习altera系列: FPGA学习altera 系列 第二十一篇 数码管设计

    奋斗的小孩系列 FPGA学习altera系列: FPGA学习altera 系列 第二十一篇 数码管设计 作者:奋斗的小孩 郝旭帅(转载请注明出处) 大侠好,欢迎来到FPGA技术江湖,江湖偌大,相见即是 ...

  5. 【紫光同创logos2 FPGA PCIe软件栈设计】

    紫光同创logos2 FPGA PCIe软件栈 基于同创logos2系列FPGA自研PCIe软件栈 驱动层 设备初始化 Device operation 设备卸载 API层 配置空间访问接口 bar访 ...

  6. Cyclone V SoC FPGA学习之路第一章:综述

    Cyclone V SoC FPGA学习之路第一章:总体了解 关键词: adaptive logic modules – ALM 自适应逻辑模块 logic array block --LAB 逻辑阵 ...

  7. Cyclone V SoC FPGA学习之路第二章:硬件篇

    Cyclone V SoC FPGA学习之路第二章:硬件篇(内部资源) 前言 上一章了解了<cycloneV device datasheet>,其中数据手册里重点介绍了电源要求,时序参数 ...

  8. 基于EP4CE10F17C8N芯片详解Altera Cyclone系列器件命名规则

    这里写自定义目录标题 Altera的Cyclone系列器件命名规则如下 器件系列 + 器件类型(是否含有高速串行收发器) + LE逻辑单元数量 + 封装类型 + 高速串行收发器的数量(没有则不写) + ...

  9. 使用FPGA实现ADAS设计的功能安全考虑

    基于雷达和摄像机的应用现在也被用于安全驾驶领域.最初,自适应巡航控制和道路偏离报警等这些高级辅助驾驶系统(ADAS)只是一些非常便利的特性.而现在,它们在车辆控制上扮演了更积极主动的角色,支持实现道路 ...

最新文章

  1. 清华NLP实验室刘知远:如何写一篇合格的NLP论文
  2. 如何提高模型性能?这几个方法值得尝试 | CSDN 博文精选
  3. c语言 中insert变量值,c – 在VS2010中的vector :: insert执行意外结果
  4. Set 的合集 并集 差集
  5. 未排序数组中累加和为给定值的最长子数组系列问题
  6. 修复IE9-- safari 的sort方法
  7. vsftpd使用方法小结、Linux安装JDK出现“NoClassDefFoundError: /Object”的解决方案、ubuntu 12.04安装jdk
  8. 将std::string字符串格式的数字转换为int类型的数字
  9. linux shell常用函数,ps
  10. C/C++开发_C语言里类似C++的构造与析构
  11. 五笔字根表识别码图_五笔字根表
  12. 线程的先进先出,后进先出,以及优先级队列
  13. java 麻将小程序_麻将小程序麻将这么玩
  14. org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lett
  15. 用Python爬取28010条《隐秘的角落》评论,我发现了这些...
  16. 小学一年级上学期必背古诗文2021-2022学年
  17. 用php爬取网页数据
  18. 大数据处理问题及解决方法
  19. DebugView在win7下没有输出内核信息解决办法
  20. jenkins windows 20008 R2 msi 工作目录迁移

热门文章

  1. 逻辑斯谛回归(Logistic Regression):函数、模型及其理论内涵
  2. CAD的一些基本操作(快捷键)
  3. 《操作系统》— I/O设备及其分类
  4. JAVA毕业设计HTML5旅游网站计算机源码+lw文档+系统+调试部署+数据库
  5. 数据库的简单查询和复杂查询
  6. UE4 使用AE跟踪相机数据,演算任意视频的相机运动数据
  7. 探索一下PyScript的妙用
  8. 重发老文:DOS游戏编程二十一条
  9. opencv-python 指静脉的ROI获取(拟合手指中线加旋转)
  10. ffmpeg云服务器推流