Start Tcl design inspection methods #4678
Draft
+298
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the reasons/motivation for this change?
Allow inspection and altering of the design from Tcl scripts for use-cases which are too specific to write a Yosys command for.
This is in addition to the existing ways of obtaining information about a design by
and variations thereof.
See sample usage here: https://github.com/povik/OpenROAD-flow-scripts/blob/72b084f68275aaefec903fbc8e4f8613679e52e0/flow/scripts/synth_preamble.tcl#L122
Another use case of the new API is replacing this Python script called from Tcl to process a JSON export with a direct Tcl implementation: https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/blob/master/flow/scripts/mem_dump.py (Cc @oharboe, feel free to comment)
Explain how this is achieved.
We introduce a set of Tcl functions prefixed with
rtlil::
to query attributes and parameters.Tcl bindings in other projects sometimes use text-formatted pointers as the Tcl-side handles, but for a RTLIL binding we can consistently use IDs of objects to refer to them from the Tcl side.