mirror of https://github.com/llvm/circt.git
[PyCDE] Add graphviz output (#1285)
This commit is contained in:
parent
ce119b5617
commit
2fa15a18ef
|
@ -43,6 +43,12 @@ class System:
|
|||
def print(self):
|
||||
self.mod.operation.print()
|
||||
|
||||
def graph(self, short_names=True):
|
||||
import mlir.all_passes_registration
|
||||
pm = mlir.passmanager.PassManager.parse("view-op-graph{short-names=" +
|
||||
("1" if short_names else "0") + "}")
|
||||
pm.run(self.mod)
|
||||
|
||||
def generate(self, generator_names=[]):
|
||||
pm = mlir.passmanager.PassManager.parse("run-generators{generators=" +
|
||||
",".join(generator_names) + "}")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %PYTHON% %s | FileCheck %s
|
||||
# RUN: %PYTHON% %s 2>&1 | FileCheck %s
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
@ -86,6 +86,11 @@ class Polynomial(pycde.System):
|
|||
|
||||
poly = Polynomial()
|
||||
|
||||
poly.graph()
|
||||
# CHECK-LABEL: digraph "top"
|
||||
# CHECK: label="top";
|
||||
# CHECK: [shape=record,label="{hw.constant\ni32\n\nvalue: 23 : i32}"];
|
||||
|
||||
poly.print()
|
||||
# CHECK-LABEL: hw.module @top() -> (%y: i32)
|
||||
# CHECK: [[REG0:%.+]] = "pycde.PolynomialCompute"(%c23_i32) {instanceName = "example", opNames = ["x"], parameters = {coefficients = [62, 42, 6], module_name = "PolyComputeForCoeff_62_42_6", unused_parameter = true}, resultNames = ["y"]} : (i32) -> i32
|
||||
|
|
Loading…
Reference in New Issue