llvm / llvm/circt

[Python] 'Connect' syntax for Python bindings

Open
#905 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I would like to add "late-connect" semantics to the Python bindings. That is, be able to create an arbitrary operation without having `Value`s for each operand. The user would be able to connect them later on using a `connect(a, b)` function. For instance, something like (pseudocode):

```
mod = rtl.RTLModuleOp(
name='MyWidget',
input_ports=[('in', i32)],
output_ports=[('out', i32)],
... )

inst1 = rtl.InstanceOp(mod, "instA")
reg1 = seq.CompRegOp(i32)
inst2 = rtl.InstanceOp(mod, "instB")

connect(inst2.out, inst1.in)
connect(inst1.out, reg1.q)
connect(reg1.d, inst2.in)
```

Would create a feedback loop with a register.

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

Review the existing Python bindings and operation-construction API first, comparing how operands are currently supplied with the proposed later connect(a, b) calls. Define the supported late-connect behavior, including the feedback-loop example, and add coverage for the illustrated sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.