# mode bits
MOD2_MSB = 0
MOD2_LSB = 1
+ LDST_BITREV = 2 # set =1 for bitreverse mode
# when predicate not set: 0=ignore/skip 1=zero
DZ = 3 # for destination
SZ = 4 # for source
CR_LSB = 4
RC1 = 4 # update CR as if Rc=1 (when Rc=0)
# LD immediate els (element-stride) locations, depending on mode
- ELS_NORMAL = 2
+ ELS_NORMAL = 4
ELS_FFIRST_PRED = 3
ELS_SAT = 4
# BO bits
https://libre-soc.org/openpower/sv/ldst/
LD/ST immed:
-00 els sz dz normal mode
+00 0 dz els normal mode (with element-stride)
+00 1 dz rsvd bit-reversed mode
01 inv CR-bit Rc=1: ffirst CR sel
01 inv els RC1 Rc=0: ffirst z/nonz
10 N dz els sat mode: N=0/1 u/s
with m.Switch(mode2):
with m.Case(0): # needs further decoding (LDST no mapreduce)
with m.If(is_ldst):
- comb += self.pred_sz.eq(mode[SVP64MODE.SZ])
+ # XXX TODO, work out which of these is most appropriate
+ # set both? or just the one? or one if LD, the other if ST?
+ comb += self.pred_sz.eq(mode[SVP64MODE.DZ])
comb += self.pred_dz.eq(mode[SVP64MODE.DZ])
with m.Elif(mode[SVP64MODE.REDUCE]):
with m.If(self.rm_in.subvl == Const(0, 2)): # no SUBVL
with m.If(self.rc_in):
comb += els.eq(mode[SVP64MODE.ELS_FFIRST_PRED])
+ # Bit-reversed Mode
+ with m.If(mode[SVP64MODE.LDST_BITREV]):
+ comb += self.ldstmode.eq(SVP64LDSTmode.BITREVERSE)
# RA is vectorised
- with m.If(self.ldst_ra_vec):
+ with m.Elif(self.ldst_ra_vec):
comb += self.ldstmode.eq(SVP64LDSTmode.INDEXED)
# not element-strided, therefore unit...
with m.Elif(~els):
mapreduce = False
reverse_gear = False
+ bitreverse = False
mapreduce_crm = False
mapreduce_svm = False
smmode, smask = decode_predicate(encmode[3:])
mmode = smmode
has_smask = True
+ # bitreverse LD/ST
+ elif encmode.startswith("br"):
+ bitreverse = True
# vec2/3/4
elif encmode.startswith("vec"):
subvl = decode_subvl(encmode[3:])
if is_ldst:
# TODO: for now, LD/ST-indexed is ignored.
mode |= ldst_elstride << SVP64MODE.ELS_NORMAL # element-strided
+ # bitreverse mode
+ if bitreverse:
+ mode |= 1 << SVP64MODE.LDST_BITREV
else:
# TODO, reduce and subvector mode
# 00 1 dz CRM reduce mode (mapreduce), SUBVL=1