How to Integrate the Pix2PGP FPGA Receiver in Your FPGA
This page describes how to drop the Pix2PGP FPGA receiver into an FPGA design. The receiver is a VHDL design that expects one PGP4 receiver core per data lane on its input side, and delivers a single consolidated AXI-Stream per trigger on its output side.
The top-level entity is Pix2PgpAsicStreamRx, defined in
firmware/fpga/rtl/Pix2PgpAsicStreamRx.vhd. Unlike the ASIC-side
Pix2PgpTop, the FPGA receiver is a full-featured module — it
carries an integrated AXI-Lite crossbar, a trigger-buffer for the
ASIC’s SRO signal, per-lane monitoring, and clock-domain-crossing
logic between the ASIC-facing clock and the PGP RX clock. Instantiate
one ``Pix2PgpAsicStreamRx`` per ASIC in your FPGA design.
Prerequisites
The same
Pix2PgpAsicPkg.vhdpackage used by the ASIC (or an identical copy — the receiver depends onNUM_OF_COL_MANAGERS_C,NUM_OF_SERIALIZERS_C,ASIC_DATABUS_DWIDTH_C, header/metadata bitfield positions, etc.)One PGP4 receiver core per lane (
NUM_OF_SERIALIZERS_Ccores). Their AXI-Stream masters andlinkUpsignals are wired to the receiverThree clock domains:
pgpRxClk— the PGP4 receivers’ recovered clock. The receiver logic runs hereasicClk— the clock associated with theSROtrigger forwarded to the ASIC. The Trigger Manager crosses this intopgpRxClkinternallyaxilClk— the AXI-Lite bus clock. The receiver crosses this intopgpRxClkinternally via anAxiLiteAsync
An AXI-Lite master (a register file, an embedded processor, etc.) that can address the receiver’s
AXIL_BASE_ADDR_Gregion
Generics
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Simulation-only propagation delay applied to registers. Ignored by synthesis |
|
|
|
|
|
|
|
Reset active-high ( |
|
|
|
Reset polarity for the ASIC-facing |
|
|
|
Numeric identifier for this ASIC, written into the consolidated Pix2PGP frame preamble. Unique per receiver instance if the FPGA services multiple ASICs |
|
|
|
Generate the |
|
|
|
Bit width of the per-lane monitoring counters |
|
|
|
Trigger-buffer FIFO depth, as |
|
|
|
Depth of each |
|
|
|
Depth of each |
|
|
(no default) |
Base address of this receiver’s AXI-Lite region. Required
— the internal crossbar sizes its address windows by taking the
base and stepping through in 16-bit strides
( |
Ports
General Interface
Name |
Direction |
Description |
|---|---|---|
|
|
PGP4 receiver’s recovered clock. Every |
|
|
Reset on |
ASIC Domain Interface
Name |
Direction |
Description |
|---|---|---|
|
|
Clock of the ASIC-facing side (the clock the |
|
|
ASIC-side reset. Polarity governed by |
|
|
Start-of-Readout trigger issued to the ASIC. On every |
|
|
Enable for |
|
|
System-level DAQ enable. When high, every buffered trigger
forwards the merged frame to the back-end; when low, frames are
either discarded or handled per |
PGP4 RX Input Interface (pgpRxClk domain)
Name |
Direction |
Description |
|---|---|---|
|
|
Array of |
|
|
Matching array of AXI-Stream slaves (handshake back to each PGP4 receiver) |
|
|
Per-lane link-up flag from each PGP4 receiver. When a lane goes down mid-run, the Lane Supervisor emits drop-frames until the receiver returns to idle |
AXI-Stream Output Interface (pgpRxClk domain)
Name |
Direction |
Description |
|---|---|---|
|
|
Consolidated Pix2PGP frame, as a single AXI-Stream per trigger. This is the output that goes on to the back-end (a second-tier PGP4 transmitter, a DMA channel to a rogue-managed CPU, etc.). See Data Frame Format for the byte-level layout |
|
|
AXI-Stream slave handshake from the downstream consumer |
ASIC Monitoring Status Output
Name |
Direction |
Description |
|---|---|---|
|
|
Array of |
AXI-Lite Interface
Name |
Direction |
Description |
|---|---|---|
|
|
AXI-Lite bus clock |
|
|
AXI-Lite bus reset |
|
|
AXI-Lite read master, initialized to
|
|
|
AXI-Lite read slave response |
|
|
AXI-Lite write master, initialized to
|
|
|
AXI-Lite write slave response |
Internally, Pix2PgpAsicStreamRx places an AxiLiteAsync on this
port (so axilClk can differ from pgpRxClk) followed by a
NUM_OF_SERIALIZERS_C + 1-port AXI-Lite crossbar. Index 0 of the
crossbar addresses the receiver’s global registers
(Pix2PgpAxiLiteManager); indices 1 … NUM_OF_SERIALIZERS_C each
address one LaneRx monitor. The 16-bit stride is fixed by the
crossbar generator inside the entity.
Instantiation Template
For an ASIC with 8 lanes (SparkPix-S-style):
library ieee;
use ieee.std_logic_1164.all;
library surf;
use surf.StdRtlPkg.all;
use surf.AxiLitePkg.all;
use surf.AxiStreamPkg.all;
library pix2pgp;
use pix2pgp.Pix2PgpAsicPkg.all;
use pix2pgp.Pix2PgpPkg.all;
-- ...
U_Pix2PgpAsicRx : entity pix2pgp.Pix2PgpAsicStreamRx
generic map (
TPD_G => 1 ns,
RST_ASYNC_G => false,
RST_POLARITY_G => '1',
ASIC_RST_POLARITY_G => '0',
ASIC_ID_G => 0, -- unique per ASIC in the system
LANE_MON_GEN_G => true, -- enable per-lane monitoring
LANE_MON_CNT_WIDTH_G => 20,
TRG_FIFO_ADDR_WIDTH_G => 6, -- 64 in-flight triggers
META_FIFO_ADDR_WIDTH_G => 6,
LANE_FIFO_ADDR_WIDTH_G => 9, -- 512 words per lane
AXIL_BASE_ADDR_G => x"A000_0000")
port map (
-- Clocks / resets
pgpRxClk => pgpRxClk,
pgpRxRst => pgpRxRst,
asicClk => asicClk,
asicRst => asicRst,
-- ASIC control
asicSro => asicSro,
asicSroEn => asicSroEn,
sysDaq => sysDaq,
-- PGP4 RX inputs (from your 8 PGP4 receiver cores)
pgp4RxMaster => pgp4RxMasters,
pgp4RxSlave => pgp4RxSlaves,
pgp4RxLinkUp => pgp4RxLinkUps,
-- Consolidated AXI-Stream output to the back-end
asicRxMaster => asicRxMaster,
asicRxSlave => asicRxSlave,
-- Per-lane monitoring snapshot
asicMonStatus => asicMonStatus,
-- AXI-Lite
axilClk => axilClk,
axilRst => axilRst,
axilReadMaster => axilReadMaster,
axilReadSlave => axilReadSlave,
axilWriteMaster => axilWriteMaster,
axilWriteSlave => axilWriteSlave);
If the FPGA services multiple ASICs, replicate the instantiation with
distinct ASIC_ID_G and AXIL_BASE_ADDR_G values.
Instantiation Checklist
The
Pix2PgpAsicPkg.vhdcompiled into the FPGA design is the same as the one used by the ASIC. A mismatch (e.g. differentNUM_OF_COL_MANAGERS_C, or a shifted header bitfield) causes silent decoding failures manifested asLane Decoding ErrorflagsThe PGP4 receiver instances driving
pgp4RxMasterdeliver 64-bit AXI-Stream with the SURF PGP4 conventions. If you roll your own PGP4 RX, verify the AXI-Stream config record matches SURF’sPIX2PGP_FPGA_AXI_CONFIG_Cpgp4RxLinkUpis driven per lane. Tying it high defeats the Lane Supervisor’s link-down handlingAXIL_BASE_ADDR_Gis set to a legal region of your system’s AXI-Lite map. The receiver’s internal crossbar consumesNUM_OF_SERIALIZERS_C + 1× 16 bits of address space starting from this baseasicSroandasicSroEnare on theasicClkdomain — do not drive them frompgpRxClk-domain logic; the Trigger Manager handles the crossing internallyIf
LANE_MON_GEN_Gisfalse, theLaneRxmonitor AXI-Lite ports still exist in the crossbar but returnAXI_LITE_READ_SLAVE_EMPTY_SLVERR_C. Software register reads to those regions will get a SLVERR responsePipeline the AXI-Stream output of every
LaneRxif you cannot place the receiver near the GT hard blocks. This is handled with thePIPELINE_*/*_PIPE_Ggenerics on lower-level modules; thePix2PgpAsicStreamRxwrapper itself has no such generic (the wrapper defaults are used)