From: Sebastien Bourdeauducq Date: Mon, 9 Jan 2012 13:21:54 +0000 (+0100) Subject: flow: draw network graph X-Git-Tag: 24jan2021_ls180~2099^2~1090 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bdcaeb159b7576f99c18f4c38a0dee95db748891;p=litex.git flow: draw network graph --- diff --git a/examples/dataflow.py b/examples/dataflow.py index 7707b3a2..8e43f8c5 100644 --- a/examples/dataflow.py +++ b/examples/dataflow.py @@ -1,3 +1,4 @@ +import sys import networkx as nx from migen.fhdl import verilog @@ -10,9 +11,13 @@ a1 = make_composable(g, Add(BV(16))) a2 = make_composable(g, Add(BV(16))) a3 = make_composable(g, Add(BV(16))) c3 = (a1 + a2)*a3 -print(c3) c = CompositeActor(g) frag = c.get_control_fragment() + c.get_process_fragment() print(verilog.convert(frag)) + +if len(sys.argv) > 1 and sys.argv[1] == "draw": + import matplotlib.pyplot as plt + nx.draw(g) + plt.show() diff --git a/migen/flow/actor.py b/migen/flow/actor.py index a1f57e4f..25279bd8 100644 --- a/migen/flow/actor.py +++ b/migen/flow/actor.py @@ -152,7 +152,7 @@ class Actor: raise NotImplementedError("Actor classes must overload get_process_fragment") def __repr__(self): - return "" + return "<" + self.__class__.__name__ + " " + repr(self.scheduling_model) + " " + repr(self.sinks()) + " " + repr(self.sources()) + ">" def get_conn_control_fragment(source, sink): assert isinstance(source, Source)