Does CIRCT have a pass or lowering option which converts sequences of sv.assign
operations into a single sv.alwayscomb
containing multiple assignments?
For example (in RTL):
// before
assign a = c;
assign b = d;
// after
always_comb begin
a = c;
b = d;
end
Thanks.
Could you explain what your requirement is?
Won’t there be an error converting continuous assignments(sv.assign
) to blocking assignments(sv.alwaysComb
)?
My requirement is minimizing the number of assign
statements in the generated RTL. I think conversion of blocking assignments to continuous assignments could be complicated, but converting continuous assignments to blocking ones seems straightforward.
One approach I could use is to change places where my code generates sequences of sv.assign
operations into a single sv.alwayscomb
operation which contains multiple sv.bpassign
operations. Do you see any downsides to that?
1 Like
For all I know, sv
dialect is used for code generation. There are some passes that can lower other dialects into sv
dialect, and then it’s over.
1 Like
I’m not aware of something like this that exists. It may run slightly counter to the aims of the Dialect, though it does seem safe. always_comb
does trigger at time zero which isn’t equivalent to always
. I don’t think there is the same problem with continuous assign.
One approach I could use is to change places where my code generates sequences of sv.assign
operations into a single sv.alwayscomb
operation which contains multiple sv.bpassign
operations. Do you see any downsides to that?
This seems like a great approach. One thing about SV Dialect is that it is primarily intended to be an emission-focused dialect as opposed to a dialect that is useful for analysis and transformation. The SV Rationale has some limited language describing it as such.
If you can emit the always
blocks you want, that is definitely a better approach. As I expect you’re lowering to SV from a higher-level dialect, then it may make sense to expose an option to a user, like the firtool -lowering-options
to control this if you expect there may be requirements to avoid always_comb
for some users to customize this.
2 Likes