Open
Description
Currently SVAttributes are intentionally limited to sv.reg, sv.wire(761b610) and sv.assign(3a13fbf), e.g:
%bar = sv.reg svattrs [#sv.attribute<"foo">]
sv.assign %bar, 0 svattrs [#sv.attribute<"baz">]
==>
(* foo *)
wire bar;
(* baz *)
bar = 0;
However SV spec says SVAttributes can be attached to everywhere including module/port definitions, statements and expressions (even operators). Actually I have use cases to add vendor specific pragmas to expressions so I want to make SVAttributes more generic. To do this, it would be also necessary to stop inherenting sv.attribute in each op definition. Implementation wise, we can pick and extend the commit(512ae54) in the original PR.
However there are quite a few problems to extend it to expressions.
- Transformation must respect sv attributes
SVAttributes might not be semantically discardable(?) so we should change transformations (canonicalizers, HWCleanUp, ..). For example, propagating attributes (e.g.add(a, add(b, c)){sv.attributes="foo"} => add(a, b, c){sv.attributes="foo"}
) is in general illegal. However it is hard to prevent discarding attributes attached to dead sub operations (e.g.add(a, add(b, c){sv.attributes="foo"}) => add(a, b, c)
). - Positions where SV attributes are emitted
SV Spec doesn't define where these attributes must be emitted. Hence, expected positions of vendor specific pragams are very random. For example, how to specify the position of emitted attributes formux(a, b, c):{sv.attribute="bar"}
? e.g)
a (* bar *) ? b : c
a ? (* bar *) b : c
a ? b (* bar *) : c
a ? b :(* bar *) c
a ? b : c (* bar *)