Metadata-Version: 2.4
Name: hfim-cli
Version: 1.16.0
Summary: HFIM fault-injection controller. Drives packaged simulators (QEMU, gem5) against instrumented benchmarks and classifies the outcomes.
Author: HI-REST
License-Expression: MIT
Project-URL: Homepage, https://github.com/HI-REST/hfim
Project-URL: Documentation, https://github.com/HI-REST/hfim/tree/main/docs
Project-URL: Issues, https://github.com/HI-REST/hfim/issues
Project-URL: Changelog, https://github.com/HI-REST/hfim/releases
Keywords: fault injection,reliability,soft errors,RISC-V,QEMU,gem5,OVP,SEU
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Emulators
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES
Requires-Dist: pyyaml>=6.0
Requires-Dist: pyelftools>=0.29
Requires-Dist: jinja2>=3.0
Requires-Dist: pygdbmi>=0.11
Requires-Dist: httpx>=0.27
Requires-Dist: keyring>=24
Requires-Dist: pyserial>=3.5
Provides-Extra: keychain
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/HI-REST/hfim/main/docs/assets/hfim-wordmark-dark.svg">
    <img src="https://raw.githubusercontent.com/HI-REST/hfim/main/docs/assets/hfim-wordmark-light.svg" alt="HFIM, a HI-REST project" width="620">
  </picture>
</p>

<p align="center">
  <a href="https://pypi.org/project/hfim-cli/"><img src="https://img.shields.io/pypi/v/hfim-cli?color=127c8c&label=PyPI" alt="PyPI version"></a>
  <a href="https://pypi.org/project/hfim-cli/"><img src="https://img.shields.io/pypi/pyversions/hfim-cli?color=1d2340" alt="Python versions"></a>
  <a href="https://github.com/HI-REST/hfim/blob/main/LICENSE"><img src="https://img.shields.io/badge/licence-MIT-127c8c" alt="MIT licence"></a>
  <a href="https://hi-rest.github.io/hfim/"><img src="https://img.shields.io/badge/docs-manual-1d2340" alt="Manual"></a>
  <a href="https://hi-rest.github.io/hfim/backends/index.html"><img src="https://img.shields.io/badge/backends-QEMU%20%C2%B7%20gem5%20%C2%B7%20OVP%20%C2%B7%20boards-e0a21b" alt="Backends: QEMU, gem5, OVP, boards"></a>
</p>

HFIM (Fault-Injection Manager) is an automated framework for early reliability assessment of embedded microprocessors, both single-core and multicore. It runs a program, flips bits in registers, memory, caches or deeper hardware structures at chosen instants, and classifies what each fault did to the result. Campaigns run on QEMU, gem5 and OVP, or on a real board, and are reproducible from a seed.

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/HI-REST/hfim/main/docs/assets/hfim-architecture-dark.svg">
    <img src="https://raw.githubusercontent.com/HI-REST/hfim/main/docs/assets/hfim-architecture-light.svg" alt="A campaign file goes to the HFIM controller, which records a golden run, draws a seeded fault list and injects each fault into QEMU, gem5, OVP or a hardware board. Each run is classified as masked, sdc, detected, crash or timeout." width="100%">
  </picture>
</p>

## Quick start

You need Linux or macOS, Python 3.9 or newer, git, pipx and a running Docker. The PyPI package is `hfim-cli`; the command it installs is `hfim`.

```sh
pipx install hfim-cli                    # or: python3 -m pip install hfim-cli
hfim init                                # pick a board template; installs its simulator and SDK
cd nezha-c906-qemu
hfim run campaigns/fibonacci/register.yaml
hfim report                              # HTML report of the latest campaign
```

`hfim init` lists the templates and asks for a folder; `hfim init nezha-c906-qemu my-campaigns` does the same without asking.

`hfim doctor` reports what the machine can run and the command for anything missing. The full walkthrough is in the [manual](https://hi-rest.github.io/hfim/#install).

## What it can do

| | QEMU | gem5 | OVP | Board |
|---|:---:|:---:|:---:|:---:|
| Registers, integer and float | ✓ | ✓ | ✓ | ✓ |
| Memory: variable, section, address range, stack | ✓ | ✓ | ✓ | ✓ |
| Caches: L1D, L1I, L2 data and tags, ECC check bits | | ✓ | | |
| DRAM error models, DRAM ECC, NVM tag store | | ✓ | | |
| Pipeline: ROB, LSQ, rename map, physical registers, branch predictor, TLB | | ✓ | | |
| Coherence state, Ruby MSHR, TBE, directory and message buffers | | ✓ | | |
| Time per injection | 1 to 3 s | 10 to 60 s | about 3 s | about 13 s |

Fault models: single-bit flip, multi-bit, stuck-at-0 and stuck-at-1, permanent faults on gem5, and exact replay of a fault list from CSV. Every injection ends as `masked`, `sdc`, `detected`, `crash` or `timeout`. See [fault targets](https://hi-rest.github.io/hfim/manual/fault-targets/index.html), [fault models](https://hi-rest.github.io/hfim/manual/fault-models/index.html) and [fault classification](https://hi-rest.github.io/hfim/manual/fault-classification.html).

## Examples

The [RV64 QEMU starter](https://github.com/HI-REST/hfim/blob/main/starters/virt-rv64-qemu/README.md) includes a Fibonacci benchmark and a motor controller. The controller exchanges samples with a separate plant process that you can replace with your own model.

## Documentation

- [Manual](https://hi-rest.github.io/hfim/): install, configure and run campaigns, read the results
- [Backends](https://hi-rest.github.io/hfim/backends/index.html) and [boards](https://hi-rest.github.io/hfim/boards/index.html): what each simulator and board supports
- [Reference](https://hi-rest.github.io/hfim/reference/index.html): every configuration key and output file
- [Server](https://github.com/HI-REST/hfim/blob/main/server/README.md): an optional queue and worker fleet for campaigns too long for one machine

## Contributing

See the [contributor guide](https://github.com/HI-REST/hfim/blob/main/CONTRIBUTING.md) for setup and tests, or the [extension guide](https://hi-rest.github.io/hfim/developers/extensions.html) to add a board, probe, model or connector. Report security issues as described in [SECURITY.md](https://github.com/HI-REST/hfim/blob/main/SECURITY.md).

## Contributors

- [Sergio Cuenca Asensi](https://es.linkedin.com/in/sergio-cuenca-asensi-1a33b29)
- [Alejandro Serrano Cases](https://es.linkedin.com/in/alejandro-serrano-cases)
- [Enrique Abma Romero](https://es.linkedin.com/in/enrique-abma-romero)
- [Maxim IJzelendoorn](https://es.linkedin.com/in/maxim-ijzelendoorn)

## Licence and citation

HFIM's original software is available under the [MIT License](https://github.com/HI-REST/hfim/blob/main/LICENSE). Bundled components have their own [third-party notices](https://github.com/HI-REST/hfim/blob/main/THIRD_PARTY_NOTICES).

If you use HFIM in a publication, please [cite HI-REST](https://github.com/HI-REST/hfim/blob/main/CITATION.cff) and include the release or commit you used.

<p align="center">
  <a href="https://github.com/HI-REST">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/HI-REST/hfim/main/docs/assets/hi-rest-logo-dark.svg">
      <img src="https://raw.githubusercontent.com/HI-REST/hfim/main/docs/assets/hi-rest-logo.svg" alt="HI-REST" width="140">
    </picture>
  </a>
</p>
