Home
Welcome
Information


FPGA projects - Basic
Music box
LED displays
Pong game
R/C servos
Text LCD module
Quadrature decoder
PWM and one-bit DAC
Debouncer
Crossing clock domains
The art of counting
External contributions

Interfaces
RS-232
JTAG
I2C
EPP
SPI
PCI
PCI Express
Ethernet
HDMI
SDRAM

Advanced
Digital oscilloscope
Graphic LCD panel
Direct Digital Synthesis
CNC steppers
Spoc CPU core

Hands-on
A simple oscilloscope


FPGA introduction
What are FPGAs?
How FPGAs work
Internal RAM
FPGA pins
Clocks and global lines
Download cables
Configuration
Learn more

FPGA software
Design software
Design-entry
Simulation
Pin assignment
Synthesis and P&R

FPGA electronic
SMD technology
Crystals and oscillators

HDL info
HDL tutorials
Verilog tips
VHDL tips

Quick-start guides
ISE
Quartus-II

Site
FPGA links
HDL tutorials
Forum


PCI plug-and-play

Now that reads and writes accesses are going through, what does it take for the PCI plug-and-play to work?



Our PCI card is not yet in the list...

Configuration space

Remember that PCI cards have three "spaces" where transactions (reads and writes) take place?
  1. Memory space
  2. IO space
  3. Configuration space

The configuration space is the heart of PCI plug-and-play. The OS (Windows, Linux...) reads there first to find if PCI cards are plugged-in, and their characteristics.

For simple boards, the configuration space consists of just 64 bytes. They important fields are:

OffsetNameFunctionNoteLength
0Vendor IDManufacturer number... allocated by the PCI-SIG2 bytes
2Device IDDevice number... allocated by the manufacturers themselves2 bytes
4CommandTurn on and off accesses to the PCI board... but configuration space accesses are always on2 bytes
16BAR0 (Base address register 0)Address at which the PCI board should respond... followed by BAR1 through BAR54 bytes each

By implementing the right values and registers at these locations, the OS can "find" the PCI card.

Configuration space transactions

Each PCI slots as a signal called IDSEL. The IDSEL signal is not shared along the bus; each PCI slot has its own.
When a PCI card sees a configuration space transaction on the bus, and its own IDSEL is asserted, it knows it should respond.

parameter PCI_CBECD_CSRead = 4'b1010;   // configuration space read
parameter PCI_CBECD_CSWrite = 4'b1011;   // configuration space write

wire PCI_Targeted = PCI_TransactionStart & PCI_IDSEL & ((PCI_CBE==PCI_CBECD_CSRead) | (PCI_CBE==PCI_CBECD_CSWrite)) & (PCI_AD[1:0]==0);

After that, it can be a read or a write but it works the same way than memory or IO spaces do.

A few details: There are a few other details left out, like some bits of BAR0 are read-only...
Please refer to a PCI specification/book for the down-to-earth details.

Windows plug-and-play

Once these registers are implemented, the OS can discover the new hardware.




But the OS requires a driver before...




... it agrees to allocate the memory resource.


Links



>>> NEXT - part 6: PCI software driver for Windows >>>



This page was last updated on November 26 2010.