From: Luke Kenneth Casson Leighton Date: Sat, 9 Jul 2022 19:39:53 +0000 (+0100) Subject: add support for Indexed mode in SVSHAPE X-Git-Tag: sv_maxu_works-initial~275 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8bf4f330be44b6e93435a5deaa9104bfa2bda4ba;p=openpower-isa.git add support for Indexed mode in SVSHAPE --- diff --git a/src/openpower/decoder/isa/svshape.py b/src/openpower/decoder/isa/svshape.py index 4d4cb1d2..6f3fc176 100644 --- a/src/openpower/decoder/isa/svshape.py +++ b/src/openpower/decoder/isa/svshape.py @@ -1,3 +1,11 @@ +"""provides convenient field mappings for SVSHAPE in different modes + +the trickiest is Indexed mode which sits inside Matrix using two of +permute options to activate. + +https://libre-soc.org/openpower/sv/remap +""" + from openpower.decoder.selectable_int import (FieldSelectableInt, SelectableInt, selectconcat) from openpower.decoder.isa.remapyield import iterate_indices @@ -29,6 +37,10 @@ class SVSHAPE(SelectableInt): log("SVSHAPE setup field", field, offs, end) offs = end + def is_indexed(self): + "REMAP Indexed Mode" + return self.mode == 0b00 and self.submode2 in [0b110, 0b111] + @property def submode2(self): return self.fsi['permute'].asint(msb0=True) @@ -40,6 +52,8 @@ class SVSHAPE(SelectableInt): @property def order(self): permute = self.fsi['permute'].asint(msb0=True) + if self.is_indexed(): + permute -= 0b110 # xyz or yxz return SVP64SHAPE.order(permute) @order.setter @@ -63,9 +77,16 @@ class SVSHAPE(SelectableInt): def ydimsz(self, value): self.fsi['ydimsz'].eq(value-1) + @property + def svgpr(self): + return self.fsi['zdimsz'].asint(msb0=True) << 1 + @property def zdimsz(self): - return self.fsi['zdimsz'].asint(msb0=True)+1 + z = self.fsi['zdimsz'].asint(msb0=True)+1 + if self.is_indexed(): + z = 1 # no z dimension when indexed + return z @zdimsz.setter def zdimsz(self, value): @@ -84,6 +105,8 @@ class SVSHAPE(SelectableInt): @property def invxyz(self): inv = self.fsi['invxyz'].asint(msb0=True) + if self.is_indexed(): + inv &= 0b011 # no 3rd z in indexed mode return [(inv & 0b1), (inv & 0b10) >> 1, (inv & 0b100) >> 2] @invxyz.setter @@ -98,8 +121,15 @@ class SVSHAPE(SelectableInt): def mode(self, value): self.fsi['mode'].eq(value) + @property + def elwid(self): + return self.fsi['skip'].asint(msb0=True) + @property def skip(self): + if self.is_indexed(): + inv = self.fsi['invxyz'].asint(msb0=True) + return (inv & 0b100) >> 2 return self.fsi['skip'].asint(msb0=True) @skip.setter