llvm / llvm/circt

Support for Adding Parameter Annotations to Generated Modules (e.g., as Comments)

Open
#8,525 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### Context
I'm using PyCDE to generate parameterized modules and test them using a handwritten Verilator testbench. To simplify the testbench logic, I instantiate different versions of the module under test using a single testbench. For that to work, all the modules must have the same top-level name.

To achieve this, I prefixed the module builder's argument with an underscore ("_"). With that, generated module's name doesn't contain parameters and is unified, but it creates another problem…
### Problem
By removing the parameters from the module name, I lose visibility into what configuration a given module was generated from. This makes it difficult to track which parameters were used for which module, especially when dealing with multiple variations. As a result, debugging and traceability suffer.
### Question/Feature Request
Is there a way to annotate the generated Verilog/SystemVerilog module with a comment that includes the parameter values? Ideally, I’d like to see something like this:
```verilog
// Parameters: WIDTH=32, DEPTH=64
module my_module (...);
```
If this is already supported in PyCDE, could you provide an example of how to do it? If not, would it be feasible to add such a feature?

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

The issue names PyCDE generation and generated Verilog/SystemVerilog output but no files, tests, or entry points. Start by tracing the PyCDE module-generation path and checking whether parameter values are retained for emission; done means generated modules visibly include the requested parameter values in comments.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.