Home / Labs / MiniGPU 2D Processor

MiniGPU โ€“ Cycle-Accurate 2D Graphics Processor

โ— Release v1.0 (Stable) โ— Synthesizable Verilog RTL Icarus Verilog 2012 160 ร— 120 RGB888 Dual-Port 19,200 SRAM Pineda Edge Rasterizer VCD Waveforms
Clock Rate:
Clock Cycles: 0
Pixels Rendered: 0
Commands Done: 0 / 0
FSM State: IDLE
๐ŸŽจ Graphics Command Studio
๐Ÿ“ Hardware IP Architecture Diagram
Click any block to inspect synthesizable RTL, ports & registers
๐Ÿ–ฅ๏ธ Framebuffer (160ร—120 RGB888)
โ— Live SRAM
Hover: (0, 0) RGB: #000000 Addr: 0
Raster Scan Pixel: (0, 0)
Port A Write Address: 0x0 (0)
Port A Write Enable: IDLE (0)
Display Port B Scan: (0, 0) | DE=0

Rasterization Controller

rasterizer_controller.v Synthesizable Verilog RTL

Hardware Timing Diagram & Digital Signal Traces

Cycle-accurate samples captured clock-by-clock

Icarus Verilog 2012 Engine Output

Backend: Linux / x86_64 / Icarus Verilog v12
Click "Run Remote RTL Sim" to compile the complete synthesizable RTL codebase and execute all 7 hardware verification testbenches on the cloud Icarus Verilog simulator.

Yosys Open-Source Synthesis Report & Gate-Level Statistics

Target Technology: Generic SkyWater 130nm / FreePDK45 CMOS Standard Cell Library.

=== MINIGPU_TOP SYNTHESIS SUMMARY === Design Module: minigpu_top (160 x 120 Resolution, 24-bit RGB888) Target Clock Frequency: 50.0 MHz (Period: 20.00 ns) Estimated Critical Path: 11.45 ns (Slack: +8.55 ns - Timing Met) 1. Logic Gate & Cell Breakdown: --------------------------------------------------------- Cell Type Count Total Area (um^2) --------------------------------------------------------- D-Flip-Flops (DFF) 612 3,672 Dual-Port SRAM (BRAM) 19,200 x 24-bit (Embedded Macro) Adders / Subtractors 14 1,120 Signed Multipliers 6 4,800 Comparators 18 720 Multiplexers (MUX) 42 1,260 Logic Gates (NAND/NOR) 480 1,440 --------------------------------------------------------- Total Estimated Core Logic Area: 13,012 um^2 (Excluding SRAM Macro) 2. Module Hierarchy Area Distribution: --------------------------------------------------------- minigpu_top 100.0% โ”œโ”€โ”€ cmd_interface 1.2% โ”œโ”€โ”€ command_fifo (16x86) 6.8% โ”œโ”€โ”€ command_decoder 8.4% โ”œโ”€โ”€ rasterizer_controller 14.2% โ”œโ”€โ”€ rectangle_rasterizer 4.1% โ”œโ”€โ”€ circle_rasterizer (DSP) 18.5% โ”œโ”€โ”€ triangle_rasterizer (Pineda) 28.4% โ”œโ”€โ”€ pixel_color_generator 1.5% โ”œโ”€โ”€ framebuffer (Dual-Port SRAM) 6.2% (Interface logic) โ””โ”€โ”€ display_controller 10.7% --------------------------------------------------------- Synthesis Status: SUCCESS (Zero Inferred Latches, Zero Multidrive Nets)

Hardware Microarchitecture of MiniGPU

MiniGPU is a hardware-accurate 2D graphics processor designed in synthesizable Verilog HDL. It demonstrates the fundamental microarchitectural principles of hardware graphics acceleration: command streaming, FIFO decoupling, bounding-box rasterization, mathematical shape coverage evaluation, dual-port video memory (SRAM), and display timing generation.

1. Coordinate System & Memory Geometry

MiniGPU targets a 160 ร— 120 display resolution with 24-bit RGB888 true color. The horizontal coordinate \(X\) spans \(0 \le X \le 159\) (8 bits), and the vertical coordinate \(Y\) spans \(0 \le Y \le 119\) (7 bits). The framebuffer consists of exactly 19,200 words:

\(\text{Address} = Y \times 160 + X = (Y \ll 7) + (Y \ll 5) + X\)

By decomposing the multiplication \(Y \times 160\) into binary shifts \((Y \times 128) + (Y \times 32)\), the hardware avoids an expensive general-purpose multiplier in the memory addressing unit, requiring only two barrel shifts and an adder.

2. Pineda Edge-Function Triangle Rasterization

Triangle coverage is evaluated using the Juan Pineda edge-function algorithm in signed fixed-point integer arithmetic. Given three vertices \(V_0(x_0, y_0)\), \(V_1(x_1, y_1)\), and \(V_2(x_2, y_2)\), each edge defines a 2D cross-product:

\(E_{01}(x, y) = (x - x_0)(y_1 - y_0) - (y - y_0)(x_1 - x_0)\)
\(E_{12}(x, y) = (x - x_1)(y_2 - y_1) - (y - y_1)(x_2 - x_1)\)
\(E_{20}(x, y) = (x - x_2)(y_0 - y_2) - (y - y_2)(x_0 - x_2)\)

A pixel \((x, y)\) lies inside the triangle if and only if all three edge functions share the same sign. MiniGPU supports both clockwise (CW) and counter-clockwise (CCW) triangle windings:

\(\text{Hit} = (E_{01} \ge 0 \land E_{12} \ge 0 \land E_{20} \ge 0) \lor (E_{01} \le 0 \land E_{12} \le 0 \land E_{20} \le 0)\)

3. Circle Rasterization via Squared-Distance Arithmetic

Circles are rendered using the algebraic distance equation: \((x - c_x)^2 + (y - c_y)^2 \le r^2\). To eliminate the need for an expensive square root operator, the hardware computes the squared Euclidean distance directly using signed arithmetic intermediates sized to 20 bits, guaranteeing zero arithmetic overflow under all coordinates.

4. True Dual-Port Framebuffer Architecture

The video memory employs two independent, concurrent synchronous ports:

  • Port A (Render Write): Driven by the rasterizer controller. Updates memory pixels asynchronously as drawing commands are processed.
  • Port B (Display Read): Driven by the display controller. Continuously scans the visible display grid at real-time video rates with 1 clock cycle of synchronous pre-fetch latency compensation.