rv_profile
This project implements a cycle-accurate RISC-V profiler that extracts the cycles spent in each function from RTL simulations.
An interactive example is found here.
Installing
pip install rv-profile
Using
To profile a waveform you need to have a RISC-V .elf binary and a .vcd/.fst waveform of a RISC-V core running the binary.
This repository contains an example for the cv32e40x core. More will be added in the future.
rv_profile --elf <.elf> --fst <.vcd/.fst file> --cfg <.wal file> [--out <flamegraph.svg>]
Adapting to Other Cores
To adapt a new core to this script is easy. All you have to do is to know the name of the clk signal, detect when an instruction is committed, which address this instruction had and the raw value of the instruction (i.e. the 32-bit value).
This information can then be entered in a new config.wal file just like the ones in cv32e40x.
The config file specifies
(alias clk ...cv32e40x_core_i.clk )
(alias pc ...cv32e40x_core_i.debug_pc_o )
(alias instr ...cv32e40x_core_i.ex_wb_pipe.instr.bus_resp.rdata )
(alias fire-signal ...cv32e40x_core_i.debug_pc_valid_o )
(alias mcycle ...cv32e40x_core_i.cs_registers_i.mcycle_o )
So you have to change (alias clk ....) to (alias clk your.clk.signal)
Contributing
If you want to contribute to this project, please open an issue or a pull request. We are happy to help you with any questions you might have.
If you use this tool on a different RISC-V core please open a pull request so that we can include it in the repository.
Repositories that made this possible
Metadata
Release files for rv-profile 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rv_profile-0.2.2.tar.gz | 3.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rv_profile-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.0 MB
Release files / rv_profile-0.2.2.tar.gz
| Download URL | rv_profile-0.2.2.tar.gz |
|---|---|
| Size | 3.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
147f5ff249ae39db5f757efe949aef87115cd1792d1473ef51c639e173ea5bd7
|
|
BLAKE2b-256 checksum How to use checksums |
f90ba8afee9edfd638ccc80d783f4cbd9c730f286dcca3b3c3e476715ba584f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2025.
Transparency logRelease files / rv_profile-0.2.2-py3-none-any.whl
| Download URL | rv_profile-0.2.2-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa97faa6b2557b0c12d505a19efaf51c37d3908079f53358d677901367c7e477
|
|
BLAKE2b-256 checksum How to use checksums |
5e4cd2238c2c9d44ee0d9e848c1a244be2368b9cdac0a124ae826766dbc1709d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2025.
Transparency log