From: Andrey Miroshnikov Date: Wed, 11 Oct 2023 11:41:16 +0000 (+0000) Subject: Add flatten function, print expected X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f04f7e81bc9b0c46a1ffe4f3035ec913b9ffd71f;p=openpower-isa.git Add flatten function, print expected --- diff --git a/src/openpower/decoder/isa/test_caller_svp64_matrix.py b/src/openpower/decoder/isa/test_caller_svp64_matrix.py index df6873c8..70559ac6 100644 --- a/src/openpower/decoder/isa/test_caller_svp64_matrix.py +++ b/src/openpower/decoder/isa/test_caller_svp64_matrix.py @@ -19,6 +19,10 @@ def matmult(a, b): return [[sum(ele_a*ele_b for ele_a, ele_b in zip(row_a, col_b)) for col_b in zip_b] for row_a in a] +# Flatten list of lists matrix down to single list +def flatten(l): + return [item for sublist in l for item in sublist] + class DecoderTestCase(FHDLTestCase): @@ -54,6 +58,10 @@ class DecoderTestCase(FHDLTestCase): X = X1 Y = Y1 + expected = matmult(X, Y) + print("expected-matrix:") + print(expected) + xf = reduce(operator.add, X) yf = reduce(operator.add, Y) print("flattened X,Y")