如何保证FPGA PCIe唤醒能满足PC的100ms 的时间要求(Autonomous Mode)?

原创By DeeZeng [ Intel FPGA笔记 ]

 PC 需要PCIe设备在 100ms 内启动,这样PC 才能扫描到PCIe 设备。对于 FPGA PCIe 板卡,同样也需要满足这个时间要求。

 Intel FPGA系列是基于sram的,也就是掉电丢失,所以会需要配置器件。配置模式有很多种,以我们常见的 ASx4 和 FPP为例:

1. ASx4 :只需要一颗 EPCS/PECQ 即可配置

2. FPP  : 需要一个额外外部Host 用来搬移 配置数据,由于是并行 x8 x16 x32,配置时间会少很多。

如下抽出两张 Cyclone V 和 Arria 10 的 AS FPP 配置时间差异

Cyclone V configuration time

Arria 10 Configuration time

 PCIe 100ms 或FPGA 120 ms 的时间(请具体分析之后给出的 Figure 2-2 ,Table 2-1图片),可不单纯包含FPGA configuration Time,还包含Ramp Time ,POR Time等。

减去这两项时间,那FPGA configuration 80 ms 左右的都有点不保险了。

Ramp Time and POR

也就是当我们 Cyclone V 逻辑资源大的器件,或Arria10 器件,当使用AS x4模式的时候,PCIe应用会满足不了唤醒时间!

Arria10的最大两个器件,甚至FPP32时间也满足不了

而实际硬件设计或板子需要或已经采用 EPCQ方案了(毕竟很多情况只会用一颗EPCQ,而不用FPP的 外部Host+并行Flash)

 那如何解决呢?

  1. 外接供电,先于 Host 开机。 (好吧,这用起来几多麻烦)
  2. PCIe供电,Host 开机两次。(PC重启,FPGA不会断电和重配置)
  3.  Autonomous PCIe HIP Mode (注意要器件支持这个功能)

什么是Autonomous PCIe HIP模式?

Autonomous 模式对满足PCIe 100ms 唤醒时间非常有用。Intel FPGA设备会先接收periphery image,然后再接收 Core image.

配置完Core image 后,FPGA进入user mode.  在Autonomous HIP 模式下,PCIe Hard IP 在periphery image配置完后就能工作,

完成Link Training 后,PCIe Hard IP 就能响应 host, 从而减少唤醒时间。 而不用等到 Core image 配置完进入user mode才开始。

 

Autonomous PCIe HIP Mode 和 CvP 的模式是类似的,如下以CVP的两张图类比说明Autonomous PCIe HIP Mode 与否的差异。

     PCIe Active的 时间 =  a(ramp time) + b (POR) + Program and calibrate

https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_a10_cvp_prop.pdf

 1.  Autonomous PCIe HIP Mode :  只需 program Periphery image ,Hard PCIe就起来了。

  CvP Periphery

 

2.  非Autonomous PCIe HIP Mode :  需要Program Full  image ,Hard PCIe才起来。

 CvP full

所以使能Autonomous PCIe HIP Mode 可以减少 (Full image - Periphery image)数量的Config bits,大大缩短时间。

 

这么有用,那如何设置 Autonomous 模式呢?简单,在 Quartus 工程中设置勾选一下即可。

Autonomous HIP setting

 Cyclone V,Arria V 和 Stratix V 以及之后出来的 Arria 10 ,Stratix 10 等 都支持 autonomous PCIe HIP Mode.

注意: 1.  PCIe Hard IP。  2. 支持这个功能的器件。

这样开机无法找到PCIe,重启才能找到的案例。打开这个模式之后,第一次开机就能直接找到PCIe啦。

 


 What? 担心打开了Autonomous PCIe HIP Mode还是无法满足 PCIe的唤醒100ms时间要求?

那我们来进行一次具体计算,看如何计算这些时间

以 Arria10 1150的器件,使用AS x4 来计算(其他系列计算类似)

 PCIe Active的时间 =  a(ramp time) + b (POR) + Program and calibrate

 1. Ramp Time: Ramp Time 这是FPGA开发板 Power 电路决定的

     假设10ms

 2. POR delay: 这个delay是,POR电路监控的所有Power都起来了,然后delay一个时间用以保证,FPGA准备好被配置。

 POR delay

     可以看到 Fast POR 和 Standard POR 是有很大差异的,我们必须设置MSEL,将POR切到 Fast

     这里算 fast 的 12ms

3. Program and calibrate

3.1 Program periphery image

 

   为计算配置periphery image的时间:

    这里 Configuration File size 我们用 periphery image : Datasheet中CvP的IOCSR数据  2756096

                 iocsr a10

 

Number of data line 用 AS x4 的   4

DCLK 用 AS 的 100MHz

 config time =  2756096/4* (1/100MHz)  = 6.9 ms (远小于 full image 的 800+ ms)

 

3.2 Calibrate

Transceiver calibration begins with the bottom PCIe IP core on eachside of the device. Consequently, this IP core has a faster wake up time

这个时间在 A10 是有一个nios硬核ip 会进行calibration,从bottom的开始。时间花费应该不多。

所以打开 Autonomous  Mode总时间为: 10 + 12 + 6.7 + 少量Calibrate时间  ≈ 30ms ,很简单就满足PCIe唤醒时间要求。

重复一下这张图: 我们Arria10 1150K,用ASx4的EPCQ config  periphery image 都只需要 7ms 不到,那这张图的timing应该很好满足了。

不过硬件的 Ramp Time应该是影响的,如果超了10ms (别超),也许就是 和 ramp+POR+config 的时间加起来和 120ms 对比了

CvP Periphery

 

是否会算了呢?

按上面的计算,A10 最大器件用ASx4 也没问题。

这样 Arria10 以下28nm以上的器件直接打开 Autonomous PCIe HIP Mode 就好哟。

原文地址:https://www.cnblogs.com/DeeZeng/p/11309241.html