Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Add SortModules Transform #1905

Merged
merged 3 commits into from
Nov 30, 2020
Merged

Add SortModules Transform #1905

merged 3 commits into from
Nov 30, 2020

Conversation

seldridge
Copy link
Member

@seldridge seldridge commented Sep 23, 2020

Add a new transform, SortModules, that will convert a FIRRTL circuit into def-before-use of modules and external modules.

The Scala FIRRTL compiler isn't particularly picky about this, but other downstream tooling may be.

This transform is not used, but is only provided such that a user can either include it if they want this invariant in their code or if they want a quick way to convert a FIRRTL circuit to respect this property, e.g., :

firrtl -i Foo.fir -X high -fct firrtl.transforms.SortModules

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you update the FIRRTL spec to include every new feature/behavior?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you state the API impact?
  • Did you specify the code generation impact?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • new feature/API

API Impact

None. Pure feature addition.

Backend Code Generation Impact

None. The new transform is optional.

Desired Merge Strategy

  • Squash: The PR will be squashed and merged (choose this if you have no preference.

Release Notes

Add optional SortModules transform to enforce define-before-use of modules/extmodules.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (1.2.x, 1.3.0, 1.4.0) ?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

@seldridge seldridge requested a review from a team as a code owner September 23, 2020 04:59
@seldridge seldridge requested review from albert-magyar and removed request for a team September 23, 2020 04:59
Adds a new transform, SortModules, that transforms a FIRRTL circuit
to enforce an invariant of modules and external modules being defined
before use. This transform is left as optional in the event that a
user may wish to have a quick way of getting the circuit to respect
this property as may be expected of some other tool, e.g., MLIR.

Signed-off-by: Schuyler Eldridge <[email protected]>
Signed-off-by: Schuyler Eldridge <[email protected]>
@jackkoenig jackkoenig added this to the 1.4.x milestone Nov 30, 2020
@jackkoenig jackkoenig added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Nov 30, 2020
@mergify mergify bot merged commit 4e46f8c into master Nov 30, 2020
mergify bot pushed a commit that referenced this pull request Nov 30, 2020
* Add SortModules to transform to def-before-use

Adds a new transform, SortModules, that transforms a FIRRTL circuit
to enforce an invariant of modules and external modules being defined
before use. This transform is left as optional in the event that a
user may wish to have a quick way of getting the circuit to respect
this property as may be expected of some other tool, e.g., MLIR.

Signed-off-by: Schuyler Eldridge <[email protected]>

* Add test of SortModules transform

Signed-off-by: Schuyler Eldridge <[email protected]>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 4e46f8c)
@mergify mergify bot added the Backported This PR has been backported to marked stable branch label Nov 30, 2020
mergify bot added a commit that referenced this pull request Nov 30, 2020
* Add SortModules to transform to def-before-use

Adds a new transform, SortModules, that transforms a FIRRTL circuit
to enforce an invariant of modules and external modules being defined
before use. This transform is left as optional in the event that a
user may wish to have a quick way of getting the circuit to respect
this property as may be expected of some other tool, e.g., MLIR.

Signed-off-by: Schuyler Eldridge <[email protected]>

* Add test of SortModules transform

Signed-off-by: Schuyler Eldridge <[email protected]>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 4e46f8c)

Co-authored-by: Schuyler Eldridge <[email protected]>
@jackkoenig jackkoenig deleted the sort-modules-transform branch December 2, 2020 18:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Addition (no impact on existing code) Backported This PR has been backported to marked stable branch Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants