|
由于前段时间非常忙,又去外地出差了两个星期,开发板一直没有时间试用。
出差回来后对Cyclone V开发板上的pcie硬核进行了试用。Cyclone V GX FPGA含有pcie硬核,开发板带pcie x4边沿连接器,我们办公的电脑上有x16的接口,幸好PCIe可以向下兼容。我们开发板可以插到x16的接口上使用。
废话少说直接上我试用的步骤吧
1.在quartus12.1下新建一个quartus工程,工程路径和工程名设置如下。
在器件设置页面,选择开发板对应的cycolne v 系列的 5cgxfc7d6f31c7es器件
2用tools菜单下的“Megawiard plug-in manager”生成pcie硬核,按照Cyclone
V Hard IP for PCI Express User Guide中第二章的说明对pcie硬核参数进行设置。如图
(建议多花点时间看看User Guide)
设置完毕后,点击下方的“finish”按钮,将弹出以下对话框:
在弹出的对话框中点击“Generate”,产生IP核。
一定要勾上Generate Example Design,后续我们就上板子跑这个例程。
3在quartus中点击打开生成的例程文件,可以看到在工程文件夹下出现的文件目录如下图所示。
4打开d:\asys_ast\ gen1_x4_example_design\ altera_pcie_cv_hip_ast文件夹下的pcie_de_gen1_x4_ast64.qsys文件。
内部的信号都已经连接好了。
5点击“generate标签页”的“generate”,等待generate完成后将
d:\asys_ast\ gen1_x4_example_design\ altera_pcie_cv_hip_ast\pcie_de_gen1_x4_ast64\synthesis\pcie_de_gen1_x4_ast64.qip文件加入工程。
6新建工程的顶层文件top.v,文件如下,
module top (
free_50MHz,
pcie_rstn,
refclk,
rx_in0,
rx_in1,
rx_in2,
rx_in3,
tx_out0,
tx_out1,
tx_out2,
tx_out3,
L0_led
);
output L0_led;
output tx_out0;
output tx_out1;
output tx_out2;
output tx_out3;
input pcie_rstn;
input refclk;
input rx_in0;
input rx_in1;
input rx_in2;
input rx_in3;
input free_50MHz;
reg L0_led;
wire [ 31: 0] test_in;
assign test_in[31 : 9] = 0;
assign test_in[8 : 5] = 4'b0101;
assign test_in[4 : 0] = 5'b01000;
wire clk50, clk125;
always @(posedge free_50MHz or negedge pcie_rstn)
begin
if (pcie_rstn == 0)
begin
L0_led <= 1;
end
else
begin
L0_led <=0;
end
end
pcie_de_gen1_x4_ast64 pcie_de_gen1_x4_ast64 (
.dut_npor_pin_perst (pcie_rstn),
.dut_npor_npor (pcie_rstn),
.dut_hip_ctrl_simu_mode_pipe (1'b0),
.dut_refclk_clk (refclk),
.clk_clk (free_50MHz),
.dut_hip_serial_rx_in0 (rx_in0),
.dut_hip_serial_rx_in1 (rx_in1),
.dut_hip_serial_rx_in2 (rx_in2),
.dut_hip_serial_rx_in3 (rx_in3),
.dut_hip_serial_tx_out0 (tx_out0),
.dut_hip_serial_tx_out1 (tx_out1),
.dut_hip_serial_tx_out2 (tx_out2),
.dut_hip_serial_tx_out3 (tx_out3),
.dut_hip_ctrl_test_in (test_in)
);
endmodule
7编译工程,将编译后的sof文件下载到开发板,重启计算机,这时可看到系统找到新硬件,弹出如下对话框。
8关闭对话框,打开windriver,可以看到系统识别altera器件,并可通过windriver对bar空间进行读写。
可以看到PCIe IP核只分配了两个基地址空间 BAR0和BAR2
本次试验只是照葫芦画瓢,让计算机能识别PCIe接口设备,要想用好该IP核还需要认真看user guider然后根据自己的项目需要来增加用户逻辑。
|
|