add important detection ArrayProxy and workaround in eq()
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 27 Mar 2019 21:07:41 +0000 (21:07 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 27 Mar 2019 21:07:41 +0000 (21:07 +0000)
src/add/singlepipe.py

index 206f815ff6bac777f81c3a2e737bc92a2ee7466b..6d73b862a2b6f4db0f9a665664ba95e7029b6e72 100644 (file)
     it's quite a complex state machine!
 """
 
-from nmigen import Signal, Cat, Const, Mux, Module
+from nmigen import Signal, Cat, Const, Mux, Module, Value
 from nmigen.cli import verilog, rtlil
+from nmigen.hdl.ast import ArrayProxy
 from nmigen.hdl.rec import Record, Layout
 
 from abc import ABCMeta, abstractmethod
@@ -255,6 +256,14 @@ def eq(o, i):
                     val = val[field_name] # dictionary-style specification
                 rres = eq(ao.fields[field_name], val)
                 res += rres
+        elif isinstance(ao, ArrayProxy) and not isinstance(ai, Value):
+            for p in ai.ports():
+                op = getattr(ao, p.name)
+                print (op, p, p.name)
+                rres = op.eq(p)
+                if not isinstance(rres, Sequence):
+                    rres = [rres]
+                res += rres
         else:
             rres = ao.eq(ai)
             if not isinstance(rres, Sequence):