retro-silicon

Components

audio/resampler

An audio level to signed PCM at a lower rate - low-pass, decimate, DC block - with a save-state port

Portable Sim: passing (6 passed). Used by Nintendo Entertainment System. Source.

BoardStateRun
Sipeed Tang Nano 20Kverified2026-10-29, at 25e2339
Sipeed Tang Console 138Kstale2026-10-25, at f2536e6
TUL PYNQ-Z2verified2026-10-29, at 25e2339

Verified: the latest run on that board of a system using it passed every test, and the component hasn't changed since. Stale: it has changed since that run.

README

Takes an unsigned audio level at a high rate, one sample per ce, to signed 16-bit PCM at a lower rate. The defaults take the NES’s CPU-cycle levels to 48 kHz against a 60 Hz display: 800 samples per 29,780.5 cycles, the average NES frame with rendering on. In integer arithmetic throughout, so the output depends only on the inputs: the same in the sim and on any board.

Module resampler.

What it does

Ports

PortDirWidthMeaning
clk, rstin1Clock; synchronous reset to silence
ce, inin1, 16An input sample, unsigned
validout1A one-clock pulse the clock after a ce that made a sample
outout16The latest sample, signed
st_addr, st_rdata, st_we, st_wdata2, 32, 1, 32Save-state port: 4 words, {count, sum}, {the last average, the accumulator}, y, and one unused

Parameters

ParameterDefaultMeaning
NUM, DEN1600, 59561Output samples per DEN inputs; NUM < DEN < 65536, DEN / NUM <= 60
HPF9The high-pass filter’s shift
SAVE_STATE10 leaves out the save-state port’s logic: writes do nothing and reads give 0. For a board short of logic

Status

Sim tests: