From 832c6331f895887e24b23c38bda42b795d4c5a2a Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 5 Jul 2021 19:02:18 +0100 Subject: [PATCH] add in use of SVSHAPE in ISACaller. untested (no damage done) --- src/openpower/decoder/isa/caller.py | 33 ++++++++++++++++++++++++++++ src/openpower/decoder/isa/svshape.py | 5 ++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/openpower/decoder/isa/caller.py b/src/openpower/decoder/isa/caller.py index fb17a1f2..40e5ef28 100644 --- a/src/openpower/decoder/isa/caller.py +++ b/src/openpower/decoder/isa/caller.py @@ -1196,6 +1196,39 @@ class ISACaller: self.namespace['NIA']) return + # for when SVSHAPE is active, a very bad hack here (to be replaced) + # using pre-arranged schedule. all of this is awful but it is a + # start. next job will be to put the proper activation in place + yield self.dec2.remap_active.eq(self.last_op_svshape) + if self.last_op_svshape: + # get four SVSHAPEs. here we are hard-coding + # SVSHAPE0 to FRT, SVSHAPE1 to FRA, SVSHAPE2 to FRC and + # SVSHAPE3 to FRB, assuming "fmadd FRT, FRA, FRC, FRB." + remaps = [self.spr['SVSHAPE0'].get_iterator(), + self.spr['SVSHAPE1'].get_iterator(), + self.spr['SVSHAPE2'].get_iterator(), + self.spr['SVSHAPE3'].get_iterator(), + ] + for i, remap in enumerate(remaps): + # XXX hardcoded! pick dststep for out (i==0) else srcstep + step = dststep if (i == 0) else srcstep + # this is terrible. O(N^2) looking for the match. but hey. + for idx, remap_idx in remap: + if idx == step: + break + if i == 0: + yield self.dec2.o_step.eq(step) + yield self.dec2.o2_step.eq(step) + elif i == 1: + yield self.dec2.in1_step.eq(step) + elif i == 2: + yield self.dec2.in2_step.eq(step) + elif i == 3: + yield self.dec2.in3_step.eq(step) + # after that, settle down (combinatorial) to let Vector reg numbers + # work themselves out + yield Settle() + # main input registers (RT, RA ...) inputs = [] for name in input_names: diff --git a/src/openpower/decoder/isa/svshape.py b/src/openpower/decoder/isa/svshape.py index 139b540d..16f90a0a 100644 --- a/src/openpower/decoder/isa/svshape.py +++ b/src/openpower/decoder/isa/svshape.py @@ -3,6 +3,8 @@ from openpower.decoder.selectable_int import (FieldSelectableInt, SelectableInt, selectconcat) from openpower.sv.svp64 import SVP64REMAP import os +from copy import deepcopy + class SVSHAPE(SelectableInt): def __init__(self, value): @@ -76,7 +78,8 @@ class SVSHAPE(SelectableInt): self.fsi['offset'].eq(value) def get_iterator(self): - return iterate_indices(self) + # create a **NEW** iterator each time this is called + return iterate_indices(deepcopy(self)) if __name__ == '__main__': -- 2.30.2