From 931928233368a3115a1f2e10ed34c53499e959c9 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 3 Apr 2019 07:07:46 +0100 Subject: [PATCH] use local temporary for variables --- src/add/pipeline.py | 4 +++- src/add/pipeline_example.py | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/add/pipeline.py b/src/add/pipeline.py index 525d5f39..1a85b85a 100644 --- a/src/add/pipeline.py +++ b/src/add/pipeline.py @@ -151,7 +151,7 @@ class PipelineStage: def __init__(self, name, m, prev=None, pipemode=False, ispec=None): self._m = m self._stagename = name - self._preg_map = {} + self._preg_map = {'__nextstage__': {}} self._prev_stage = prev self._ispec = ispec if prev: @@ -172,6 +172,8 @@ class PipelineStage: self._assigns = [] def __getattr__(self, name): + #if name in self._preg_map['__nextstage__']: + # return self._preg_map['__nextstage__'][name] try: v = self._preg_map[self._stagename][name] return v diff --git a/src/add/pipeline_example.py b/src/add/pipeline_example.py index 144ab589..cb5df496 100644 --- a/src/add/pipeline_example.py +++ b/src/add/pipeline_example.py @@ -138,13 +138,13 @@ class PipelineStageObjectExample: p.n = ~self._loopback p.o = self._obj with pipe.Stage("second", p) as (p, m): - localv = Signal(4) - m.d.comb += localv.eq(p.n + Const(2)) - p.n = localv + #p.n = ~self._loopback + 2 + localn = Signal(4) + m.d.comb += localn.eq(p.n) o = ObjectProxy(None, pipemode=False) - o.c = localv - o.d = p.o.b + localv + Const(5) - o.e = p.o.b + localv + o.c = localn + o.d = p.o.b + localn + Const(5) + p.n = localn p.o = o with pipe.Stage("third", p) as (p, m): #p.n = ~self._loopback + 5 -- 2.30.2