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

FIRRTL version support #2543

Merged
merged 10 commits into from
Aug 26, 2022
Merged

FIRRTL version support #2543

merged 10 commits into from
Aug 26, 2022

Conversation

zyedidia
Copy link
Contributor

Now that FIRRTL supports version specifiers (chipsalliance/firrtl-spec#30), the parser here should accept versions and the serializer should emit a version. The current version of FIRRTL is 1.1.0. This FIRRTL compiler will throw an error if used to compile FIRRTL with a version greater than 1.1.x (e.g., >= 1.2.0). The serializer currently emits FIRRTL version 1.1.0.

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

The serializer will now emit a FIRRTL version number, and the parser will accept one and throw an error if it is above 1.1.0.

Backend Code Generation Impact

No impact.

Desired Merge Strategy

Squash.

Release Notes

The serializer will now emit a FIRRTL version number, and the parser will accept one and throw an error if it is above 1.1.0.

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?

@CLAassistant
Copy link

CLAassistant commented Aug 18, 2022

CLA assistant check
All committers have signed the CLA.

@@ -10,6 +10,8 @@ object Serializer {
val NewLine = '\n'
val Indent = " "

val version = "1.1.0"
Copy link
Member

@seldridge seldridge Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would probably be better described as a product and if this was defined globally so this can be used in parser/Listener.scala:

case class Version(major: Int, minor: Int, patch: Int) extends scala.math.Ordered[Version] {
  override def serialize: String = ???
  override def compare(that: Version): Bool = ???
}

This would simplify some things later, e.g., exiting if the input version is too new.

Also, should this be defined in IR.scala?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with it being in IR.scala but I'd like to avoid modifying anything in IR.scala if we can avoid it (to avoid backwards compatibility concerns with existing transforms).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a Version class in Serializer.scala that is similar to this. Instead of having a compare method it has an incompatible method, since I think compare should check the patch version, but we want to be able to accept larger versions as long as only the patch is larger. Let me know if this needs more changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is reasonable. If we need to do more work here later we can but this looks good enough to me.

@jackkoenig jackkoenig added this to the 1.5.x milestone Aug 18, 2022
Copy link
Contributor

@jackkoenig jackkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@ekiwi ekiwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ekiwi ekiwi added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Aug 26, 2022
@mergify mergify bot merged commit 19fe90b into chipsalliance:master Aug 26, 2022
mergify bot pushed a commit that referenced this pull request Aug 26, 2022
* Parse version and hardcode emitted version

* Throw error if version is too high

* Parse version even if rest is invalid

* Change pattern match to if statement

* Improve version grammar

* Update tests

* Remove outdated comment

* Simplify grammar and use version class

* Simplify and add no version test

* Fix for conflicting lexer rule

(cherry picked from commit 19fe90b)
@mergify mergify bot added the Backported This PR has been backported to marked stable branch label Aug 26, 2022
mergify bot added a commit that referenced this pull request Sep 12, 2022
* FIRRTL version support (#2543)

* Parse version and hardcode emitted version

* Throw error if version is too high

* Parse version even if rest is invalid

* Change pattern match to if statement

* Improve version grammar

* Update tests

* Remove outdated comment

* Simplify grammar and use version class

* Simplify and add no version test

* Fix for conflicting lexer rule

(cherry picked from commit 19fe90b)

* Waive binary compatibility breakages and bump previous artifact

Co-authored-by: Zachary Yedidia <[email protected]>
Co-authored-by: Jack Koenig <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

6 participants