cv32e40p
CV32E40P is an in-order 4-stage RISC-V RV32IMFCXpulp CPU based on RI5CY from PULP-Platform
Top Related Projects
Ibex is a small 32 bit RISC-V CPU core, previously known as zero-riscy.
SonicBOOM: The Berkeley Out-of-Order Machine
Rocket Chip Generator
A FPGA friendly 32 bit RISC-V CPU implementation
The CORE-V CVA6 is an Application class 6-stage RISC-V CPU capable of booting Linux
Source files for SiFive's Freedom platforms
Quick Overview
The cv32e40p repository is an open-source RISC-V core developed by OpenHW Group. It implements the RV32IMC instruction set architecture and is designed for embedded and IoT applications. The core is part of the CORE-V family of open-source RISC-V cores.
Pros
- Open-source and freely available for use and modification
- Implements the popular RISC-V architecture, providing a standardized and extensible instruction set
- Suitable for low-power and area-constrained embedded applications
- Supported by a community of developers and the OpenHW Group
Cons
- May require additional effort to integrate into existing systems compared to proprietary solutions
- Performance may not be as optimized as some commercial alternatives
- Documentation and support might be less comprehensive than commercial offerings
- Potential for fragmentation or divergence in implementations due to its open-source nature
Code Examples
As this is a hardware design project and not a software library, there are no direct code examples to provide. The repository contains RTL (Register Transfer Level) code written in SystemVerilog, which describes the hardware implementation of the RISC-V core.
Getting Started
While there's no traditional software "getting started" guide, here are the basic steps to begin working with the cv32e40p core:
-
Clone the repository:
git clone https://github.com/openhwgroup/cv32e40p.git
-
Ensure you have the necessary tools installed, such as a SystemVerilog simulator (e.g., Verilator, ModelSim) and synthesis tools if you plan to implement the design on hardware.
-
Familiarize yourself with the repository structure, focusing on the
rtl
directory which contains the core RTL files. -
Review the documentation in the
docs
directory for information on the core's architecture, features, and verification environment. -
To simulate or synthesize the design, you'll need to set up a project using your chosen EDA tools, incorporating the RTL files from the repository.
-
For more detailed instructions and guidelines, refer to the project's documentation and the OpenHW Group's resources.
Competitor Comparisons
Ibex is a small 32 bit RISC-V CPU core, previously known as zero-riscy.
Pros of Ibex
- More extensive documentation and user guides
- Broader range of supported extensions (e.g., RV32E, RV32M)
- Active development with frequent updates and contributions
Cons of Ibex
- Slightly higher power consumption
- Less optimized for specific applications compared to CV32E40P
- May require more area on chip due to additional features
Code Comparison
CV32E40P:
module cv32e40p_core
import cv32e40p_pkg::*;
#(
parameter PULP_XPULP = 0,
parameter PULP_CLUSTER = 0,
parameter FPU = 0,
parameter PULP_ZFINX = 0,
parameter NUM_MHPMCOUNTERS = 1
)
Ibex:
module ibex_core #(
parameter bit PMPEnable = 1'b0,
parameter int unsigned PMPGranularity = 0,
parameter int unsigned PMPNumRegions = 4,
parameter int unsigned MHPMCounterNum = 0,
parameter int unsigned MHPMCounterWidth = 40,
parameter bit RV32E = 1'b0,
parameter bit RV32M = 1'b1,
parameter bit RV32B = 1'b0,
parameter bit BranchTargetALU = 1'b0,
Both repositories offer open-source RISC-V cores, but they cater to slightly different use cases. CV32E40P focuses on embedded applications with PULP extensions, while Ibex provides a more general-purpose core with broader RISC-V extension support. The code comparison shows differences in parameterization and feature sets between the two cores.
SonicBOOM: The Berkeley Out-of-Order Machine
Pros of riscv-boom
- Higher performance with out-of-order execution and superscalar design
- More advanced features like branch prediction and speculative execution
- Scalable architecture supporting different configurations (small, medium, large)
Cons of riscv-boom
- Higher complexity and resource usage
- Potentially longer development and verification cycles
- May be overkill for simpler embedded applications
Code comparison
cv32e40p (simple in-order pipeline):
always_comb begin
instr_valid = id_ready_i & (~halt_if_i) & id_in_ready_o;
pc_set_o = 1'b0;
pc_mux_o = PC_BOOT;
exc_pc_mux_o = EXC_PC_IRQ;
end
riscv-boom (out-of-order execution):
class Scheduler(
num_entries: Int,
num_wakeup_ports: Int,
issue_width: Int,
plWidth: Int,
numLlPorts: Int,
numWbPorts: Int,
numPregsMSB: Int
) extends BoomModule
The code snippets highlight the difference in complexity between the two designs. cv32e40p shows a simple combinational logic block for instruction fetching, while riscv-boom demonstrates a more complex scheduler class for managing out-of-order execution.
Rocket Chip Generator
Pros of rocket-chip
- More comprehensive and feature-rich RISC-V implementation
- Supports multiple core configurations and customization options
- Extensive ecosystem and tooling support
Cons of rocket-chip
- Higher complexity and steeper learning curve
- Larger codebase, potentially more challenging to modify or debug
- May require more resources for synthesis and implementation
Code Comparison
cv32e40p (RISC-V core implementation):
module cv32e40p_core
import cv32e40p_pkg::*;
#(
parameter PULP_XPULP = 0,
parameter PULP_CLUSTER = 0,
parameter FPU = 0,
parameter PULP_ZFINX = 0,
parameter NUM_MHPMCOUNTERS = 1
)
(
// Clock and Reset
input logic clk_i,
input logic rst_ni,
rocket-chip (Rocket core generator):
class Rocket(
traceParams: TraceParams = TraceParams(),
val dcache: Option[DCacheParams] = Some(DCacheParams()),
val icache: Option[ICacheParams] = Some(ICacheParams()),
val mmu: Option[MMUParams] = Some(MMUParams()),
val core: RocketCoreParams = RocketCoreParams()
)(implicit p: Parameters) extends CoreModule()(p)
with HasRocketCoreParameters
with HasL1CacheParameters {
A FPGA friendly 32 bit RISC-V CPU implementation
Pros of VexRiscv
- Written in SpinalHDL, allowing for more flexible and modular design
- Highly configurable with various optional features and extensions
- Better performance in some benchmarks due to optimized implementation
Cons of VexRiscv
- Less widespread industry adoption compared to cv32e40p
- Documentation may be less comprehensive for some users
- Potentially steeper learning curve due to SpinalHDL
Code Comparison
cv32e40p (SystemVerilog):
module cv32e40p_core
import cv32e40p_pkg::*;
#(
parameter PULP_XPULP = 0,
parameter PULP_CLUSTER = 0,
parameter FPU = 0,
parameter PULP_ZFINX = 0,
parameter NUM_MHPMCOUNTERS = 1
)
VexRiscv (SpinalHDL):
case class VexRiscvConfig(
plugins : Seq[Plugin[VexRiscv]],
prediction : BranchPrediction = NONE,
bypassExecute0 : Boolean = false,
bypassExecute1 : Boolean = false,
bypassWriteBack : Boolean = false,
bypassWriteBackBuffer : Boolean = false
)
The CORE-V CVA6 is an Application class 6-stage RISC-V CPU capable of booting Linux
Pros of cva6
- Supports 64-bit RISC-V architecture, offering more advanced computing capabilities
- Implements out-of-order execution, potentially improving performance
- Includes a more complex pipeline, suitable for high-performance applications
Cons of cva6
- Higher complexity and resource requirements compared to cv32e40p
- Potentially longer development and verification cycles
- May consume more power, making it less suitable for low-power applications
Code Comparison
cv32e40p:
module cv32e40p_core
import cv32e40p_pkg::*;
#(
parameter PULP_XPULP = 0,
parameter PULP_CLUSTER = 0,
parameter FPU = 0,
parameter PULP_ZFINX = 0,
parameter NUM_MHPMCOUNTERS = 1
)
cva6:
module ariane import ariane_pkg::*; #(
parameter int unsigned ADDR_WIDTH = 64,
parameter int unsigned DATA_WIDTH = 64,
parameter bit RV32 = 0,
parameter int unsigned HART_ID = 0
) (
The code snippets show the module declarations for both cores, highlighting the differences in architecture and configuration options.
Source files for SiFive's Freedom platforms
Pros of freedom
- More comprehensive SoC design, including CPU cores, peripherals, and system integration
- Supports multiple RISC-V core configurations (E31, S51, U54)
- Includes additional tools and documentation for FPGA implementation
Cons of freedom
- Larger and more complex codebase, potentially harder to understand and modify
- Less focused on a single core implementation, which may be overkill for some projects
- May require more resources to synthesize and implement on FPGAs
Code comparison
cv32e40p (RV32IMC implementation):
module cv32e40p_core
import cv32e40p_pkg::*;
#(
parameter PULP_XPULP = 0,
parameter PULP_CLUSTER = 0,
parameter FPU = 0,
parameter PULP_ZFINX = 0,
parameter NUM_MHPMCOUNTERS = 1
)
freedom (RV64GC implementation):
module Rocket
(
input clock,
input reset,
input hartid,
output [63:0] io_imem_req_bits_addr,
input io_imem_resp_valid,
input [63:0] io_imem_resp_bits_data,
The cv32e40p focuses on a 32-bit RISC-V core, while freedom's Rocket core is a 64-bit implementation with more advanced features. The freedom project provides a broader ecosystem for RISC-V development, while cv32e40p offers a more targeted solution for embedded applications.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
OpenHW Group CORE-V CV32E40P RISC-V IP
CV32E40P is a small and efficient, 32-bit, in-order RISC-V core with a 4-stage pipeline that implements the RV32IM[F|Zfinx]C instruction set architecture, and the PULP custom extensions for achieving higher code density, performance, and energy efficiency [1], [2]. It started its life as a fork of the OR10N CPU core that is based on the OpenRISC ISA. Then, under the name of RI5CY, it became a RISC-V core (2016), and it has been maintained by the PULP platform team until February 2020, when it has been contributed to OpenHW Group.
Documentation
The CV32E40P user manual can be found in the docs folder and it is captured in reStructuredText, rendered to html using Sphinx. These documents are viewable using readthedocs and can be viewed here.
Verification
The verification environment for the CV32E40P is not in this Repository. There is a small, simple testbench here which is useful for experimentation only and should not be used to validate any changes to the RTL prior to pushing to the master branch of this repo.
The verification environment for this core as well as other cores in the OpenHW Group CORE-V family is at the core-v-verif repository on GitHub.
The Makefiles supported in the core-v-verif project automatically clone the appropriate version of the cv32e40p RTL sources.
Changelog
A changelog is generated automatically in the documentation from the individual pull requests. In order to enable automatic changelog generation within the CV32E40P documentation, the committer is required to label each pull request that touches any file in 'rtl' (or any of its subdirectories) with Component:RTL and label each pull request that touches any file in 'docs' (or any of its subdirectories) with Component:Doc. Pull requests that are not labeled or labeled with ignore-for-release are ignored for the changelog generation.
Only the person who actually performs the merge can add these labels (you need committer rights). The changelog flow only works if at most 1 label is applied and therefore pull requests that touches both RTL and documentation files in the same pull request are not allowed.
Constraints
Example synthesis constraints for the CV32E40P are provided.
Contributing
We highly appreciate community contributions. We are currently using the lowRISC contribution guide. To ease our work of reviewing your contributions, please:
- Create your own fork to commit your changes and then open a Pull Request to the dev branch.
- Split large contributions into smaller commits addressing individual changes or bug fixes. Do not mix unrelated changes into the same commit!
- Do not mix updates within the 'rtl' directory with updates within the 'docs' directory ino the same pull request.
- Write meaningful commit messages. For more information, please check out the the Ibex contribution guide.
- If asked to modify your changes, do fixup your commits and rebase your branch to maintain a clean history.
- If the PR gets accepted and merged into the the dev branch, an action is triggered automatically to check whether the changes are logically equivalent to the frozen RTL on a given set of parameters. If the changes are logically equivalent, the dev branch is automatically merged into the master branch. Otherwise, we need to investigate manually. If a bug is found, thus the changes are not logically equivalent, we follow the procedure documented here.
For more details on how this is implemented, have a look at this page.
When contributing SystemVerilog source code, please try to be consistent and adhere to the lowRISC Verilog coding style guide.
To get started, please check out the "Good First Issue" list.
The RTL code has been formatted with "Verible" v0.0-1149-g7eae750.
Run ./util/format-verible
to format all the files.
Issues and Troubleshooting
If you find any problems or issues with CV32E40P or the documentation, please check out the issue tracker and create a new issue if your problem is not yet tracked.
References
Top Related Projects
Ibex is a small 32 bit RISC-V CPU core, previously known as zero-riscy.
SonicBOOM: The Berkeley Out-of-Order Machine
Rocket Chip Generator
A FPGA friendly 32 bit RISC-V CPU implementation
The CORE-V CVA6 is an Application class 6-stage RISC-V CPU capable of booting Linux
Source files for SiFive's Freedom platforms
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot