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.1.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.1-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rv_profile-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8a44b58c91b315d2d26300a10ccca612b4201cc7f5b1391b56ae16de5d68331a
MD5 2787829bdac8b485ec5dfd67f4ae51d2
BLAKE2b-256 f05861cb403b6c3dcd407b2954a365e42dd8ca0a1acbd0deb6ff5e652ff76549

See more details on using hashes here.

Provenance

The following attestation bundles were made for rv_profile-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: rv_profile-0.2.1-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.8

File hashes

Hashes for rv_profile-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a12a4a730703e35121e52494bc9599b1347b83d5205640d7e33488774875250
MD5 dcf1c2dbb76b3c2aac045f9a0ed0d4cf
BLAKE2b-256 c8b5fb25cb980c4b05dbe79e728d5b3937887b86156d5d6a23bd50dd8750456d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rv_profile-0.2.1-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