From 7b3ddc182b588124a32f7e0d6d5000fcad3462d6 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 27 Mar 2019 21:07:41 +0000 Subject: [PATCH] add important detection ArrayProxy and workaround in eq() --- src/add/singlepipe.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/add/singlepipe.py b/src/add/singlepipe.py index 206f815f..6d73b862 100644 --- a/src/add/singlepipe.py +++ b/src/add/singlepipe.py @@ -150,8 +150,9 @@ 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): -- 2.30.2