Open seldridge opened 3 years ago
This sounds like different output formats on firtool, built as MLIR translations. We'd want to support both RTL and FIRRTL dialects.
My only concern with this is that there are a LOT of weird little helper things like this. We should make sure to cordon them off into a petri dish that isn't part of the core production flows.
A common request is to provide hierarchy information for a design.
E.g., for a given design, you'd like to have a representation of the design that includes who instantiated what. This format could be textual/command line (like the output of
tree
), conforming to some standard (IP-XACT, DuH), or entirely one-off.This should support the ability to dump out a hierarchy for different operation types. E.g., a mix of FIRRTL, RTL, and SV modules should compose correctly.
Build a command line tool that can read in some MLIR and dump out its hierarchy in some format. (This is likely a single pass and a wrapper tool where the pass could be including in a pass pipeline if desired.)
Examples
Verilog::Perl
utilityvhier
Wilson Snyder ships a tool as part of
Verilog::Perl
calledvhier
that will dump out atree
-like output or give you an XML representation of a Verilog hierarchy.E.g., for the following Verilog:
You can then dump out something
tree
-like withvhier --forest --instance --cells Foo.v
:Alternatively, you can get an XML-based representation (which is non-standard as far as I can tell) with
vhier --xml --instance --cells Foo.v
:Vendor Tools
Vendor tools support this in varying forms. E.g., in some tools you can bring up a window that lets you browse different "views" of a design. These may include module/instance hierarchy, looking at different nets in the design, and grouping in different ways.
Vendor tools also provide some APIs for directly querying their data model representation which allows users to build hierarchy dumpers in some language (probably TCL).
(I envision us solving this with Python bindings that allow querying the MLIR directly. However, this is out of scope of this issue.)