From: Luke Kenneth Casson Leighton Date: Wed, 3 Apr 2019 06:07:46 +0000 (+0100) Subject: use local temporary for variables X-Git-Tag: ls180-24jan2020~1352 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=931928233368a3115a1f2e10ed34c53499e959c9;p=ieee754fpu.git use local temporary for variables --- 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