Docs

af-pdm-rx technical documentation

This page summarizes the public technical specification for af-pdm-rx: module interface, timing assumptions, reset behavior, simulation flow, board evidence and known limitations.

Spec summary

Overview

This page condenses the public repository docs into one static technical page for human reviewers and AI agents.

Primary module

af_pdm_rx

Compatibility wrapper

pdm_rx_raw

Current release status

board-build-ready

Interface

Parameters and ports

The public interface is stable enough to review before synthesis or board bring-up starts.

ParameterDefaultMeaning
LANES1Number of PDM data pins.
SLOTS_PER_LANE11 for one microphone per line, 2 for phase-separated slots.
WORD_BITS64Packed raw PDM word width.
FIFO_ADDR_BITS4FIFO depth is 2 ** FIFO_ADDR_BITS.
HALF_PERIOD_CYCLES8clk_i cycles per half PDM clock period.
SAMPLE_DELAY_CYCLES4Delay from PDM clock transition to sample enable.
LANE_ID_BITS1Width of out_lane_o; set manually for LANES > 2.
SEQ_BITS32Width of output sequence counter.
PortDirectionMeaning
clk_iinputOnly internal clock.
rst_niinputAsynchronous active-low reset.
enable_iinputEnables PDM clocking and capture.
clear_iinputSynchronous one-cycle clear for counters, FIFO, packer and sequence state.
pdm_clk_ooutputExternal PDM microphone clock.
pdm_dat_iinputRaw PDM data lines.
out_valid_ooutputPacked word is available.
out_ready_iinputDownstream accepts the current word.
out_data_ooutputPacked raw PDM bits.
out_lane_ooutputLane ID for the word.
out_slot_ooutputSlot ID for the word.
out_seq_ooutputSequence value for the current output word.
overflow_ooutputSticky overflow/drop indicator until reset or clear_i.
stat_bits_ooutputCount of raw bits accepted by the packer.
stat_words_ooutputCount of output handshakes.
stat_drops_ooutputCount of completed words dropped because FIFO was full.

Timing

Timing and reset

The public architecture keeps all internal state on clk_i and treats pdm_clk_o as an external signal only.

pdm_clk_o frequency = clk_i frequency / (2 * HALF_PERIOD_CYCLES)

Reset

rst_ni is asynchronous active-low. clear_i is synchronous and clears counters, FIFO, packer and sequence state.

Sample timing

SAMPLE_DELAY_CYCLES selects when the input is sampled after a PDM clock transition and must remain below HALF_PERIOD_CYCLES.

PLL rule

If an exact PDM rate is required, use a board-level PLL or external clock source. Vendor PLLs stay outside rtl/.

Verification

Simulation and synthesis notes

The mandatory public test path is based on Icarus Verilog. The public repo also archives OSS Gowin-compatible build evidence for Tang Primer 20K Dock wrappers.

cd sim\nmake test
TestPurpose
tb_af_pdm_clkgenConfirms exact half-period and slot sample phase.
tb_af_pdm_sampler_monoConfirms sample-enable based single-lane capture.
tb_af_pdm_word_packerConfirms 8/16/64-bit packing, clear and expected word completion.
tb_af_pdm_fifoConfirms FIFO order, stalled output stability and simultaneous read/write from full.
tb_af_pdm_rx_monoConfirms integrated one-line path.
tb_af_pdm_rx_bit_orderConfirms first accepted bit maps to bit 0 through the integrated RX.
tb_af_pdm_rx_stereo_slotsConfirms slot 0 and slot 1 do not mix.
tb_af_pdm_rx_multi_laneConfirms 4 lanes are tagged and packed independently.
tb_af_pdm_rx_backpressureConfirms stable outputs and sequence hold under out_ready_i=0.
tb_af_pdm_rx_overflowConfirms sticky overflow and drop counter.
tb_af_pdm_rx_resetConfirms reset and clear do not create false words.
tb_af_pdm_rx_random_ready_lfsrConfirms pseudo-random ready stalls do not drop data when FIFO capacity is sufficient.
tb_pdm_rx_rawConfirms default 64-bit compatibility-wrapper smoke path.

Simulation limit

These tests do not prove microphone compatibility, board pin voltage, acoustic quality or long-run hardware stability.

Build evidence

Archived build and programming evidence exists for top_af_pdm_rx_alive, top_af_pdm_rx_clkout and top_af_pdm_rx_loopback on Tang Primer 20K Dock.

Board evidence

Board notes and known limitations

Board support is tracked as evidence, not marketing. The public matrix remains fail-closed where pins or measurements are missing.

BoardRepo statusBuild statusHardware status
Sipeed Tang Primer 20K DockBoard wrappers and constraints presentOSS Gowin-compatible build evidencedJTAG programming evidenced; measured clock, loopback and microphone evidence pending
Sipeed Tang Nano 20KBoard wrappers present; constraints fail-closedNot capturedNot captured
Sipeed Tang Mega 138K DockBoard wrappers present; constraints fail-closedNot capturedNot captured
  • Raw PDM only: no PDM-to-PCM conversion, no CIC/FIR, no audio processing.
  • Current public maturity is board-build-ready, not hardware-ready or production-ready.
  • Measured pdm_clk_o, GPIO loopback, and real microphone evidence are still pending.
  • Board support is evidence-gated. Presence of a wrapper does not equal measured board support.

Release gate

Acceptance criteria

The public bring-up guide separates build acceptance from measured hardware acceptance.

  1. Bitstream programs successfully on the target board.
  2. pdm_clk_o is measured on the expected pin.
  3. GPIO loopback is observed physically where that test is applicable.
  4. A voltage-compatible PDM MEMS microphone produces stat_words_o growth without overflow.
  5. All board claims remain tied to the exact board revision and I/O voltage assumptions used for the test.

Next step

Need a board-specific review?

If your board differs from Tang Primer 20K Dock, send the schematic or source-attributed pin map, system clock, I/O voltage details and microphone plan.