chipsalliance / chipsalliance/chisel

API for specifying customized transforms in ChiselStage (and dependencies?)

Open
#4,280 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

**Type of issue**: Feature Request

**Is your feature request related to a problem? Please describe.**

We have some (lightweight) customized transforms before emitting the FIRRTL. They are still written in Scala. Currently we have to [build our own stage](https://github.com/OpenXiangShan/XiangShan/blob/master/src/chisel/main/scala/top/XiangShanStage.scala#L49-L68) with the transform in ChiselStage preserved and customized transform inserted.

Is there any clear API for the users to inject some transforms into the stage? The difficult thing may be specifiying the dependency.

**Describe the solution you'd like**

Allowing customized transforms only just after `Convert`? Then the dependency issue does not exist.

**Describe alternatives you've considered**

We are copying the code of ChiselStage (the transforms) and build our own Stage.

**Additional context**
Include detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. Stack Overflow, gitter, [Scastie](https://scastie.scala-lang.org/KtzZQ3nFTea9KoNh0tRqtg).

**What is the use case for implementing this feature?**

Customized transforms to collect information before emitting FIRRTL.

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked XiangShanStage.scala example and the existing ChiselStage implementation, focusing on how transforms are preserved and where Convert runs. Determine the intended injection point and how transform dependencies should be specified. Done means a documented, supported API that lets users add customized transforms without copying ChiselStage.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.