use local temporary for variables
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 3 Apr 2019 06:07:46 +0000 (07:07 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 3 Apr 2019 06:07:46 +0000 (07:07 +0100)
src/add/pipeline.py
src/add/pipeline_example.py

index 525d5f39b9895b5043cef2b212c9f16dfbd0f6c0..1a85b85a851a95483e1608ae17b9c2d19232c1ae 100644 (file)
@@ -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
index 144ab5895fe0edd7ac9b31e1ce7a52a37788c904..cb5df496ce24672d726956471722c8a202a1c4d4 100644 (file)
@@ -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