全套资源下载地址:https://download.csdn.net/download/sheziqiong/86773461
全套资源下载地址:https://download.csdn.net/download/sheziqiong/86773461
目 录
1 绪论 1
1.1课题研究的目的与意义 1
1.2 PCI发展的历史及现状[2] 2
2 FPGA技术概述 6
2.1 FPGA简介 6
2.2 FPGA设计流程 6
2.3 VHDL测试平台简介 9
3 PCI接口模块 12
3.1 PCI设备的配置空间 13
3.1.1 配置空间的组织 14
3.1.2 配置空间的寄存器 15
3.2 内部寄存器组 16
3.2.1状态与控制寄存器 18
3.3 地址译码模块: 20
3.4 奇偶校验 21
3.5设计的仿真验证介绍 22
4 PCI接口的简化设计 23
4.1 PCI信号定义 23
4.2 PCI配置空间的实现 24
4.3 配置空间读写操作仿真 25
4.4 从模式下的目标状态机设计 26
4.5 存储器单周期读写操作仿真 27
4.6 PCI系统的仿真 28
5 总结 30
参考文献 31
致谢 32
课题的研究内容
本论文主要研究内容与具体工作如下:
学习PCI 协议、FPGA设计的基本流程和方法。在深刻理解PCI 协议的基础上,研究PCI IP Core的各个功能及实现方法,采用状态机技术协调各个功能模块的工作和实现PCI 复杂的时序信号。目标是用VHDL语言完成PCI的部分接口模块设计。
本论文是按照PCI 从接口IP核的设计与实现过程来安排的,论文重点在PCI 从接口IP核的功能模块设计、实现及验证上。
第一章绪论,介绍了课题的背景和PCI发展的历史及现状。
第二章FPGA技术,介绍了FPGA的概念、设计流程。
第三章PCI 技术研究,介绍了计算机 技术的发展和PCI 统结构、PCI 信号、传输特点以及 具体的操作过程等。
第四章是PCI 的接口模块,具体介绍了PCI设备的配置空间和内部寄存器组。
第五章PCI 简化接口设计,主要介绍了设计思路、 的结构划分,详细分析了配置空间模块和状态机模块的具体设计和仿真验证。
第六章为总结。
(2)功能仿真
电路设计完成后,要用专用的仿真工具对设计进行功能仿真,验证电路功能是否符合设计要求。功能仿真有时也被称为前仿真。常用的仿真工具有Model Tech公司的Mode1Sim、Synopsys公司的VCS、Cadence公司的NC-Verilog和NC-VHDL、Aldec公司的Active HDL VHDL/Verilog HDL等。通过仿真能及时发现设计中的错误,加快设计进度,提高设计的可靠性。
(3)综合优化
综合优化(Synthesize)是指将HDL语言、原理图等设计输入翻译成由与、或、非门,RAM,触发器等基本逻辑单元组成的逻辑连接(网表),并根据目标与要求(约束条件)优化所生成的逻辑连接,输出EDF和EDN等标准格式的网表文件,供FPGA/CPLD厂家的布局布线器进行实现。
(4)综合后仿真
综合完成后需要检查综合结果是否与原设计一致,做综合后仿真。在仿真时,把综合生成的标准延时文件反标注到综合仿真模型中去,可估计门延时带来的影响。综合后仿真虽然比功能仿真精确一些,但是只能估计门延时,不能估计线延时,仿真结果与布线后的实际情况还有一定的差距,并不十分准确。这种仿真的主要目的在于检查综合器的综合结果是否与设计输入一致。
(5)实现与布局布线
综合结果的本质是一些由与、或、非门,触发器,RAM等基本逻辑单元组成的逻辑网表,它与芯片实际的配置情况还有较大差距。此时应该使用FPGA/CPLD厂商提供的软件工具,根据所选芯片的型号,将综合输出的逻辑网表适配到具体FPGA/CPLD器件上,这个过程就叫做实现过程[5]。因为只有器件开发商最了解器件的内部结构,所以实现步骤必须选用器件开发商提供的工具。在实现过程中最主要的过程是布局布线。所谓布局(Play)是指将逻辑网表中的硬件原语或者底层单元合理地适配到FPGA内部的固有硬件结构上,布局的优劣对设计的最终实现结果(在速度和面积两个方面)影响很大;所谓布线(Route)是指根据布局的拓扑结构,利用FPGA内部的各种连线资源,合理正确连接各个元件的过程。FPGA的结构相对复杂,为了获得更好的实现结果,特别是能够满足设计的时序条件,一般采用时序驱动的引擎进行布局布线。
(6)时序仿真与验证
将布局布线的时延信息反标注到设计网表中,所进行的仿真就叫时序仿真或布线后仿真,简称后仿真。布局布线之后生成的仿真时延文件包含的时延信全,不仅包含门延时,还包含实际布线延时,所以布线后仿真最准确,能较反映芯片的实际工作情况。一般来说,布线后仿真步骤必须进行,本文转载自http://www.biyezuopin.vip/onews.asp?id=14941通过布局后仿真能检查设计时序与FPGA实际运行情况是否一致,确保设计的可靠性定性。布局布线后仿真的主要目的在于发现时序违规(Timing violation),满足时序约束条件或者器件固有时序规则(建立时间、保持时间等)的情况。
(7)板级仿真与验证
在有些高速设计情况下还需要使用第三方的板级验证工具进行仿真与验证。
(8)调试与加载配置
设计开发的最后步骤就是在线调试或者将生成的配置文件写入芯片中进行测试。示波器和逻辑分析仪(LA,Logic Analyzer)是逻辑设计的主要调试工具。
任何仿真或验证步骤出现问题,都需要根据错误的定位返回到相应的步骤更改或者重新设计。
// --------------------------------------------------------------------
// read_config task
task read_config;
input [31:0] address;
input error_check_en; // a 1 enables error checking
input [31:0] expected_data; // data that should be read back.
begin
$display($time," %m \t \t << Reading Config Reg Address = %h >>",address);
@(posedge pci_clk); // address phase
frame_reg <= 0;
frame_oe <= 1;
irdy_reg <= 1;
irdy_oe <= 1;
pci_add_reg <= address;
pci_add_oe <= 1;
pci_cbe_reg <= 4'b1010 ; // read config command
pci_cbe_oe <= 1;
idsel_reg <= 1;
@(posedge pci_clk); // data phase
frame_reg <= 1;
frame_oe <= 1;
irdy_reg <= 0;
irdy_oe <= 1;
pci_cbe_reg <= 4'b0000; // byte enables
pci_cbe_oe <= 1;
idsel_reg <= 0;
pci_add_oe <= 0;
pci_par_oe <= 1;
check_cycle(0, cycle_stat, data_return); // check cycle termination
if (error_check_en ) begin
check_data(expected_data,data_return);
end
irdy_reg <= 1;
frame_oe <= 0;
irdy_oe <= 1;
pci_add_oe <= 0;
pci_cbe_oe <= 0;
@(posedge pci_clk); // end of cycle
check_parity;
$display($time," %m \t \t << Status = %b >>",cycle_stat);
frame_oe <= 0;
irdy_oe <= 0;
pci_par_oe <= 0;
kill_time;
end
endtask // of read_config;
// --------------------------------------------------------------------
// write_config task
task write_config;
input [31:0] address;
input [31:0] data;
begin
$display($time," %m \t \t << Writing Config Reg Address = %h >>",address);
@(posedge pci_clk); // address phase
frame_reg <= 0;
frame_oe <= 1;
irdy_reg <= 1;
irdy_oe <= 1;
pci_add_reg <= address;
pci_add_oe <= 1;
pci_cbe_reg <= 4'b1011; // write config command
pci_cbe_oe <= 1;
idsel_reg <= 1;
@(posedge pci_clk); // data phase
frame_reg <= 1;
frame_oe <= 1;
irdy_reg <= 0;
irdy_oe <= 1;
pci_add_reg <= data;
pci_add_oe <= 1;
pci_cbe_reg <= 4'b0000; // byte enables
pci_cbe_oe <= 1;
idsel_reg <= 0;
pci_par_oe <= 1;
check_cycle(1, cycle_stat, data_return); // check cycle termination
irdy_reg <= 1;
frame_oe <= 0;
irdy_oe <= 1;
pci_add_oe <= 0;
pci_cbe_oe <= 0;
pci_par_oe <= 1;
@(posedge pci_clk); // end of cycle
$display($time," %m \t \t << Status = %b >>",cycle_stat);
frame_oe <= 0;
irdy_oe <= 0;
pci_par_oe <= 0;
kill_time;
end
endtask
// --------------------------------------------------------------------
// read_cycle task
task read_cycle;
input [31:0] address;
input error_check_en; // a 1 enables error checking
input wait_en; // a 1 enable wait state insertion of long bursts
input [31:0] expected_data; // data that should be read back.
input mode; // burst/no burst
input [3:0] brst_size;
input [2:0] type_signal; // transactin type io or memory
integer i;
reg [3:0] type;
begin
$display($time," %m \t \t << Reading Address = %h >>",address);
stop_flag = 0;
abort_flag = 0;
type = type_signal;
@(posedge pci_clk);
frame_reg <= 0;
frame_oe <= 1;
irdy_reg <= 1;
irdy_oe <= 1;
pci_add_reg <= address;
pci_add_oe <= 1;
pci_cbe_reg <= {type,1'b0};
pci_cbe_oe <= 1;
@(posedge pci_clk);
if (mode == `no_brst)
frame_reg <= 1;
irdy_reg <= 0;
pci_cbe_reg <= 4'b0000;
frame_oe <= 1;
irdy_oe <= 1;
pci_add_oe <= 0;
pci_cbe_oe <= 1;
pci_par_oe <= 1;
check_cycle(0, cycle_stat, data_return);
if (error_check_en ) begin
check_data(expected_data,data_return);
end
if (mode == `brst && (cycle_stat == `data_tran || cycle_stat == `data_stop))
begin
i = brst_size;
while (i)
begin
if (stop_flag == 1 || abort_flag == 1) begin
i = 1;
end
if (wait_en && i > 5 && i < 7 ) begin
$display($time," %m Master initiating a wait state on read cycle..." );
irdy_reg = 1;
@(posedge pci_clk);
irdy_reg <= 0;
end
if (i == 1)
frame_reg <= 1;
@(posedge pci_clk);
pci_par_oe <= 0;
if (error_check_en) begin
expected_data = expected_data + 1;
end
check_cycle(0,cycle_stat, data_return);
check_parity;
if (error_check_en && cycle_stat != `retry_stop) begin
check_data(expected_data,data_return);
end
i = i-1;
end
end
irdy_reg <= 1;
frame_oe <= 0;
irdy_oe <= 1;
pci_add_oe <= 0;
pci_cbe_oe <= 0;
pci_par_oe <= 0;
@(posedge pci_clk);
check_parity;
$display($time," %m \t \t << Status = %b >>",cycle_stat);
frame_oe <= 0;
irdy_oe <= 0;
pci_par_oe <= 0;
kill_time;
end
endtask //of read_cycle;
// --------------------------------------------------------------------
// write_cycle task
task write_cycle;
input [31:0] address;
input [31:0] data;
input wait_en; // a one causes a wait state
input mode; // burst or no burst
input [3:0] brst_size; // size of burst
input [2:0] type; // memory or io tran
integer i;
begin
$display($time," %m \t \t << Writing Address = %h >>",address);
stop_flag = 0;
abort_flag = 0;
@(posedge pci_clk);
frame_reg <= 0;
frame_oe <= 1;
irdy_reg <= 1;
irdy_oe <= 1;
pci_add_reg <= address;
pci_add_oe <= 1;
pci_cbe_reg <= {type,1'b1};
pci_cbe_oe <= 1;
@(posedge pci_clk);
if (mode == `no_brst)
frame_reg <= 1;
irdy_reg <= 0;
pci_add_reg <= data;
pci_cbe_reg <= 4'b0000;
frame_oe <= 1;
irdy_oe <= 1;
pci_add_oe <= 1;
pci_cbe_oe <= 1;
pci_par_oe <= 1;
check_cycle(1, cycle_stat, data_return);
if ((mode == `brst) && (cycle_stat == `data_tran || cycle_stat == `data_stop))
begin
i = brst_size;
while (i) begin
pci_add_reg <= pci_add_reg + 1;
if (stop_flag == 1 || abort_flag == 1) begin
i = 1;
end
if (wait_en && i > 5 && i < 7 ) begin
$display($time," %m Master initiating a wait state on a write cycle..." );
irdy_reg = 1;
@(posedge pci_clk);
irdy_reg <= 0;
end
if (i == 1)
frame_reg <= 1;
@(posedge pci_clk);
check_cycle(1,cycle_stat, data_return);
i = i-1;
end
end
irdy_reg <= 1;
frame_oe <= 0;
irdy_oe <= 1;
pci_add_oe <= 0;
pci_cbe_oe <= 0;
pci_par_oe <= 1;
@(posedge pci_clk);
$display($time," %m \t \t << Status = %b >>",cycle_stat);
frame_oe <= 0;
irdy_oe <= 0;
pci_par_oe <= 0;
kill_time;
end
endtask // of write_cycle;
全套资源下载地址:https://download.csdn.net/download/sheziqiong/86773461
全套资源下载地址:https://download.csdn.net/download/sheziqiong/86773461