Creating a Yosys Pass to Append "/* verilator public */" Attributes to Signals #4353
-
I am currently looking for a way to implement a Yosys pass that adds a The reason I am using Yosys is that the signal to be attributed is itself instrumented with a Yosys pass, and I would like to add the attribute to the signal while it is being instrumented. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Custom attributes can be added with the |
Beta Was this translation helpful? Give feedback.
-
I annotated it first with |
Beta Was this translation helpful? Give feedback.
Custom attributes can be added with the
setattr
command, but "verilator public" is not a valid attribute, as attributes are always of the form(* identifier = "value" *)
(value is optional on input and defaults to 1 but is always emitted inwrite_verilog
output)./* */
indicates a comment, and the only way to introduce comments inwrite_verilog
is with the-attr2comment
that transforms an attribute into a comment (basically just replaces(* *)
with/* */
). That doesn't work with the format. So the closest solution I could come up with is to usesetattr
to set the attribute and then run sed on the output to replace(* verilator = "public" *)
with/* verilator public */
, but looking at the …