[Python][HW] hw.WireOp inner_sym is inconvenient to use
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
The move to using `InnerSymAttr` in https://github.com/llvm/circt/pull/5703 broke a somewhat obscure usage of the Python API for creating `hw.WireOp`s directly.
The old code used to look like this:
```python
op = hw.ConstantOp(ir.BoolAttr.get(True))
wire_name = "Example"
wire = hw.WireOp(op, name=wire_name, inner_sym=wire_name)
```
Now we have:
```python
op = hw.ConstantOp(ir.BoolAttr.get(True))
wire_name = "Example"
wire = hw.WireOp(op, name=wire_name,
inner_sym=hw.InnerSymAttr.get(ir.StringAttr.get(wire_name)))
```
Which doesn't seem better.
`sv.WireOp()` got a `sym_name` parameter that does the right thing:
```python
if sym_name is not None:
attributes["inner_sym"] = hw.InnerSymAttr.get(StringAttr.get(sym_name))
```
The same fix should probably be applied to `WireOp`, and maybe just generally to all `hw` operations
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the Python API entry points for hw.WireOp and sv.WireOp, focusing on their inner_sym and sym_name parameters and the InnerSymAttr construction shown in the issue. Check whether other hw operations expose the same inconvenient pattern; done means WireOp accepts the simpler string form and any broader scope is addressed consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100