-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIRRTL] Add YAML output to Grand Central #2045
Conversation
6f66983
to
8cb62d8
Compare
8cb62d8
to
f88768d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! I also love the ratio of implementation versus tests here 💯 😁
/// Conversion from a `DescribedSignal` to YAML. This is | ||
/// implemented using YAML normalization to first convert this to an internal | ||
/// `Field` structure which has a one-to-one mapping to the YAML represntation. | ||
template <> | ||
struct MappingContextTraits<DescribedSignal, Context> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow this really is the most unintuitive YAML library I've seen so far 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a while to figure out. As I've mentioned, it appears to be ad-hoc polymorphic with some type classes that you have to implement or you get a compiler error. I didn't think this pattern was reasonable to do in C++. 🤯
if (anno.isClass("sifive.enterprise.grandcentral." | ||
"GrandCentralHierarchyFileAnnotation")) { | ||
if (maybeHierarchyFileYAML.hasValue()) { | ||
emitCircuitError("more than one 'GrandCentralHierarchyFileAnnotation' " | ||
"was found, but zero or one may be provided"); | ||
removalError = true; | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like something @darthscsi will eventually want to have as a firtool CLI argument rather than an annotation 😁. But good to have it here so we are compatible with the Scala implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
; YAML: FILE "Wire/firrtl/gct/gct.yaml" | ||
; YAML: - name: MyInterface | ||
; YAML-NEXT: fields: | ||
; YAML-NEXT: - name: uint | ||
; YAML-NEXT: description: 'a wire called ''uint''' | ||
; YAML-NEXT: dimensions: [ ] | ||
; YAML-NEXT: width: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks very nice!
f88768d
to
d304914
Compare
Add support to the Grand Central Views/Interface pass to generate a YAML description of all interfaces created based on the presence of a GrandCentralHierarchyFileAnnotation. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
d304914
to
46b8d7a
Compare
Add support to the Grand Central Views/Interface pass to generate a YAML
description of all interfaces created based on the presence of a
GrandCentralHierarchyFileAnnotation.
This is doing the following things:
sv::InterfaceOp
to a YAML representation.