flow: draw network graph

This commit is contained in:
Sebastien Bourdeauducq 2012-01-09 14:21:54 +01:00
parent d26ded93d8
commit bdcaeb159b
2 changed files with 7 additions and 2 deletions

View File

@ -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()

View File

@ -152,7 +152,7 @@ class Actor:
raise NotImplementedError("Actor classes must overload get_process_fragment")
def __repr__(self):
return "<Actor " + repr(self.scheduling_model) + " " + repr(self.sinks()) + " " + repr(self.sources()) + ">"
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)