This repository contains a single-cycle RISC-V RV32I core written in SystemVerilog, with testbenches implemented in Python using Cocotb. The project has two main goals:
- Implement the full G extension (RV32G) including M, A, F, D, Zicsr, and Zifencei extensions
- Evolve the architecture from single-cycle to a 5-stage in-order pipeline (Fetch, Decode, Execute, Memory, Writeback)
- Fully compliant single-cycle RV32I core
- Support for all base integer instructions
-
Pipeline Implementation (5-stage in-order):
- Fetch stage
- Decode stage
- Execute stage
- Memory stage
- Writeback stage
- Hazard detection and forwarding logic
- Basic CSR implementation
- Simple memory interface
-
G Extension Components:
- M Extension: Integer multiplication and division
- A Extension: Atomic operations
- F/D Extensions: Single/double-precision floating-point
- Zicsr: Complete CSR operations
- Zifencei: Instruction-fetch fence
- Verilator or another SystemVerilog simulator
- Python 3.10+
- Cocotb (install with
pip install cocotb) - RISC-V toolchain (for compiling test programs)
git clone https://github.com/yourusername/fennec-rv32g-core.git
cd fennec-rv32g-core
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install cocotb # pip install -r requirements.txt in the futureCurrent single_cycle implementation tests:
cd rtl/single_cycle/tb && pytest test_runner.py -sFuture pipeline tests (when implemented maybe will use only make like this):
make test-pipeline- Phase 1: Complete single-cycle RV32I with full test coverage
- Phase 2: Design 5-stage pipeline architecture
- Pipeline register interfaces
- Basic hazard handling
- Phase 3: Implement pipeline stages
- Phase 4: Add forwarding and stall logic
- Phase 5: Implement G extension components
- Phase 6: Performance optimization
The planned 5-stage pipeline will implement:
- Fetch: Instruction memory access, PC calculation
- Decode: Register file read, instruction decoding
- Execute: ALU operations, branch resolution
- Memory: Data memory access
- Writeback: Register file write
Hazard handling will include:
- Data forwarding paths
- Load-use stalls
- Control hazard handling (branch prediction initially simple)
We welcome contributions! Please:
- Check open issues for current development priorities
- For pipeline work, coordinate through GitHub issues
- Follow the existing coding style
- Include comprehensive tests for new features
MIT License - see LICENSE for details.