From: Sebastien Bourdeauducq Date: Fri, 3 Aug 2012 16:49:35 +0000 (+0200) Subject: flow/network: option to add debugger X-Git-Tag: 24jan2021_ls180~2099^2~854 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=25cb25a8aeeb326b6219224f978b8076e69dcf76;p=litex.git flow/network: option to add debugger --- diff --git a/migen/flow/network.py b/migen/flow/network.py index 65f0514f..f735eccc 100644 --- a/migen/flow/network.py +++ b/migen/flow/network.py @@ -1,9 +1,10 @@ from networkx import MultiDiGraph from migen.fhdl.structure import * +from migen.corelogic.misc import optree from migen.flow.actor import * from migen.flow import plumbing -from migen.corelogic.misc import optree +from migen.flow.isd import DFGReporter # Graph nodes can be either: # (1) a reference to an existing actor @@ -211,11 +212,20 @@ class DataFlowGraph(MultiDiGraph): self._instantiate_actors() class CompositeActor(Actor): - def __init__(self, dfg): + def __init__(self, dfg, debugger=False, debugger_nbits=48): dfg.elaborate() self.dfg = dfg + if debugger: + self.debugger = DFGReporter(self.dfg, debugger_nbits) super().__init__() + def get_registers(self): + if hasattr(self, "debugger"): + self.debugger.print_map() + return self.debugger.get_registers() + else: + return [] + def get_fragment(self): comb = [self.busy.eq(optree("|", [node.actor.busy for node in self.dfg]))] fragment = Fragment(comb) @@ -225,4 +235,6 @@ class CompositeActor(Actor): ep_src = u.actor.endpoints[d["source"]] ep_dst = v.actor.endpoints[d["sink"]] fragment += get_conn_fragment(ep_src, ep_dst) + if hasattr(self, "debugger"): + fragment += self.debugger.get_fragment() return fragment