-
Notifications
You must be signed in to change notification settings - Fork 597
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
Relax legality of defines, align with FIRRTL spec #3857
Conversation
Change the checking logic for the legality of a probe define destination to align with FIRRTL specification language introduced recently [1]. Specifically, this enforces the following sentence: > An operation that "writes" to a probe must be in a region whose layer > color is enabled when the probe's layer color is enabled. Previously, Chisel was more restrictive and would only allow writing to a probe whose color was the same as the layer block you are currently in. However, as has been worked out in CIRCT and elsewhere, it is fine to drive a probe from any region that is enabled when the probe is also enabled. Practically, this gets some Chisel code passing that was legal by a FIRRTL compiler, but Chisel was refusing to generate it. CC: @rwy7 [1]: chipsalliance/firrtl-spec@673aa08 Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
layer.block(A.B) { | ||
define(b, ProbeValue(in)) | ||
define(y, ProbeValue(e)) | ||
} | ||
} | ||
} |
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 will produce illegal FIRRTL as the probes are defined more than once. However, it makes the test terser to write it this way.
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.
I don't fully grok some of the logic but the tests look good
val a = Wire(Bool()) | ||
// Without this enable, this circuit is illegal because `C` is NOT enabled | ||
// when `A` is enabled. Cf. tests checking errors of this later. | ||
layer.enable(A) |
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.
Is enable the global enable for this Module?
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.
Yes, it's indicating that this module has layer A
enabled. This will emit:
public module Foo enablelayer A :
; ...
If there is more than one enable, then those will get appended, e.g., layer.enable(A); layer.enable(B)
will be:
public module Foo enablelayer A enablelayer B :
; ...
Change the checking logic for the legality of a probe define destination to align with FIRRTL specification language introduced recently [1]. Specifically, this enforces the following sentence: > An operation that "writes" to a probe must be in a region whose layer > color is enabled when the probe's layer color is enabled. Previously, Chisel was more restrictive and would only allow writing to a probe whose color was the same as the layer block you are currently in. However, as has been worked out in CIRCT and elsewhere, it is fine to drive a probe from any region that is enabled when the probe is also enabled. Practically, this gets some Chisel code passing that was legal by a FIRRTL compiler, but Chisel was refusing to generate it. CC: @rwy7 [1]: chipsalliance/firrtl-spec@673aa08 Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change the checking logic for the legality of a probe define destination to align with FIRRTL specification language introduced recently 1. Specifically, this enforces the following sentence:
Previously, Chisel was more restrictive and would only allow writing to a probe whose color was the same as the layer block you are currently in. However, as has been worked out in CIRCT and elsewhere, it is fine to drive a probe from any region that is enabled when the probe is also enabled.
Practically, this gets some Chisel code passing that was legal by a FIRRTL compiler, but Chisel was refusing to generate it.
CC: @rwy7
Release Notes
Align Chisel's checks of define destinations with the FIRRTL specification. Previously, Chisel was too strict.