2019-07-15 14:55:57 -07:00
# Verilog PCI Express Components Readme
2021-02-24 15:03:37 -08:00
[![Build Status ](https://github.com/alexforencich/verilog-pcie/workflows/Regression%20Tests/badge.svg?branch=master )](https://github.com/alexforencich/verilog-pcie/actions/)
2019-07-15 14:55:57 -07:00
For more information and updates: http://alexforencich.com/wiki/en/verilog/pcie/start
GitHub repository: https://github.com/alexforencich/verilog-pcie
## Introduction
2019-10-22 16:07:47 -07:00
Collection of PCI express related components. Includes PCIe to AXI and AXI
lite bridges, a simple PCIe AXI DMA engine, and a flexible, high-performance
2021-05-20 15:17:19 -07:00
DMA subsystem. Currently supports operation with the Xilinx UltraScale and
UltraScale+ PCIe hard IP cores with interfaces between 64 and 512 bits.
2021-02-24 15:03:37 -08:00
Includes full cocotb testbenches that utilize
[cocotbext-axi ](https://github.com/alexforencich/cocotbext-axi ).
2019-07-15 14:55:57 -07:00
## Documentation
2019-10-22 16:07:47 -07:00
### PCIe AXI and AXI lite master
2021-05-20 15:17:19 -07:00
The `pcie_us_axi_master` and `pcie_us_axil_master` modules provide a bridge
2019-10-22 16:07:47 -07:00
between PCIe and AXI. These can be used to implement PCIe BARs. The
pcie_us_axil_master module is a very simple module for providing register
2021-05-20 15:17:19 -07:00
access, supporting only 32 bit operations. The `pcie_us_axi_master` module is
2019-10-22 16:07:47 -07:00
more complex, converting PCIe operations to AXI bursts. It can be used to
terminate device-to-device DMA operations with reasonable performance. The
2021-05-20 15:17:19 -07:00
`pcie_us_axis_cq_demux` module can be used to demultiplex PCIe operations based
2019-10-22 16:07:47 -07:00
on the target BAR.
### PCIe AXI DMA
2021-05-20 15:17:19 -07:00
The `pcie_us_axi_dma` module provides a DMA engine with an internal AXI
2019-10-22 16:07:47 -07:00
interface. The AXI interface width must match the PCIe interface width. The
module directly translates AXI operations into PCIe operations. As a result,
it is relatively simple, but the performance is limited due to the constraints
of the AXI interface. Backpressure on the AXI interface is also passed
through to the PCIe interface.
2021-05-20 15:17:19 -07:00
The `pcie_axi_dma_desc_mux` module can be used to share the AXI DMA module
2019-10-22 16:07:47 -07:00
between multiple request sources.
### Flexible DMA subsystem
The split DMA interface/DMA client modules support highly flexible, highly
performant DMA operations. The DMA interface and DMA client modules are
connected by dual port RAMs with a high performance segmented memory
interface. The segmented memory interface is a better 'impedance match' to
the PCIe hard core interface - data realignment can be done in the same clock
cycle; no bursts, address decoding, arbitration, or reordering simplifies
implementation and provides much higher performance than AXI. The architecture
is also quite flexible as it decouples the DMA interface from the clients with
dual port RAMs, enabling mixing different client interface types and widths
and even supporting clients running in different clock domains without
datapath FIFOs.
2020-07-10 19:46:48 -07:00
![DMA system block diagram ](dma_block.svg )
2021-05-20 15:17:19 -07:00
The `dma_if_pcie_us` module connects the Xilinx UltraScale PCIe interface to
the segmented memory interface. Currently, it does not support TLP straddling,
2020-07-10 19:46:48 -07:00
but it should be possible to support this with the segmented interface.
2019-10-22 16:07:47 -07:00
2021-05-20 15:17:19 -07:00
The `dma_psdpram` module is a dual clock, parallel simple dual port RAM module
2019-10-22 16:07:47 -07:00
with a segmented interface. The depth is independently adjustable from the
address width, simplifying use of the segmented interface. The module also contains a parametrizable output pipeline register to improve timing.
2021-05-20 15:17:19 -07:00
The `dma_if_mux` module enables sharing the DMA interface across several DMA
2019-10-22 16:07:47 -07:00
clients. This module handles the tags and select lines appropriately on both
the descriptor and segmented memory interface for plug-and-play operation
without address assignment - routing is completely determined by component
connections. The module also contains a FIFO to maintain read data ordering
across multiple clients. Make sure to equalize pipeline delay across all
paths for maximum performance.
DMA client modules connect the segmented memory interface to different
internal interfaces.
2021-05-20 15:17:19 -07:00
The `dma_client_axis_source` and `dma_client_axis_sink` modules provide support
2019-10-22 16:07:47 -07:00
for streaming DMA over AXI stream. The AXI stream width can be any power of
two fraction of the segmented memory interface width.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `arbiter` module
2019-07-15 14:55:57 -07:00
General-purpose parametrizable arbiter. Supports priority and round-robin
2019-10-22 16:07:47 -07:00
arbitration. Supports blocking until request release or acknowledge.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `axis_arb_mux` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
Frame-aware AXI stream arbitrated multiplexer with parametrizable data width
2019-07-15 14:55:57 -07:00
and port count. Supports priority and round-robin arbitration.
2021-05-20 15:17:19 -07:00
### `dma_client_axis_sink` module
2019-10-22 16:07:47 -07:00
AXI stream sink DMA client module. Uses a segmented memory interface.
2021-05-20 15:17:19 -07:00
### `dma_client_axis_source` module
2019-10-22 16:07:47 -07:00
AXI stream source DMA client module. Uses a segmented memory interface.
2021-05-20 15:17:19 -07:00
### `dma_if_mux` module
2019-10-22 16:07:47 -07:00
DMA interface mux module. Enables sharing a DMA interface module between
2021-05-20 15:17:19 -07:00
multiple DMA client modules. Wrapper for `dma_if_mux_rd` and `dma_if_mux_wr` .
2019-10-22 16:07:47 -07:00
2021-05-20 15:17:19 -07:00
### `dma_if_mux_rd` module
2019-10-22 16:07:47 -07:00
DMA interface mux module. Enables sharing a DMA interface module between
multiple DMA client modules. Muxes descriptors and demuxes memory writes.
2021-05-20 15:17:19 -07:00
### `dma_if_mux_wr` module
2019-10-22 16:07:47 -07:00
DMA interface mux module. Enables sharing a DMA interface module between
multiple DMA client modules. Muxes descriptors, demuxes memory read commands,
and muxes read data.
2021-05-20 15:17:19 -07:00
### `dma_if_pcie_us` module
2019-10-22 16:07:47 -07:00
2021-05-20 15:17:19 -07:00
PCIe DMA interface module for Xilinx UltraScale series FPGAs. Supports 64,
2019-10-22 16:07:47 -07:00
128, 256, and 512 bit datapaths. Uses a double width segmented memory
2021-05-20 15:17:19 -07:00
interface. Wrapper for `dma_if_pcie_us_rd` and `dma_if_pcie_us_wr` .
2019-10-22 16:07:47 -07:00
2021-05-20 15:17:19 -07:00
### `dma_if_pcie_us_rd` module
2019-10-22 16:07:47 -07:00
2021-05-20 15:17:19 -07:00
PCIe DMA interface module for Xilinx UltraScale series FPGAs. Supports 64,
2019-10-22 16:07:47 -07:00
128, 256, and 512 bit datapaths. Uses a double width segmented memory
interface.
2021-05-20 15:17:19 -07:00
### `dma_if_pcie_us_wr` module
2019-10-22 16:07:47 -07:00
2021-05-20 15:17:19 -07:00
PCIe DMA interface module for Xilinx UltraScale series FPGAs. Supports 64,
2019-10-22 16:07:47 -07:00
128, 256, and 512 bit datapaths. Uses a double width segmented memory
interface.
2021-05-20 15:17:19 -07:00
### `dma_psdpram` module
2019-10-22 16:07:47 -07:00
DMA RAM module. Segmented simple dual port RAM to connect a DMA interface
module to a DMA client.
2021-05-20 15:17:19 -07:00
### `pcie_axi_dma_desc_mux` module
2019-07-15 14:55:57 -07:00
Descriptor multiplexer/demultiplexer for PCIe AXI DMA module. Enables sharing
the PCIe AXI DMA module between multiple request sources, interleaving
requests and distributing responses.
2021-05-20 15:17:19 -07:00
### `pcie_us_axi_dma` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
PCIe AXI DMA module for Xilinx UltraScale series FPGAs. Supports 64, 128, 256,
2019-10-22 16:07:47 -07:00
and 512 bit datapaths. Parametrizable AXI burst length. Wrapper for
2021-05-20 15:17:19 -07:00
`pcie_us_axi_dma_rd` and `pcie_us_axi_dma_wr` .
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_axi_dma_rd` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
PCIe AXI DMA module for Xilinx UltraScale series FPGAs. Supports 64, 128, 256,
2019-10-22 16:07:47 -07:00
and 512 bit datapaths. Parametrizable AXI burst length.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_axi_dma_wr` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
PCIe AXI DMA module for Xilinx UltraScale series FPGAs. Supports 64, 128, 256,
2019-10-22 16:07:47 -07:00
and 512 bit datapaths. Parametrizable AXI burst length.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_axi_master` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
PCIe AXI master module for Xilinx UltraScale series FPGAs. Supports 64, 128,
2019-10-22 16:07:47 -07:00
256, and 512 bit datapaths. Parametrizable AXI burst length. Wrapper for
2021-05-20 15:17:19 -07:00
`pcie_us_axi_master_rd` and `pcie_us_axi_master_wr` .
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_axi_master_rd` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
PCIe AXI master module for Xilinx UltraScale series FPGAs. Supports 64, 128,
2019-10-22 16:07:47 -07:00
256, and 512 bit datapaths. Parametrizable AXI burst length.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_axi_master_wr` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
PCIe AXI master module for Xilinx UltraScale series FPGAs. Supports 64, 128,
2019-10-22 16:07:47 -07:00
256, and 512 bit datapaths. Parametrizable AXI burst length.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_axil_master` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
PCIe AXI lite master module for Xilinx UltraScale series FPGAs. Supports 64,
2019-10-22 16:07:47 -07:00
128, 256, and 512 bit PCIe interfaces.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_axis_cq_demux` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
Demux module for Xilinx UltraScale CQ interface. Can be used to route
2019-07-15 14:55:57 -07:00
incoming requests based on function, BAR, and other fields. Supports 64, 128,
2019-10-22 16:07:47 -07:00
256, and 512 bit datapaths.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_axis_rc_demux` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
Demux module for Xilinx UltraScale RC interface. Can be used to route
2019-07-15 14:55:57 -07:00
incoming completions based on the requester ID (function). Supports 64, 128,
2019-10-22 16:07:47 -07:00
256, and 512 bit datapaths.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_cfg` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
Configuration shim for Xilinx UltraScale series FPGAs.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `pcie_us_msi` module
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
MSI shim for Xilinx UltraScale series FPGAs.
2019-07-15 14:55:57 -07:00
2021-05-20 15:17:19 -07:00
### `priority_encoder` module
2019-07-15 14:55:57 -07:00
Parametrizable priority encoder.
2021-05-20 15:17:19 -07:00
### `pulse_merge` module
2019-07-15 14:55:57 -07:00
Parametrizable pulse merge module. Combines several single-cycle pulse status
signals together.
### Common signals
### Common parameters
### Source Files
2019-10-22 16:07:47 -07:00
arbiter.v : Parametrizable arbiter
axis_arb_mux.v : Parametrizable AXI stream mux
dma_client_axis_sink.v : AXI stream sink DMA client
dma_client_axis_source.v : AXI stream source DMA client
dma_if_mux.v : DMA interface mux
dma_if_mux_rd.v : DMA interface mux (read)
dma_if_mux_wr.v : DMA interface mux (write)
2021-05-20 15:17:19 -07:00
dma_if_pcie_us.v ; DMA interface for Xilinx UltraScale PCIe
dma_if_pcie_us_rd.v ; DMA interface for Xilinx UltraScale PCIe (read)
dma_if_pcie_us_wr.v ; DMA interface for Xilinx UltraScale PCIe (write)
2019-10-22 16:07:47 -07:00
dma_psdpram.v : DMA RAM (segmented simple dual port RAM)
pcie_axi_dma_desc_mux.v : Descriptor mux for DMA engine
2021-05-20 15:17:19 -07:00
pcie_us_axi_dma.v : PCIe AXI DMA module (Xilinx UltraScale)
pcie_us_axi_dma_rd.v : PCIe AXI DMA read module (Xilinx UltraScale)
pcie_us_axi_dma_wr.v : PCIe AXI DMA write module (Xilinx UltraScale)
pcie_us_axi_master.v : PCIe AXI Master module (Xilinx UltraScale)
pcie_us_axi_master_rd.v : PCIe AXI Master read module (Xilinx UltraScale)
pcie_us_axi_master_wr.v : PCIe AXI Master write module (Xilinx UltraScale)
pcie_us_axil_master.v : PCIe AXI Lite Master module (Xilinx UltraScale)
2019-10-22 16:07:47 -07:00
pcie_us_axis_cq_demux.v : Parametrizable AXI stream CQ demux
pcie_us_axis_rc_demux.v : Parametrizable AXI stream RC demux
2021-05-20 15:17:19 -07:00
pcie_us_cfg.v : Configuration shim for Xilinx UltraScale devices
pcie_us_msi.v : MSI shim for Xilinx UltraScale devices
2019-10-22 16:07:47 -07:00
priority_encoder.v : Parametrizable priority encoder
pulse_merge : Parametrizable pulse merge module
2019-07-15 14:55:57 -07:00
## Testing
2021-02-24 15:03:37 -08:00
Running the included testbenches requires [cocotb ](https://github.com/cocotb/cocotb ), [cocotbext-axi ](https://github.com/alexforencich/cocotbext-axi ), [cocotbext-pcie ](https://github.com/alexforencich/cocotbext-pcie ), and [Icarus Verilog ](http://iverilog.icarus.com/ ). The testbenches can be run with pytest directly (requires [cocotb-test ](https://github.com/themperek/cocotb-test )), pytest via tox, or via cocotb makefiles.