Fitting an M.2 SDR into an Artix-7 50T and closing timing at 61.44 MSPS
An M.2 SDR on an Artix-7 50T with an AD9364: the host-link budget, the source of 10000 extra LUTs, and timing closure of a 4 ns domain at 61.44 MSPS.
The M.2 SDR is a complete radio on an M.2 module. It has an AMD Artix-7 XC7A50T, an Analog Devices AD9364 transceiver, HyperRAM for buffering and two host paths: PCIe on the M.2 connector, and USB. I designed it for a standalone Artix-7 with no processor. The transceiver IP comes from Analog Devices' Pluto HDL. To reach 61.44 MSPS, I first had to fit the design into the device, and then close timing.
The architecture
The Artix-7 has no processing system, so the fabric implements each function:
| Function | Implementation |
|---|---|
| Host link | XDMA, PCIe Gen1 x2: AXI-Stream data path, plus an AXI-Lite master on a BAR for register access |
| External memory | HyperRAM through the open-source OpenHBMC controller |
| USB | AXI USB2 Device core over ULPI |
| Transceiver | axi_ad9361 over LVDS, with RX and TX FIR filters and a TDD engine |
Samples move through AXI4-Stream switches. On the transmit side, data comes from PCIe through a FIFO into a TX switch. It then goes through TX unpack and a FIR interpolator to the transceiver. On the receive side, the transceiver feeds a FIR decimator, then RX cpack and an RX switch. The RX switch sends samples back toward the host or into a DMA switch.
DMA movers between the stream fabric and HyperRAM let any path buffer in memory, in both directions and over both host interfaces. Through the XDMA BAR, the host reaches the HyperRAM and nine register blocks: the transceiver core, both DMAs, the TDD engine, two SPI controllers, I2C, USB and a controller block.
The host-link budget
PCIe Gen1 runs each lane at 2.5 GT/s with 8b/10b encoding. Ten line bits carry 8 data bits. This gives 250 MB/s per lane in each direction, or 500 MB/s for two lanes. That is the raw rate.
Each transfer also travels in a transaction-layer packet (TLP) with its own header. The link also carries DLLP acknowledgement and flow-control packets with the data. So the usable rate is lower.
In a memory-read test on the host, the link sustains about 450 MB/s, around 90% of the raw rate. The radio needs less. At 61.44 MSPS, with 16-bit I and 16-bit Q per sample, the RF stream is 61.44 × 4 = 245.76 MB/s. That is about 55% of the measured link throughput. On this card, the hard limits were inside the FPGA.
First failure: the design didn't fit
Synthesis passed, but place_design stopped in its pre-placement DRC:
- UTLZ-1: the design needed 37001 LUTs as logic, against 32600 available. With LUTs used as memory and shift registers, it needed 43075 LUTs, 132% of the device. Registers were at 88.5%.
- PLIO-9: the ULPI clock is on the N side of a clock-capable pin pair. Only the P side can drive a global clock buffer directly, and a HyperRAM data line uses the P side.
The overflow only appeared at implementation, because Vivado synthesizes each IP out of context. The top-level synthesis report counted only the glue logic, 621 LUTs. So it gave no warning.
A bigger device was not an option, because the XC7A50T is the largest Artix-7 in the CSG325 package. I opened the post-opt_design checkpoint and broke the usage down by block:
| Block | LUTs | Flip-flops | Notes |
|---|---|---|---|
xdma_0 |
11859 | 12444 | Expected cost of the PCIe DMA core |
smartconnect_0 |
9444 | 13454 | 1 master (XDMA BAR) to 10 register slaves across 3 clocks |
axi_ad9361 |
8799 | 14861 | 4 CORDIC tone generators (4148 LUTs) and an unused internal TDD block (960 LUTs) |
smartconnect_1 |
5029 | 6042 | 4 masters (2 DMAs, USB DMA, XDMA BAR) to HyperRAM |
axi_usb2_device_0 |
2182 | n/a | Needed as is |
The two SmartConnects used 14473 LUTs and 19496 flip-flops, more than the entire 10475-LUT overflow. SmartConnect is optimized for throughput. It instantiates an exit pipeline and separate read and write nodes per master port, roughly 800 LUTs per register slave here. On the memory side, it adds a converter and an address decoder per slave port. A register bus with a single master has no use for that logic.
Making it fit
Interconnects
I replaced both SmartConnects with AXI Interconnect in its area-optimized, shared-access mode. The register bus became one slave interface to ten master interfaces. The crossbar and all register slaves run on the 100 MHz system clock, so only the XDMA side (125 MHz) needs a clock converter. The memory bus became four slave interfaces to one HyperRAM port.
A script saved the address map before it deleted the SmartConnects, and it restored the map afterwards. The map that software sees stayed the same. Together, the two new interconnects use 1892 LUTs instead of 14473.
Transceiver core
The axi_ad9361 core had an unused internal TDD block, because the design has a separate TDD engine. I disabled that block (−960 LUTs). The four test-tone generators of the core used CORDIC DDS, at 1037 LUTs and 2 DSPs per channel. The polynomial DDS moves the sine generation into DSP blocks, at 443 LUTs and 10 DSPs per channel. Across four channels, this change saves 2376 LUTs for 32 more DSPs, and the test tones stay available.
ULPI clock
A CLOCK_DEDICATED_ROUTE FALSE constraint lets the ULPI clock reach its global buffer through general routing. This turns the placement error into a warning. The next board revision moves the clock to the P-side pin.
Speed grade
The HyperRAM SERDES clock runs at 600 MHz, three times the 200 MHz HyperRAM clock, and it passes through a global buffer. On a -1 part, that buffer has a limit of 464 MHz, and the design failed the pulse-width check by 0.489 ns. The project now targets the -2 speed grade that the board uses.
IP library version
The IP library came from the main branch of the Analog Devices HDL repository, and the block design depends on features that only main has. Later, the repository was switched to an older release branch. As a result, the IP failed to regenerate, with missing source files. I moved the repository back to main. That fixed the IP, and it also matched the Vivado version that the IP requires.
The resource use before and after these changes:
| Resource | Before | After | Available |
|---|---|---|---|
| Slice LUTs | 43075 (132%) | 25829 (79%) | 32600 |
| LUT as logic | 37001 | 23563 | 32600 |
| LUT as memory | 6074 | 2266 | 9600 |
| Registers | 57728 (88.5%) | 35391 (54%) | 65200 |
| Block RAM tiles | 33 | 33 | 75 |
| DSPs | 72 | 104 (87%) | 120 |
Second failure: timing at 61.44 MSPS
After the design placed, I added the 61.44 MSPS clock constraints, and setup failed in the sample-clock domain.
In LVDS mode, axi_ad9361 runs its logic directly on the DATA_CLK of the transceiver. In this configuration, DATA_CLK is four times the sample rate: 245.76 MHz at 61.44 MSPS. Thus the sample-clock domain is a 4 ns domain, and it includes the output side of the DAC DMA.
In its default configuration, the store-and-forward block RAM of the DAC DMA drives the output stream with no register stage. The downstream ready signal returns combinationally into the DMA. In this design, that stream fans out to the TX unpacker and to both stream FIFOs. Those paths failed setup by up to 0.251 ns on 113 endpoints. The reference projects from Analog Devices use the same default, but none of them has this fan-out on Artix fabric at 245.76 MHz.
The DMA core has a built-in register slice for this case. With the slice enabled, the core puts a register between the burst memory and the output stream in both directions: data and valid forward, ready backward. This breaks both types of failing path. The cost is one 4 ns cycle of TX latency and roughly 150 flip-flops, with no change in throughput. The final run also uses timing-driven implementation directives: ExtraTimingOpt for placement, and AggressiveExplore for physical optimization and routing.
Results
The routed design fits the XC7A50T at 79% of LUTs, 54% of registers, 44% of block RAM and 87% of DSPs, with 99.7% of slices occupied. All user-specified timing constraints are met:
| Clock domain | Period | WNS (setup) |
|---|---|---|
AD9364 interface (rx_clk) |
4 ns | +0.094 ns |
| HyperRAM | 5 ns (200 MHz) | +0.274 ns |
| PCIe user clock | 8 ns (125 MHz) | +0.301 ns |
| AXI system clock | 10 ns (100 MHz) | +0.990 ns |
| USB ULPI | 16.7 ns (60 MHz) | +6.365 ns |
WHS is +0.036 ns, and 0 of 94797 endpoints fail. Vivado estimates 1.84 W on-chip.
Trade-offs
The area-optimized crossbar allows one transaction in flight. That suits the register bus. On the memory bus, the DMAs, USB and the host take turns. HyperRAM is single-ported, so the cost is small.
The internal TDD registers of the transceiver core now read as zero. Host software uses the separate TDD engine.
The polynomial DDS leaves 16 DSPs free. If the design needs more filtering later, a disabled DDS gives back 32 DSPs, at the cost of the test tones.
The register slice adds one 4 ns cycle to the transmit path.
With the ULPI clock on general routing, its insertion delay is less predictable. The ULPI interface needs input and output delay constraints before its timing is signed off.
Lessons
- Check the utilization at implementation level early. With out-of-context IP, the top-level synthesis report shows the design as smaller than it is.
- Choose the interconnect for the traffic. SmartConnect suits high-throughput paths. For a register bus with one master, AXI Interconnect in area mode is far cheaper.
- DSP blocks can relieve LUT pressure. On a design that was short of LUTs, the change from CORDIC to polynomial DDS traded 32 DSPs for 2376 LUTs.
- Check the defaults of vendor IP at the new clock rate. The default of the DAC DMA worked in the reference designs, but not with this fan-out at 245.76 MHz on Artix.
- Check the clock buffer limits for each speed grade. The 600 MHz SERDES clock alone decided the speed grade.