From 3e4d137f3a46b712bdcc966ef930e08fe6ecb621 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 10 Oct 2022 20:29:43 +0100 Subject: [PATCH] add elwidth overrides on Indexed REMAP, 8-bit example. reduces reg usage --- openpower/isa/simplev.mdwn | 3 +- src/openpower/decoder/isa/svshape.py | 8 +- .../decoder/isa/test_caller_svindex.py | 89 ++++++++++++++++++- 3 files changed, 92 insertions(+), 8 deletions(-) diff --git a/openpower/isa/simplev.mdwn b/openpower/isa/simplev.mdwn index 4c06d90e..d6f1a40e 100644 --- a/openpower/isa/simplev.mdwn +++ b/openpower/isa/simplev.mdwn @@ -347,8 +347,7 @@ Pseudo-code: shape[0:5] <- (0b0 || SVd) # ydim shape[12:17] <- (0b0 || SVG) # SVGPR shape[28:29] <- ew # element-width override - if sk = 1 then shape[28:29] <- 0b01 # skip 1st dimension - else shape[28:29] <- 0b00 # no skipping + shape[21] <- sk # skip 1st dimension # select the mode for updating SVSHAPEs SVSTATE[62] <- mm # set or clear persistence if mm = 0 then diff --git a/src/openpower/decoder/isa/svshape.py b/src/openpower/decoder/isa/svshape.py index 2bdf530b..8b453375 100644 --- a/src/openpower/decoder/isa/svshape.py +++ b/src/openpower/decoder/isa/svshape.py @@ -140,6 +140,7 @@ class SVSHAPE(SelectableInt): @skip.setter def skip(self, value): + assert not self.is_indexed() # TODO self.fsi['skip'].eq(value) @property @@ -156,9 +157,10 @@ class SVSHAPE(SelectableInt): if self.gpr is None: return idx if self.xdimsz == 1 and self.ydimsz == 1: - idx = step # no Index remapping - remap = self.gpr(self.svgpr+idx).value # TODO: elwidths - log ("indexed_iterator", self.svgpr, idx, remap) + idx = step # no Index 1/2D reshaping, only Indexing + ew_src = 8 << (3-int(self.elwid)) # convert to bitlength + remap = self.gpr(self.svgpr, True, idx, ew_src).value + log ("indexed_iterator", self.svgpr, idx, remap, ew_src) return remap def get_iterator(self): diff --git a/src/openpower/decoder/isa/test_caller_svindex.py b/src/openpower/decoder/isa/test_caller_svindex.py index ad4a1987..ff4ec0bc 100644 --- a/src/openpower/decoder/isa/test_caller_svindex.py +++ b/src/openpower/decoder/isa/test_caller_svindex.py @@ -19,6 +19,23 @@ from openpower.consts import SVP64CROffs from copy import deepcopy +def set_masked_reg(regs, base, offs, ew_bits, value): + # rrrright. start by breaking down into row/col, based on elwidth + gpr_offs = offs // (64//ew_bits) + gpr_col = offs % (64//ew_bits) + # compute the mask based on ew_bits + mask = (1<