reorg of FIFOtest to allow for flattening of incoming data
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 11 Apr 2019 15:47:36 +0000 (16:47 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 11 Apr 2019 15:47:36 +0000 (16:47 +0100)
src/add/record_experiment.py
src/add/singlepipe.py
src/add/test_buf_pipe.py

index 6ecd67077d839503111ed2e2d139aaada91f73bd..b31949620920ec76913dc2a4d5ea1c68c1f532e0 100644 (file)
@@ -27,7 +27,7 @@ class RecordTest:
 
         print (self.r1.fields)
         print (self.r1.shape())
-        print (len(self.r1))
+        print ("width", len(self.r1))
         m.d.comb += self.sig123.eq(flatten(self.r1))
 
         return m
index caaedae104501edc47857478ca23fa46fc9206b9..ff402c605bfff9982861afbfde86e4f8eb6ee4fb 100644 (file)
@@ -351,9 +351,9 @@ class Visitor:
                 val = val[field_name] # dictionary-style specification
             val = self.visit(ao.fields[field_name], val, act)
             if isinstance(val, Sequence):
-                rres += val
+                res += val
             else:
-                rres.append(val)
+                res.append(val)
         return res
 
     def arrayproxy_visit(self, ao, ai, act):
@@ -1023,28 +1023,30 @@ class FIFOtest(ControlBase):
         Note: the only things it will accept is a Signal of width "width".
     """
 
-    def __init__(self, width, depth):
+    def __init__(self, iospecfn, width, depth):
 
-        self.fwidth = width
+        self.iospecfn = iospecfn
+        self.fwidth = width # XXX temporary
         self.fdepth = depth
-        def iospecfn():
-            return Signal(width, name="data")
-        stage = PassThroughStage(iospecfn)
-        ControlBase.__init__(self, stage=stage)
+        #stage = PassThroughStage(iospecfn)
+        ControlBase.__init__(self, stage=self)
+
+    def ispec(self): return self.iospecfn()
+    def ospec(self): return Signal(self.fwidth, name="dout")
+    def process(self, i): return i
 
     def elaborate(self, platform):
         self.m = m = ControlBase._elaborate(self, platform)
 
-        fifo = SyncFIFO(self.fwidth, self.fdepth)
+        (fwidth, _) = self.p.i_data.shape()
+        fifo = SyncFIFO(fwidth, self.fdepth)
         m.submodules.fifo = fifo
 
-        # prev: make the FIFO "look" like a PrevControl...
-        fp = PrevControl()
-        fp.i_valid = fifo.we
-        fp._o_ready = fifo.writable
-        fp.i_data = fifo.din
-        # ... so we can do this!
-        m.d.comb += fp._connect_in(self.p, True)
+        # connect the rdy/valid/data
+        m.d.comb += [fifo.we.eq(self.p.i_valid_test),
+                     self.p.o_ready.eq(fifo.writable),
+                     eq(fifo.din, flatten(self.p.i_data)),
+                   ]
 
         # next: make the FIFO "look" like a NextControl...
         fn = NextControl()
index b695e537142f3dfcf6b3b864ea9cac1ae5aad0bd..6bf690c24e81703afd1fa11b47f160f3172a7b2f 100644 (file)
@@ -763,10 +763,14 @@ class ExampleBufPassThruPipe(ControlBase):
 # Test 20
 ######################################################################
 
+def iospecfn():
+    return Signal(16, name="din")
+
 class FIFOTest16(FIFOtest):
 
+
     def __init__(self):
-        FIFOtest.__init__(self, 16, 2)
+        FIFOtest.__init__(self, iospecfn, 16, 2)
 
 
 ######################################################################