利用FPGA实现PCI总线接口及Windows驱动实现
- UID
- 1029342
- 性别
- 男
|
利用FPGA实现PCI总线接口及Windows驱动实现
关于PCI总线协议,资料网上、书本都是。这里我们仅仅对重点对利用FPGA实现PCI总线接口问题进行简单分析。下图是PCI总线接口信号:
配置空间寄存器操作时序如下图:
配置寄存器空间写时序如下图:
依照状态机的编程思路。
部分Verilog代码如下:
ST_CFGREAD: begin
enable <= EN_RD;
if (~irdy || trdy) begin
case (address)
0: data <= { DEVICE_ID,VENDOR_ID };
1: data <= { 5'b0,DEVSEL_TIMING, 9'b0, 14'b0, memen,1'b0};
2: data <= {DEVICE_CLASS, DEVICE_REV };
4: data <= { 12'b0,baseaddr, 8'b0, 4'b0010 }; // baseaddr + request mem < 1Mbyte
11: data <={SUBSYSTEM_ID, SUBSYSTEM_VENDOR_ID };
16: data <= { 24'b0,baseaddr };
default: data <='h00000000;
endcase
address <= address + 1'b1;
end
if (frame && ~irdy && ~trdy) begin
devsel <= 1;
state <= ST_IDLE;
enable <= EN_TR;
end
end
ST_CFGWRITE: begin
enable <= EN_WR;
if (~irdy) begin
case (address)
4: baseaddr <=ad[19:12]; // XXX examine cbe
1: memen <= ad[1];
default: ;
endcase
address <= address + 1'b1;
if (frame) begin
devsel <= 1;
state <= ST_IDLE;
enable <= EN_TR;
end
end
end |
|
|
|
|
|