retro-silicon

Components

video/hdmi

Video timing and TMDS encoding for a DVI-compatible HDMI output

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

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

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

Video timing and TMDS encoding for an HDMI output in DVI mode: picture and syncs, no data islands yet (audio and InfoFrames come with the APU). Every HDMI sink accepts DVI. Each pixel clock it gives the three 10-bit symbols to send; a board’s serializers send them at ten times the pixel rate, bit 0 first. The defaults are CEA-861’s 1280x720 at 60 Hz, a 74.25 MHz pixel clock.

Modules hdmi (the timing and three encoders) and tmds_encoder (one channel, DVI 1.0 section 3.2.2).

Timing

Each line is H_ACTIVE pixels of picture, then the front porch, the sync pulse and the back porch; each frame is V_ACTIVE such lines, then the vertical porches and sync. Vertical sync starts and ends with a line’s horizontal sync, as CEA-861 has it for progressive modes.

The pixel source sees the position to draw (x, y, and act inside the picture) and returns that pixel’s colour LATENCY clocks later; the syncs and blanking go through the same delay to meet it. The symbols come out two clocks after the colour, through the encoder’s two register stages (one per step of the spec’s algorithm, so 74.25 MHz has room). During blanking each encoder sends control symbols (channel 0 carries {vsync, hsync}) and its running disparity restarts from zero, so a line’s symbols depend only on its pixels.

Ports

PortDirWidthMeaning
clk, rstin1Pixel clock; synchronous reset to the frame’s first pixel
x, yout12Position to draw this clock
actout1x, y is inside the picture
frame, lineout1High at a frame’s first position, and at each line’s
rgbin24{red, green, blue} for the position LATENCY clocks ago
tmds0, tmds1, tmds2out10Symbols for blue (with the syncs), green and red

Parameters

ParameterDefaultMeaning
H_ACTIVE, H_FRONT, H_SYNC, H_BACK1280, 110, 40, 220Line: picture, front porch, sync, back porch, in pixels
V_ACTIVE, V_FRONT, V_SYNC, V_BACK720, 5, 5, 20Frame, the same in lines
H_POS, V_POS1, 1Sync pulses active high
LATENCY2Clocks from x, y to rgb, 1 or more

Status

Sim tests (sim/tmds_model.hpp holds a TMDS encoder written from the DVI spec and a receiver’s decoder, which the harness uses too):

On the board: in systems/nes on a Tang Nano 20K, the CRC of a whole display frame’s symbols matches the sim’s for oam_read and full_palette, frame after frame.

References