llvm / llvm/circt

[Arc] Introduce a Python simulation script generator for arcilator

Open
#7,942 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Hi,

In #7929 , I refactored the C++ header generator Python script for the C++ code that wants to call the LLVM IR produced by `arcilator`. The PR mainly refactors its structure, paving the way for future modularization.

The reason for making it modular is that the script contains some core functions that can serve as a reusable library for other scripts. My proposals are as follows:

1. **Splitting the C++ header generator script**
- **Core module**: Extract the generic logic for interacting with arcilator's state json and encapsulate it into a standalone Python module.
- **Header file generator**: Import core module and only do things around generating C++ headers.

2. **Introducing a Python simulation script generator**
- Develop a Python script that utilizes the core module to generate Python simulation scripts. These scripts will use `llvmlite` to execute the LLVM IR generated by `arcilator`.
- The generated scripts will provide a simulation interface inspired by Chisel, including `poke` and `peek` methods. The generated scripts is like the generated C++ header and is used by other testbenches written in Python.
- Possible use cases: Enable rapid functional validation of circuits with minimal effort, leveraging Python’s expressive syntax for quick and intuitive simulations. With a Python interface, users could efficiently automate simulation workflows and write high-level test scripts.

Before proceeding, I would greatly appreciate your feedback on this proposal.

Thank you for your time and guidance!

Regards

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the C++ header generator Python script and the refactor in #7929, then determine how its reusable arcilator state-JSON logic could become a core module. Assess the proposed llvmlite-based simulation script and its poke/peek interface with the project maintainers; done requires an agreed scope and design for generated Python testbench scripts.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.