Open Source Silicon Merged Pull Request RISC-V Microarchitecture

Our First Merged PR into OpenXiangShan: Hunting Subtle Pipeline Redirect Bugs in Kunminghu-v3

Ibrahim Anjum By Ibrahim Anjum & Emerald Soft Team • November 2026 • 6 min read
OpenXiangShan RISC-V PR #6917 kunminghu-v3 Chisel & Scala Difftest
Our First Merged Pull Request into OpenXiangShan Kunminghu-v3

We are thrilled to share an exhilarating engineering milestone: our very first pull request into OpenXiangShan/XiangShan—the world-leading open-source out-of-order RISC-V processor—has been officially approved and merged into kunminghu-v3, the 3rd-generation tape-out production architecture.

MERGED

OpenXiangShan/XiangShan #6917

fix(bju): assign isRVC metadata in JumpUnit backend redirect (Fixes #6000)


Target Branch: kunminghu-v3 (3rd Gen)
Reviewer: @Lemover (Zifei Zhang)
Subsystem: Branch Jump Unit (BJU)

The Path: How Building Zaqal Led Us to XiangShan

A few months ago, we published our engineering journey on Building Zaqal: An AI-Assisted, Desktop-Class Out-of-Order RISC-V Processor. In Zaqal, we set out to build an ambitious 64-bit superscalar core in Chisel from the ground up, inspired by the high-water mark set by the Institute of Computing Technology (CAS) and the XiangShan community.

Anyone who has designed an out-of-order processor knows that the real test begins when you reach Difftest—the co-simulation framework that compares every single state transition, architectural register writeback, and PC update against an ISA golden reference model (like NEMU or Spike) cycle by cycle.

"Reaching the Difftest milestone on Zaqal completely reshaped how we think about processor pipelines. When you spend weeks debugging speculative mispredictions, exception rollbacks, and redirect races, your intuition for microarchitectural control signals sharpens. At that point, we realized: we shouldn't just admire XiangShan from afar—we are equipped to dive into its codebase, test its tape-out trees, and contribute upstream."

The Anatomy of Issue #6000: When Compressed Jumps Drop Their Identity

The RISC-V Standard Compressed Extension (RVC / extension "C") is one of the most effective features of the ISA, packing common 32-bit instructions into compact 16-bit encodings. In a modern high-performance processor, instructions like compressed jumps (c.jr, c.jalr) arrive in 16-bit parcels and carry critical microarchitectural metadata through the pipeline: isRVC.

In XiangShan's high-frequency kunminghu-v3 architecture, the backend execution pipeline features a dedicated Branch Jump Unit (JumpUnit) within the arithmetic/jump execution cluster. When a jump or indirect call is evaluated, the backend verifies target addresses against frontend predictions:

The Root Cause in JumpUnit

When the JumpUnit generated backend redirect signals (for instance, following target address resolution or pipeline flushes), it properly initialized the target PC and redirect bundles. However, the redirect bundle failed to assign the isRVC metadata bit from the incoming control signals:

// In JumpUnit.scala prior to PR #6917: redirect.valid := isRedirect redirect.target := target // BUG: redirect.isRVC was omitted or defaulted to false.B! // The signal io.in.bits.ctrl.isRVC remained unpropagated to the redirect bus

Consequence: When a 16-bit compressed jump instruction triggered a backend redirect, the frontend instruction fetch unit and branch prediction engines (FTB / TAGE) received the redirect without the isRVC flag. The frontend was misled into treating the origin jump as a full 32-bit instruction, desynchronizing fetch packet alignment and branch history tables on speculative recovery.

The Fix: Preserving RVC Metadata on Backend Redirects

The solution cleanly ensures that whenever a redirect bundle is constructed in the JumpUnit, the compressed instruction metadata is explicitly preserved and propagated back to the frontend:

+ redirect.isRVC := io.in.bits.ctrl.isRVC.get

In software engineering, a single line of code might seem minor. But in an industrial-grade out-of-order microprocessor with a 6-wide rename engine, hundreds of in-flight instructions, and a deeply decoupled frontend, a single unpropagated control signal can introduce ghost mispredictions, rare pipeline deadlocks, or silent Difftest mismatches that only manifest millions of cycles into a benchmark run.

AI as a Hardware Co-Pilot: Pairing Human Intuition with Gemini

XiangShan is an enormous, sophisticated codebase written in advanced Chisel and Scala. It features cutting-edge parameterized bundles, complex implicit clocks, and intricate cross-module bus interfaces.

During our diagnosis of Issue #6000, we paired our architectural understanding of RISC-V redirect semantics with Gemini. Leveraging AI allowed us to rapidly map signal flow definitions across Chisel bundles, trace where isRVC originated in the decode/control tables, and verify the correct bundle syntax (such as unpacking .get on the Option signal type) without breaking existing interconnect contracts.

The Future of Silicon Engineering

This marks a tangible example of the new paradigm: small, agile engineering teams utilizing cutting-edge AI assistants to contribute directly to world-class open-source silicon projects that rival commercial giants.

Review, Difftest Verification, and Merge

XiangShan's continuous integration and regression infrastructure is world-class. Every pull request undergoes stringent regression suites and extensive Difftest simulation.

After submitting PR #6917, it was reviewed and approved by core maintainer @Lemover (Zifei Zhang) and merged cleanly into the kunminghu-v3 production branch.

Review Summary

  • Maintainer: Zifei Zhang (@Lemover)
  • Branch: kunminghu-v3 (Active tape-out architecture)
  • Status: Merged into upstream mainline
  • Verification: Full Difftest regression passed

What's Next for Emerald Soft & Open Silicon

This contribution is just the beginning. At Emerald Soft, we are continuing to push our dual initiatives:

  1. Advancing Zaqal: Incorporating lessons learned from XiangShan's production microarchitecture into Zaqal's Out-of-Order core, custom vector accelerators (RVV 1.0), and TileLink-C coherence interfaces.
  2. Active Upstream Participation: Continuing to monitor, test, and contribute bug fixes, performance optimizations, and verification cases to the XiangShan ecosystem.

Open silicon is no longer a theoretical exercise—it is actively transforming global computing. We are proud to play a hands-on part in shaping its future.