STREAMING RTL / IMAGE PROCESSING / VERIFICATION
From pixels to edges. Built to keep moving.
Streaming Sobel edge-detection accelerator
I designed a synthesizable SystemVerilog accelerator that turns an 8-bit grayscale pixel stream into an edge-strength image. Two line buffers build each 3×3 neighborhood without storing a full frame. The engineering challenge was keeping the arithmetic, pixel ordering, and pipeline state correct through stalls, input gaps, and frame transitions.
- 2 rows
- Width-proportional image storage
- 152,720
- Exact real-image output comparisons
- 0
- Mismatched demo pixels
01A / REAL-IMAGE RTL DEMONSTRATION
The output is from the hardware simulation.
Python prepares the grayscale input; the SystemVerilog design produces the edge image. An independently implemented Python model checks every accepted RTL output. Both continuous operation and randomized input gaps/output stalls produced exactly the same result.

8-bit grayscale pixels, accepted in raster order.

64,516 pixels matched Python exactly in each mode.
WHAT THE RESULT PROVES
Arithmetic and flow control agree.
Zero mismatches and zero maximum absolute error in the photograph runs. The 152,720 comparison total includes two image sizes—256 × 256 and 128 × 96—each tested in continuous and stalled modes.
Valid-only processing crops the one-pixel border. The design computes min(255, |Gx| + |Gy|), without normalization or a square root.
View output under stalls ↗Image: NASA / scikit-image, public domain. Grayscale conversion and resizing happen in Python before RTL processing. Image provenance ↗
01B / ARCHITECTURE AND TRADEOFFS
A small memory footprint. Explicit control of every transfer.
Window generation without a frame buffer
Two rows and nine local pixel registers form the moving 3×3 window. At width 256, the row arrays hold 4,096 bits rather than storing all 65,536 frame pixels. Position tracking excludes stale data at row/frame boundaries, so the memory arrays do not need reset.
Signed arithmetic that survives corner cases
Operands are widened before shifts and weighted sums. Each gradient uses 11 signed bits, the magnitude uses a 12-bit intermediate, and saturation happens before narrowing to 8 bits. This avoids truncation, unsigned wraparound, and accidental reinterpretation of positive values as negative.
Backpressure, reset, and draining
The shared enable is !out_valid || out_ready. A blocked output freezes data, validity, row memories, and coordinates together. Reset overrides a stall and discards pending work. When input stops, existing windows can still move to the output.
Throughput with clear conditions
Simulation measured one accepted input per clock without stalls, and one output per clock during interior runs. The 256×256 demo produced runs of 254 consecutive outputs. Output becomes valid one cycle after acceptance of a window’s bottom-right pixel; an always-ready consumer transfers it on the following edge.
01C / VERIFICATION AND SYNTHESIS
Evidence at the arithmetic, protocol, and netlist levels.
| Verification layer | Completed evidence | What it checks |
|---|---|---|
| Arithmetic RTL | 6,822 vectors | Signed gradients, absolute values, magnitude, and saturation. |
| Window generation | 502 exact windows / 62 frames | Neighborhood formation, dimensions, gaps, reset, and transitions. |
| Continuous streaming | 1,991 exact transfers / 66 frames | Ordering, output count, cycle latency, throughput, and draining. |
| Flow control | 17,376 exact transfers | Six sizes, two seeds, random gaps/stalls, directed 30-cycle stalls, and reset while blocked. |
| Real-image RTL | 152,720 exact transfers | Two image sizes in continuous and stalled modes; zero numerical error. |
| Synthesized 8×6 netlist | 2,568 exact comparisons | Continuous and stalled behavior after generic synthesis. |
These are separate finite regressions, not counts of unique exhaustive cases. Fixed seeds, timeouts, source hashes, tool versions, and saved outputs make the results reproducible.
Synthesis checked the storage strategy
Yosys structurally checked four configurations, including 256×256. It recognized two width-proportional row memories before generic mapping. Changing image height at a fixed width left row-memory size unchanged.
A deliberate next step
The generic flow maps memory to registers and multiplexers; it does not establish FPGA block RAM use. The simulation-first project is complete. FPGA deployment, device utilization, maximum clock frequency, power, and software speedup remain unmeasured.
