From 77a4f7104968859385e0b8117ea74041cbe6e436 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 3 Sep 2022 12:59:06 +0100 Subject: [PATCH] add inv option to svshape2 (only 1 bit) https://bugs.libre-soc.org/show_bug.cgi?id=911 there is precious space: an sv.svshape2 can add more bits later --- openpower/isa/simplev.mdwn | 6 ++++-- openpower/isatables/fields.text | 9 ++++++--- src/openpower/decoder/isa/test_caller_svshape2.py | 8 ++++---- src/openpower/sv/trans/svp64.py | 11 ++++++----- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/openpower/isa/simplev.mdwn b/openpower/isa/simplev.mdwn index 9ef43a2e..ff8c71ab 100644 --- a/openpower/isa/simplev.mdwn +++ b/openpower/isa/simplev.mdwn @@ -346,7 +346,7 @@ Special Registers Altered: SVM2-Form -* svshape2 offs,yx,rmm,SVd,sk,mm +* svshape2 offs,inv,yx,rmm,SVd,sk,mm Pseudo-code: @@ -364,12 +364,14 @@ Pseudo-code: shape[18:20] <- 0b000 # ordering xd/yd(/zd) if sk = 0 then shape[6:11] <- 0 # ydim else shape[6:11] <- 0b111111 # ydim max + shape[21:23] <- (0b00 || inv) # "inverse" on xdim else shape[18:20] <- 0b010 # ordering yd/xd(/zd) if sk = 1 then shape[6:11] <- 0 # ydim else shape[6:11] <- d-1 # ydim max + shape[21:23] <- (0b0 || inv || 0b0) # "inverse" ydim # offset (the prime purpose of this instruction) - shape[24:27] <- offs # offset + shape[24:27] <- (0b0 || offs) # offset extended 1-bit if sk = 1 then shape[28:29] <- 0b01 # skip 1st dimension else shape[28:29] <- 0b00 # no skipping # select the mode for updating SVSHAPEs diff --git a/openpower/isatables/fields.text b/openpower/isatables/fields.text index 5a08d23e..01acc237 100644 --- a/openpower/isatables/fields.text +++ b/openpower/isatables/fields.text @@ -307,8 +307,8 @@ | PO | SVxd | SVyd | SVzd | SVrm |vf | XO | # 1.6.35.1 SVM2-FORM - |0 |6 |10|11 |16 |21 |24|25 |26 |31 | - | PO | offs |yx| rmm | SVd |XO |mm|sk | XO | + |0 |6 |9 |10|11 |16 |21 |24|25 |26 |31 | + | PO |offs|inv|yx| rmm | SVd |XO |mm|sk | XO | # 1.6.36 SVRM-FORM |0 |6 |11 |13 |15 |17 |19 |21 |22 |26 |31 | @@ -559,6 +559,9 @@ IMM8 (13:20) Immediate field used to specify an 8-bit integer. Formats: X + inv (9) + Field used by the svshape2 instruction for inversion of one dimension + Formats: SVM2 IS (6:10) Immediate field used to specify a 5-bit signed inte- ger. @@ -674,7 +677,7 @@ Field used to specify the number of bytes to move in an immediate Move Assist instruction. Formats: X - offs (6:9) + offs (6:8) Field used by the svshape2 instruction as an offset Formats: SVM2 OC (6:20) diff --git a/src/openpower/decoder/isa/test_caller_svshape2.py b/src/openpower/decoder/isa/test_caller_svshape2.py index 63ba4b27..e45015b5 100644 --- a/src/openpower/decoder/isa/test_caller_svshape2.py +++ b/src/openpower/decoder/isa/test_caller_svshape2.py @@ -31,7 +31,7 @@ class SVSTATETestCase(FHDLTestCase): def test_0_sv_shape2(self): """sets VL=10 (via SVSTATE) then does svshape mm=0, checks SPRs after """ - isa = SVP64Asm(['svshape2 12, 1, 15, 5, 0, 0' + isa = SVP64Asm(['svshape2 6, 1, 1, 15, 5, 0, 0' ]) lst = list(isa) print("listing", lst) @@ -81,9 +81,9 @@ class SVSTATETestCase(FHDLTestCase): self.assertEqual(SVSHAPE0.xdimsz, 5) # set self.assertEqual(SVSHAPE0.ydimsz, 2) # calculated from MVL/xdimsz self.assertEqual(SVSHAPE0.skip, 0) # no skip - # (no inversion possible) - self.assertEqual(SVSHAPE0.invxyz, [0, 0, 0]) - self.assertEqual(SVSHAPE0.offset, 12) + # invert y rather than x because yx=1 + self.assertEqual(SVSHAPE0.invxyz, [0, 1, 0]) + self.assertEqual(SVSHAPE0.offset, 6) self.assertEqual(SVSHAPE0.order, (1, 0, 2)) # y,x(,z) self.assertEqual(sim.svstate.RMpst, 0) # mm=0 so persist=0 self.assertEqual(sim.svstate.SVme, 0b01111) # same as rmm diff --git a/src/openpower/sv/trans/svp64.py b/src/openpower/sv/trans/svp64.py index e094392e..a89296f1 100644 --- a/src/openpower/sv/trans/svp64.py +++ b/src/openpower/sv/trans/svp64.py @@ -197,11 +197,11 @@ def svshape2(fields): https://libre-soc.org/openpower/sv/remap/discussion - * svshape2 offs,yx,rmm,SVd,sk,mm + * svshape2 offs,inv,yx,rmm,SVd,sk,mm # 1.6.35.1 SVM2-FORM from fields.txt - # |0 |6 |10|11 |16 |21 |24|25 |26 |31 | - # | PO | offs |yx| rmm | SVd |XO |mm|sk | XO | + # |0 |6 |9 |10|11 |16 |21 |24|25 |26 |31 | + # | PO |offs|inv|yx| rmm | SVd |XO |mm|sk | XO | note that this fits into the space of svshape and that XO is split across 2 areas. @@ -210,12 +210,13 @@ def svshape2(fields): PO = 22 XO = 0b011001 XO2 = 0b100 # not really XO2 but hey - (offs, yx, rmm, SVd, sk, mm) = fields + (offs, inv, yx, rmm, SVd, sk, mm) = fields SVd -= 1 # offset by one return instruction( (PO, 0, 5), - (offs, 6, 9), # offset (the whole point of adding svshape2) + (offs, 6, 8), # offset (the whole point of adding svshape2) + (inv, 9, 9), # invert one dimension (depends on yx) (yx, 10, 10), # like svindex (rmm, 11, 15), # ditto svindex (SVd, 16, 20), # ditto svindex -- 2.30.2