From: Luke Kenneth Casson Leighton Date: Wed, 27 Mar 2019 21:07:41 +0000 (+0000) Subject: add important detection ArrayProxy and workaround in eq() X-Git-Tag: ls180-24jan2020~1461 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b3ddc182b588124a32f7e0d6d5000fcad3462d6;p=ieee754fpu.git add important detection ArrayProxy and workaround in eq() --- 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):