From 4096a785f9a839316dfeda3e66b9a507d01964e9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 3 Jul 2013 16:35:24 +0200 Subject: [PATCH] examples/pytholite/basic: demonstrate generator arguments --- examples/pytholite/basic.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/pytholite/basic.py b/examples/pytholite/basic.py index 857b22f2..425cfe7f 100644 --- a/examples/pytholite/basic.py +++ b/examples/pytholite/basic.py @@ -7,14 +7,14 @@ from migen.fhdl import verilog layout = [("r", 32)] -def number_gen(): - for i in range(10): +def number_gen(n): + for i in range(n): yield Token("result", {"r": i}) class SimNumberGen(SimActor): def __init__(self): self.result = Source(layout) - SimActor.__init__(self, number_gen()) + SimActor.__init__(self, number_gen(5)) def run_sim(ng): g = DataFlowGraph() @@ -23,11 +23,11 @@ def run_sim(ng): c = CompositeActor(g) sim = Simulator(c) - sim.run(30) + sim.run(20) del sim def make_ng_pytholite(): - ng_pytholite = Pytholite(number_gen) + ng_pytholite = Pytholite(number_gen, 5) ng_pytholite.result = Source(layout) ng_pytholite.finalize() return ng_pytholite -- 2.30.2