From f04f7e81bc9b0c46a1ffe4f3035ec913b9ffd71f Mon Sep 17 00:00:00 2001 From: Andrey Miroshnikov Date: Wed, 11 Oct 2023 11:41:16 +0000 Subject: [PATCH] Add flatten function, print expected --- src/openpower/decoder/isa/test_caller_svp64_matrix.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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") -- 2.30.2