Wen Cao

Back to projects

Oct – Dec 2025 EECS 151 ASIC lab

6-stage RISC-V out-of-order-commit CPU with cache

A pipelined RISC-V processor with instruction and data caches, designed in Verilog and taken through synthesis and place-and-route in the SkyWater 130nm process. It was the first fully functional 6-stage out-of-order-commit CPU in the course, and it won the Apple New Silicon Initiative design contest.

Clock
96.3 MHz after place-and-route
Area
1.25 mm²
Figure of merit
45.07
Branch prediction
99.80% accurate
Recognition
Apple New Silicon Initiative winner, presented at Apple Park

The challenge

The course design challenge asked each team to build the fastest correct RISC-V CPU they could, with credit for creativity. Designs were scored on a figure of merit that combines the cycle count on a benchmark suite, the clock frequency reached after place-and-route, and the chip area, so every optimization had to pay for itself in both speed and silicon.

Datapath diagram of the 6-stage CPU
The full datapath: instruction cache, precomputed jump and branch units, register file, branch predictor, ALU, and data cache with partial load and store logic.

A six-stage pipeline

I split the classic five-stage pipeline further so each stage does less work and the clock can run faster. Fetch is split into a request and a response stage around the instruction cache, and memory access is split the same way around the data cache.

Diagram of the six pipeline stages and forwarding paths
What each stage does, with the EX-to-EX and MEM-to-EX forwarding paths, write-after-write invalidation, and the stall, flush, and corrected-PC signals.

Fetch request sends the next PC to the instruction cache and redirects on a branch misprediction. Fetch response receives the instruction and precomputes jump and branch targets, buffering on stalls. Decode reads the register file. Execute runs the ALU, computes memory addresses, and detects hazards and mispredictions. Memory request sends the data-cache request, which can be skipped when a value is forwarded from execute, and memory response commits the result.

Hand-drawn sketch of the pipeline
My first hand-drawn sketch of the six-stage design.

Getting more done per cycle

The core commits out of order: ALU instructions are allowed to finish ahead of slower memory instructions, so a cache access no longer holds up independent arithmetic behind it. Forwarding resolves data hazards without stalls in the common case, and the register file is double-pumped, writing and then reading in the same stage.

Jumps and branches are resolved early by precomputing their targets in the fetch-response stage. A branch predictor reached 99.80% accuracy on the benchmarks, which keeps the deeper pipeline from paying for mispredictions.

Caches

Both caches hit in a single cycle. I designed the cache controller as a state machine that handles hits, evictions, and refills from memory.

Photo of a hand-drawn cache state machine
The cache controller state machine, sketched on paper.
Instruction prefetch state machine diagram
The instruction-cache prefetch state machine, which fetches four instructions per request.

As groundwork for a superscalar version, I built an instruction cache that prefetches four instructions per request. It worked, but it did not improve the figure of merit enough to justify its area, so I left it out of the final scored design.

Saving area

Because area counts against the score, the control logic only keeps the bits it actually needs, for example a 16-bit PC, a 26-bit instruction in execute, and a 14-bit instruction in memory.

Physical design and verification

The design passed every RTL simulation test with and without caches, every post-synthesis test, and the extra tests I wrote myself. After place-and-route the floorplan had fewer than 20 DRC violations.

Screenshot of the chip floorplan and timing report
The placed-and-routed floorplan with its timing report.
Terminal output of the scoring script
Final scoring run: 19,065,432 simulated cycles, 96.26 MHz, 1,254,833 µm² of area, and a figure of merit of 45.07.

Back to projects