A-Form
-* faddso FRT,FRA,FRB (Rc=0)
-* faddso. FRT,FRA,FRB (Rc=1)
+* ffadds FRT,FRA,FRB (Rc=0)
+* ffadds. FRT,FRA,FRB (Rc=1)
Pseudo-code:
A-Form
-* faddo FRT,FRA,FRB (Rc=0)
-* faddo. FRT,FRA,FRB (Rc=1)
+* ffadd FRT,FRA,FRB (Rc=0)
+* ffadd. FRT,FRA,FRB (Rc=1)
Pseudo-code:
A-Form
-* fsubso FRT,FRA,FRB (Rc=0)
-* fsubso. FRT,FRA,FRB (Rc=1)
+* ffsubs FRT,FRA,FRB (Rc=0)
+* ffsubs. FRT,FRA,FRB (Rc=1)
Pseudo-code:
A-Form
-* fsubo FRT,FRA,FRB (Rc=0)
-* fsubo. FRT,FRA,FRB (Rc=1)
+* ffsub FRT,FRA,FRB (Rc=0)
+* ffsub. FRT,FRA,FRB (Rc=1)
Pseudo-code:
A-Form
-* fmulso FRT,FRA,FRC (Rc=0)
-* fmulso. FRT,FRA,FRC (Rc=1)
+* ffmuls FRT,FRA,FRC (Rc=0)
+* ffmuls. FRT,FRA,FRC (Rc=1)
Pseudo-code:
A-Form
-* fmulo FRT,FRA,FRC (Rc=0)
-* fmulo. FRT,FRA,FRC (Rc=1)
+* ffmul FRT,FRA,FRC (Rc=0)
+* ffmul. FRT,FRA,FRC (Rc=1)
Pseudo-code:
A-Form
-* fdivso FRT,FRA,FRB (Rc=0)
-* fdivso. FRT,FRA,FRB (Rc=1)
+* ffdivs FRT,FRA,FRB (Rc=0)
+* ffdivs. FRT,FRA,FRB (Rc=1)
Pseudo-code:
A-Form
-* fdivo FRT,FRA,FRB (Rc=0)
-* fdivo. FRT,FRA,FRB (Rc=1)
+* ffdiv FRT,FRA,FRB (Rc=0)
+* ffdiv. FRT,FRA,FRB (Rc=1)
Pseudo-code:
A-Form
-* fmaddso FRT,FRA,FRC,FRB (Rc=0)
-* fmaddso. FRT,FRA,FRC,FRB (Rc=1)
+* ffmadds FRT,FRA,FRC,FRB (Rc=0)
+* ffmadds. FRT,FRA,FRC,FRB (Rc=1)
Pseudo-code:
FRT <- FPMULADD32(FRA, FRC, FRB, 1, 1)
- FRS <- FPMULADD32(FRA, FRC, FRB, 1, -1)
+ FRS <- FPMULADD32(FRA, FRC, FRB, -1, 1)
Special Registers Altered:
A-Form
-* fmsubso FRT,FRA,FRC,FRB (Rc=0)
-* fmsubso. FRT,FRA,FRC,FRB (Rc=1)
+* ffmsubs FRT,FRA,FRC,FRB (Rc=0)
+* ffmsubs. FRT,FRA,FRC,FRB (Rc=1)
Pseudo-code:
FRT <- FPMULADD32(FRA, FRC, FRB, 1, -1)
- FRS <- FPMULADD32(FRA, FRC, FRB, 1, 1)
+ FRS <- FPMULADD32(FRA, FRC, FRB, -1, -1)
Special Registers Altered:
A-Form
-* fnmaddso FRT,FRA,FRC,FRB (Rc=0)
-* fnmaddso. FRT,FRA,FRC,FRB (Rc=1)
+* ffnmadds FRT,FRA,FRC,FRB (Rc=0)
+* ffnmadds. FRT,FRA,FRC,FRB (Rc=1)
Pseudo-code:
FRT <- FPMULADD32(FRA, FRC, FRB, -1, -1)
- FRS <- FPMULADD32(FRA, FRC, FRB, -1, 1)
+ FRS <- FPMULADD32(FRA, FRC, FRB, 1, -1)
Special Registers Altered:
A-Form
-* fnmsubso FRT,FRA,FRC,FRB (Rc=0)
-* fnmsubso. FRT,FRA,FRC,FRB (Rc=1)
+* ffnmsubs FRT,FRA,FRC,FRB (Rc=0)
+* ffnmsubs. FRT,FRA,FRC,FRB (Rc=1)
Pseudo-code:
FRT <- FPMULADD32(FRA, FRC, FRB, -1, 1)
- FRS <- FPMULADD32(FRA, FRC, FRB, -1, -1)
+ FRS <- FPMULADD32(FRA, FRC, FRB, 1, 1)
Special Registers Altered:
lha,~SVP64BREV,2P,EXTRA3,d:RT,s:RA,0,0,RA_OR_ZERO,0,0,RT,0,0,0
lfs,~SVP64BREV,2P,EXTRA3,d:FRT,s:RA,0,0,RA_OR_ZERO,0,0,FRT,0,0,0
l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A,~SVP64FFT
------11100,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,fmsubso,A,SVP64FFT
------11101,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,fmaddso,A,SVP64FFT
------11110,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,fnmsubso,A,SVP64FFT
------11111,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,fnmaddso,A,SVP64FFT
+-----11100,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,fmsubs,A,
+-----11101,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,fmadds,A,
+-----11110,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,fnmsubs,A,
+-----11111,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,fnmadds,A,
+-----00100,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,ffmsubs,A,
+-----00101,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,ffmadds,A,
+-----00110,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,ffnmsubs,A,
+-----00111,FPU,OP_FP_MADD,FRA,FRB,FRC,FRT,NONE,CR1,0,0,ZERO,0,NONE,0,0,0,0,1,0,RC,0,0,ffnmadds,A,
result = -(float(FRA) * float(FRC) + float(FRB)) # fnmadds
elif addsign == 0:
result = 0.0
- log ("FPMULADD32", FRA, FRB, FRC,
- float(FRA), float(FRB), float(FRC),
- result)
+ log ("FPMULADD32 FRA FRC FRB", FRA, FRC, FRB)
+ log (" FRA", float(FRA))
+ log (" FRC", float(FRC))
+ log (" FRB", float(FRB))
+ log (" (FRA*FRC)+FRB=", mulsign, addsign, result)
cvt = fp64toselectable(result)
cvt = DOUBLE2SINGLE(cvt)
log (" cvt", cvt)
# TODO, really should just be using PowerDecoder2
def get_pdecode_idx_out2(dec2, name):
# check first if register is activated for write
- out_ok = yield dec2.e.write_ea.ok
- if not out_ok:
- return None, False
-
op = dec2.dec.op
out_sel = yield op.out_sel
out = yield dec2.e.write_ea.data
o_isvec = yield dec2.o2_isvec
- log ("get_pdecode_idx_out2", name, out_sel, out, o_isvec)
+ out_ok = yield dec2.e.write_ea.ok
+ log ("get_pdecode_idx_out2", name, out_sel, out, out_ok, o_isvec)
+ if not out_ok:
+ return None, False
+
if name == 'RA':
if hasattr(op, "upd"):
# update mode LD/ST uses read-reg A also as an output
out, o_isvec)
if upd == LDSTMode.update.value:
return out, o_isvec
+ if name == 'FRS':
+ int_op = yield dec2.dec.op.internal_op
+ fft_en = yield dec2.use_svp64_fft
+ if int_op == MicrOp.OP_FP_MADD.value and fft_en:
+ log ("get_pdecode_idx_out2", out_sel, OutSel.FRS.value,
+ out, o_isvec)
+ return out, o_isvec
return None, False
pfx.insn[7].value == 0b1 and
pfx.insn[9].value == 0b1)
self.pc.update_nia(self.is_svp64_mode)
+ yield self.dec2.is_svp64_mode.eq(self.is_svp64_mode) # set SVP64 decode
self.namespace['NIA'] = self.pc.NIA
self.namespace['SVSTATE'] = self.svstate.spr
if not self.is_svp64_mode:
illegal = False
name = 'setvl'
+ # sigh also deal with ffmadds not being supported by binutils (.long)
+ if asmop == 'ffmadds':
+ illegal = False
+ name = 'ffmadds'
+
if illegal:
print("illegal", name, asmop)
self.call_trap(0x700, PIb.ILLEG)
srcstep = self.svstate.srcstep.asint(msb0=True)
dststep = self.svstate.dststep.asint(msb0=True)
sv_a_nz = yield self.dec2.sv_a_nz
+ fft_mode = yield self.dec2.use_svp64_fft
in1 = yield self.dec2.e.read_reg1.data
- log ("SVP64: VL, srcstep, dststep, sv_a_nz, in1",
- vl, srcstep, dststep, sv_a_nz, in1)
+ log ("SVP64: VL, srcstep, dststep, sv_a_nz, in1 fft",
+ vl, srcstep, dststep, sv_a_nz, in1, fft_mode)
# get predicate mask
srcmask = dstmask = 0xffff_ffff_ffff_ffff
}
pdecode = create_pdecode(name="rowsub",
col_subset={'opcode', 'function_unit',
+ 'asmcode',
'in2_sel', 'in3_sel'},
row_subset=rowsubsetfn,
include_fp=True,
# if bit-reverse mode requested
bitrev = rm_dec.ldstmode == SVP64LDSTmode.BITREVERSE
comb += self.use_svp64_ldst_dec.eq(bitrev)
- # if SVP64 FFT mode enabled (overload OE ha ha)
- comb += self.use_svp64_fft.eq(self.dec.OE)
+ # if SVP64 FFT mode enabled
+ comb += self.use_svp64_fft.eq(self.is_svp64_mode)
# decoded/selected instruction flags
comb += self.do_copy("data_len", self.op_get("ldst_len"))
comb += to_reg.data.eq(vl+svdec.reg_out+(vl-1-dststep))
with m.Else():
comb += to_reg.data.eq(vl+dststep+svdec.reg_out)
+ with m.Else():
+ comb += to_reg.data.eq(vl+svdec.reg_out)
# ... but write to *second* output
comb += self.o2_isvec.eq(svdec.isvec)
comb += o2_svdec.idx.eq(self.op_get("sv_out"))
"fadd", "fadds", "fsub", "fsubs", # FP add / sub
"fcfids", "fcfidus", "fsqrts", "fres", "frsqrtes", # FP stuff
"fmsubs", "fmadds", "fnmsubs", "fnmadds", # FP 3-arg
+ "ffmsubs", "ffmadds", "ffnmsubs", "ffnmadds", # FFT FP 3-arg
"fmul", "fmuls", "fdiv", "fdivs", # FP mul / div
"fmr", "fabs", "fnabs", "fneg", "fcpsgn", # FP move/abs/neg
"hrfid", "icbi", "icbt", "isel", "isync",
SPR = 3
RT_OR_ZERO = 4
FRT = 5
+ FRS = 6
@unique
# Helper function
regs = ['RA', 'RS', 'RB', 'RC', 'RT']
-fregs = ['FRA', 'FRS', 'FRB', 'FRC', 'FRT']
+fregs = ['FRA', 'FRS', 'FRB', 'FRC', 'FRT', 'FRS']
def Assign(autoassign, assignname, left, right, iea_mode):
names = []
iinf = ''
# write headers: FP gets extra imports
f.write(header) # write out header
- if pagename.startswith("fp"):
+ if (pagename.startswith("fp") or
+ pagename.startswith("svfp")):
f.write(fpheader)
f.write("class %s:\n" % pagename)
rc = '.' if rc_mode else ''
yield ".long 0x%x" % svp64_prefix.insn.value
log(v30b_newfields)
- yield "%s %s" % (v30b_op+rc, ", ".join(v30b_newfields))
+ # argh, sv.fmaddso etc. need to be done manually
+ if v30b_op == 'ffmadds':
+ opcode = 59 << (32-6) # bits 0..6 (MSB0)
+ opcode |= int(v30b_newfields[0]) << (32-11) # FRT
+ opcode |= int(v30b_newfields[1]) << (32-16) # FRA
+ opcode |= int(v30b_newfields[2]) << (32-21) # FRB
+ opcode |= int(v30b_newfields[3]) << (32-26) # FRC
+ opcode |= 5 << (32-31) # bits 26-30
+ if rc:
+ opcode |= 1 # Rc, bit 31.
+ yield ".long 0x%x" % opcode
+ else:
+ yield "%s %s" % (v30b_op+rc, ", ".join(v30b_newfields))
log ("new v3.0B fields", v30b_op, v30b_newfields)
def translate(self, lst):
lst = [
'sv.addi win2.v, win.v, -1',
'sv.add./mrr 5.v, 2.v, 1.v',
- 'sv.lhzbr 5.v, 11(9.v), 15',
- 'sv.lwzbr 5.v, 11(9.v), 15',
+ #'sv.lhzbr 5.v, 11(9.v), 15',
+ #'sv.lwzbr 5.v, 11(9.v), 15',
+ 'sv.ffmadds 6.v, 2.v, 4.v, 6.v',
]
isa = SVP64Asm(lst, macros=macros)
print ("list", list(isa))