From 5bd6338cc9d9d9ef95438b069256d0a1b5742fe5 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 27 Dec 2023 10:44:05 +0000 Subject: [PATCH] bug 1155: add convenience SVSHAPE.is_triangle() function --- src/openpower/decoder/isa/svshape.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/openpower/decoder/isa/svshape.py b/src/openpower/decoder/isa/svshape.py index 7876fda4..e6294fba 100644 --- a/src/openpower/decoder/isa/svshape.py +++ b/src/openpower/decoder/isa/svshape.py @@ -49,6 +49,10 @@ class SVSHAPE(SelectableInt): "REMAP Indexed Mode" return self.mode == 0b00 and self.submode2 in [0b110, 0b111] + def is_triangle(self): + "REMAP Triangle Mode" + return self.mode == 0b11 and self.skip in [0b00, 0b01] + @property def submode2(self): return self.fsi['permute'].asint(msb0=True) @@ -60,8 +64,8 @@ class SVSHAPE(SelectableInt): @property def order(self): permute = self.fsi['permute'].asint(msb0=True) - if self.is_indexed(): - permute = (permute-0b110)*2 # xyz or yxz + if self.is_indexed() or self.is_triangle(): + permute = (permute&0b001)*2 # xyz or yxz return SVP64SHAPE.order(permute) @order.setter @@ -140,14 +144,14 @@ class SVSHAPE(SelectableInt): @property def skip(self): - if self.is_indexed(): + if self.is_indexed() or self.is_triangle(): inv = self.fsi['invxyz'].asint(msb0=True) return (inv & 0b100) >> 2 return self.fsi['skip'].asint(msb0=True) @skip.setter def skip(self, value): - assert not self.is_indexed() # TODO + assert not (self.is_indexed() or self.is_triangle()) # TODO self.fsi['skip'].eq(value) @property -- 2.30.2