super().__init__(number_gen(),
("result", Source, [("r", self.bv_r)]))
-class Dumper(SimActor):
- def __init__(self):
- def dumper_gen():
- while True:
- t = Token("result")
- yield t
- print(t.value["r"])
- super().__init__(dumper_gen(),
- ("result", Sink, [("r", BV(32))]))
-
def draw(g):
if len(sys.argv) > 1 and sys.argv[1] == "draw":
nx.draw_spectral(g)
ps = gen1 + gen2
result = ps*gen1 + ps*gen2
- g.add_connection(result, ActorNode(Dumper()))
+ g.add_connection(result, ActorNode(Dumper([("r", BV(32))])))
gen1.actor.name = "gen1"
gen2.actor.name = "gen2"
]
return Fragment(comb, sync)
-class Dumper(SimActor):
- def __init__(self, nbits):
- def dumper_gen():
- while True:
- t = Token("result")
- yield t
- print(t.value["r"])
- super().__init__(dumper_gen(),
- ("result", Sink, [("r", BV(nbits))]))
-
def main():
nbits = 32
g.add_connection(init2, buf2)
g.add_connection(buf2, adder, sink_subr="b")
- g.add_connection(bufadd, ActorNode(Dumper(nbits)))
+ g.add_connection(bufadd, ActorNode(Dumper([("r", BV(nbits))])))
c = CompositeActor(g)
fragment = c.get_fragment()
for i in range(10):
yield Token("result", {"r": i})
-class Dumper(SimActor):
- def __init__(self):
- def dumper_gen():
- while True:
- t = Token("result")
- yield t
- print(t.value["r"])
- super().__init__(dumper_gen(),
- ("result", Sink, layout))
-
def run_sim(ng):
g = DataFlowGraph()
- d = Dumper()
+ d = Dumper(layout)
g.add_connection(ActorNode(ng), ActorNode(d))
c = CompositeActor(g)
ds.store = r.data
yield Token("result", {"r": ds})
-class Dumper(SimActor):
- def __init__(self):
- def dumper_gen():
- while True:
- t = Token("result")
- yield t
- print(t.value["r"])
- super().__init__(dumper_gen(),
- ("result", Sink, layout))
-
class SlaveModel(wishbone.TargetModel):
def read(self, address):
return address + 4
def run_sim(ng):
g = DataFlowGraph()
- d = Dumper()
+ d = Dumper(layout)
g.add_connection(ActorNode(ng), ActorNode(d))
slave = wishbone.Target(SlaveModel())
def get_fragment(self):
return self.token_exchanger.get_fragment()
+
+class Dumper(SimActor):
+ def __init__(self, layout, prefix=""):
+ def dumper_gen():
+ while True:
+ t = Token("result")
+ yield t
+ if len(t.value) > 1:
+ s = str(t.value)
+ else:
+ s = str(list(t.value.values())[0])
+ print(prefix + s)
+ super().__init__(dumper_gen(),
+ ("result", Sink, layout))