From: Luke Kenneth Casson Leighton Date: Mon, 8 Apr 2019 07:15:04 +0000 (+0100) Subject: small code-shuffle on eq() X-Git-Tag: ls180-24jan2020~1288 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c7808cdfeac3f5eb0b24cd075bd753b6f0b901d;p=ieee754fpu.git small code-shuffle on eq() --- diff --git a/src/add/singlepipe.py b/src/add/singlepipe.py index 54340280..95aae54f 100644 --- a/src/add/singlepipe.py +++ b/src/add/singlepipe.py @@ -295,6 +295,7 @@ def eq(o, i): for (ao, ai) in zip(o, i): #print ("eq", ao, ai) if isinstance(ao, Record): + rres = [] for idx, (field_name, field_shape, _) in enumerate(ao.layout): if isinstance(field_shape, Layout): val = ai.fields @@ -304,21 +305,18 @@ def eq(o, i): val = getattr(val, field_name) else: val = val[field_name] # dictionary-style specification - rres = eq(ao.fields[field_name], val) - res += rres + rres += eq(ao.fields[field_name], val) elif isinstance(ao, ArrayProxy) and not isinstance(ai, Value): + rres = [] 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 + rres.append(op.eq(p)) else: rres = ao.eq(ai) - if not isinstance(rres, Sequence): - rres = [rres] - res += rres + if not isinstance(rres, Sequence): + rres = [rres] + res += rres return res