Skip to main content

A tool for generating flamegraphs of RISC-V programs running on RTL simulations

Project description

rv_profile

PyPI version License

FlameGraph

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rv_profile-0.2.2.tar.gz (3.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rv_profile-0.2.2-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file rv_profile-0.2.2.tar.gz.

File metadata

  • Download URL: rv_profile-0.2.2.tar.gz
  • Upload date:
  • Size: 3.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rv_profile-0.2.2.tar.gz
Algorithm Hash digest
SHA256 147f5ff249ae39db5f757efe949aef87115cd1792d1473ef51c639e173ea5bd7
MD5 fee9c2f5169b9549d8632ef6b76d2403
BLAKE2b-256 f90ba8afee9edfd638ccc80d783f4cbd9c730f286dcca3b3c3e476715ba584f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rv_profile-0.2.2.tar.gz:

Publisher: python-publish.yml on vlsi-lab/rv_profile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rv_profile-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: rv_profile-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rv_profile-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa97faa6b2557b0c12d505a19efaf51c37d3908079f53358d677901367c7e477
MD5 5477c24f613240b4e3777646337120da
BLAKE2b-256 5e4cd2238c2c9d44ee0d9e848c1a244be2368b9cdac0a124ae826766dbc1709d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rv_profile-0.2.2-py3-none-any.whl:

Publisher: python-publish.yml on vlsi-lab/rv_profile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page