Add flatten function, print expected
authorAndrey Miroshnikov <andrey@technepisteme.xyz>
Wed, 11 Oct 2023 11:41:16 +0000 (11:41 +0000)
committerAndrey Miroshnikov <andrey@technepisteme.xyz>
Wed, 18 Oct 2023 13:46:00 +0000 (13:46 +0000)
src/openpower/decoder/isa/test_caller_svp64_matrix.py

index df6873c8681f522de75948b3b326021b77700c51..70559ac67b949b257408120289a94fd1caf09ad4 100644 (file)
@@ -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")