TL;DR
Researchers have developed an optimized RISC-V five-stage pipelined processor called NRP (New RISC-V Processor) that achieves a 11.07% performance boost over classic designs. By shifting branch execution logic earlier in the pipeline and utilizing "idle" cycles for smarter branch prediction, the NRP reaches a benchmark score of 3.11 CoreMark/MHz.
What Problem Does This Paper Address?
In a standard five-stage pipeline (Fetch, Decode, Execute, Memory, Write-back), "hazards" are the enemy of efficiency. Specifically, control hazards occur when the processor doesn't know which instruction to fetch next because a branch decision (like an if statement) hasn't been resolved yet.
In a classic RISC-V pipeline, a branch misprediction usually results in a two-cycle stall while the pipeline is flushed and restarted. While complex branch predictors can help, they often require significant hardware overhead. The authors sought a way to minimize these stalls and improve overall throughput with minimal extra hardware.
Methods
The authors implemented the NRP using Verilog HDL and targeted the Xilinx Artya7-35T FPGA. Their optimization strategy relies on two main pillars:
- Decoding Stage Optimization: The authors categorized RV32I instructions into "regular" and "special" (branches and jumps). They modified the Instruction Decode (ID) stage to include a "Decode and Execute Unit." For special instructions, the actual computation is moved up from the Execute (EX) stage to the ID stage. This allows the processor to resolve branch results earlier, reducing the misprediction penalty from two clock cycles down to just one.
- Branch Predictor Optimization: The NRP uses an optimized Branch History Table (BHT). Unlike traditional BHTs that default to "not taken" for new branches, the NRP's "Branch Prediction Preprocessing Unit" allows the system to identify jump instructions (like
JALandJALR) and default them to "taken" on their first encounter. - Hardware Efficiency: Interestingly, because special instructions are now handled in the ID stage, the EX stage often has "idle" cycles. The authors cleverly utilized these idle cycles to perform pre-decoding and update the branch predictor without adding significant complexity to the critical path.
Datasets
The processor's performance was evaluated using:
- CoreMark: A standard industry benchmark for measuring the performance of central processing units (CPUs) used in embedded systems.
- RISC-V Compliance Test: An official suite used to ensure the processor correctly implements the RISC-V ISA (Instruction Set Architecture).
Key Insights and Ideas
- Pipeline "Shortening" for Branches: By moving the execution of branches into the ID stage, the authors effectively shortened the feedback loop for control flow. This is a classic architectural trade-off: it makes the ID stage more complex but significantly reduces the "bubble" created by mispredictions.
- Smart Defaulting: Recognizing that direct jump instructions (
JAL/JALR) always result in a jump, the authors optimized the BHT to predict "taken" immediately, avoiding the inevitable first-time miss found in simpler predictors. - Resource Recycling: Using the "idle" time in the EX stage to update the branch predictor is an elegant way to improve accuracy without needing a more massive, power-hungry prediction engine.
Key Results
- Performance Gain: The NRP achieved a CoreMark score of 3.11 CoreMark/MHz, an 11.07% improvement over the non-optimized base version (NRP-Original).
- Comparative Success: When compared to other popular open-source RISC-V implementations, the NRP outperformed several notable cores, including:
- Hummingbird-E203: ~2.14 CoreMark/MHz
- Ibex: ~2.47 CoreMark/MHz
- tinyriscv: ~2.4 CoreMark/MHz
- Validation: The design successfully passed the official RISC-V Compliance Tests, confirming it is a standard-compliant RV32I core.
Limitations and Future Work
While the NRP shows impressive gains for a scalar, in-order processor, it still faces limitations inherent to in-order designs. The authors acknowledge that "correlation conflicts" (dependencies between instructions) still impact performance.
Future Work involves:
- Extending the design to support out-of-order execution, which would allow the processor to execute instructions as resources become available rather than strictly following program order.
- Further reducing the impact of data dependencies to push the CoreMark/MHz score even higher.
Summary updated