# triple-nested for-loops
jl, jh = j, j+halfsize
+ print ("xform jl jh k", jl, jh, k,
+ "vr h l", vec_r[jh], vec_r[jl],
+ "vi h l", vec_i[jh], vec_i[jl])
+ print (" cr k", cos_r[k], "si k", sin_i[k])
tpre = vec_r[jh] * cos_r[k] + vec_i[jh] * sin_i[k]
tpim = -vec_r[jh] * sin_i[k] + vec_i[jh] * cos_r[k]
vec_r[jh] = vec_r[jl] - tpre
vec_r[jl] += tpre
vec_i[jl] += tpim
- print ("xform jl jh k", jl, jh, k,
- "vr h l", vec_r[jh], vec_r[jl],
- "vi h l", vec_i[jh], vec_i[jl])
+ print (" xform jl jh k", jl, jh, k,
+ "\n vr h l", vec_r[jh], vec_r[jl],
+ "\n vi h l", vec_i[jh], vec_i[jl])
k += tablestep
size *= 2
self.assertEqual(sim.gpr(i), SelectableInt(expected[i], 64))
def test_sv_remap_fpmadds_fft(self):
- """>>> lst = ["svremap 8, 1, 1, 1",
+ """>>> lst = ["svshape 8, 1, 1, 1",
"sv.ffmadds 2.v, 2.v, 2.v, 10.v"
]
runs a full in-place O(N log2 N) butterfly schedule for
SVP64 "REMAP" in Butterfly Mode is applied to a twin +/- FMAC
(3 inputs, 2 outputs)
"""
- lst = SVP64Asm( ["svremap 8, 1, 1, 1",
+ lst = SVP64Asm( ["svshape 8, 1, 1, 1",
"sv.ffmadds 0.v, 0.v, 0.v, 8.v"
])
lst = list(lst)
def test_sv_remap_fpmadds_fft_svstep(self):
""">>> lst = SVP64Asm( ["setvl 0, 0, 11, 1, 1, 1",
- "svremap 8, 1, 1, 1",
+ "svshape 8, 1, 1, 1",
"sv.ffmadds 0.v, 0.v, 0.v, 8.v",
"setvl. 0, 0, 0, 1, 0, 0",
"bc 4, 2, -16"
(3 inputs, 2 outputs)
"""
lst = SVP64Asm( ["setvl 0, 0, 11, 1, 1, 1",
- "svremap 8, 1, 1, 1",
+ "svshape 8, 1, 1, 1",
"sv.ffmadds 0.v, 0.v, 0.v, 8.v",
"setvl. 0, 0, 0, 1, 0, 0",
"bc 4, 2, -16"
"""
lst = SVP64Asm( ["setvl 0, 0, 11, 1, 1, 1",
# tpre
- "svremap 8, 1, 1, 1",
- "sv.fmuls 32, 0.v, 16.v",
- "svremap 8, 1, 1, 1",
- "sv.fmuls 33, 8.v, 20.v",
- "fadds 32, 32, 33",
+ "svshape 8, 1, 1, 1",
+ "sv.fmuls 24, 0.v, 16.v",
+ "svshape 8, 1, 1, 1",
+ "sv.fmuls 25, 8.v, 20.v",
+ "fadds 24, 24, 25",
# tpim
- "svremap 8, 1, 1, 1",
- "sv.fmuls 34, 0.v, 20.v",
- "svremap 8, 1, 1, 1",
- "sv.fmuls 35, 8.v, 16.v",
- "fsubs 34, 34, 35",
+ "svshape 8, 1, 1, 1",
+ "sv.fmuls 26, 0.v, 20.v",
+ "svshape 8, 1, 1, 1",
+ "sv.fmuls 26, 8.v, 16.v",
+ "fsubs 26, 26, 27",
# vec_r jh/jl
- "svremap 8, 1, 1, 1",
- "sv.ffadds 0.v, 0.v, 32",
+ "svshape 8, 1, 1, 1",
+ "sv.ffadds 0.v, 24, 25",
# vec_i jh/jl
- "svremap 8, 1, 1, 1",
- "sv.ffadds 8.v, 8.v, 34",
+ "svshape 8, 1, 1, 1",
+ "sv.ffadds 8.v, 26, 27",
# svstep loop
"setvl. 0, 0, 0, 1, 0, 0",
# complex numbers
res_r, res_i = transform_radix2_complex(ar, ai, coer, coei)
- for i, expected_r, expected_i in enumerate(zip(res_r, res_i)):
- print ("i", i, float(sim.fpr(i)),
+ for i, (expected_r, expected_i) in enumerate(zip(res_r, res_i)):
+ print ("i", i, float(sim.fpr(i)), float(sim.fpr(i+8)),
"expected_r", expected_r,
"expected_i", expected_i)
- for i, expected_r, expected_i in enumerate(zip(res_r, res_i)):
+ for i, (expected_r, expected_i) in enumerate(zip(res_r, res_i)):
# convert to Power single
expected_r = DOUBLE2SINGLE(fp64toselectable(expected_r ))
expected_r = float(expected_r)
self.assertEqual(sim.gpr(i), SelectableInt(expected[i], 64))
def test_sv_remap1(self):
- """>>> lst = ["svremap 2, 2, 3, 0",
+ """>>> lst = ["svshape 2, 2, 3, 0",
"sv.fmadds 0.v, 8.v, 16.v, 0.v"
]
REMAP fmadds FRT, FRA, FRC, FRB
"""
- lst = SVP64Asm(["svremap 2, 2, 3, 0",
+ lst = SVP64Asm(["svshape 2, 2, 3, 0",
"sv.fmadds 0.v, 16.v, 32.v, 0.v"
])
lst = list(lst)
# self.assertEqual(sim.fpr(i+6), u)
def test_sv_remap2(self):
- """>>> lst = ["svremap 5, 4, 3, 0",
+ """>>> lst = ["svshape 5, 4, 3, 0",
"sv.fmadds 0.v, 8.v, 16.v, 0.v"
]
REMAP fmadds FRT, FRA, FRC, FRB
"""
- lst = SVP64Asm(["svremap 4, 3, 3, 0",
+ lst = SVP64Asm(["svshape 4, 3, 3, 0",
"sv.fmadds 0.v, 16.v, 32.v, 0.v"
])
lst = list(lst)
yield ".long 0x%x" % insn
return
- # and svremap. note that the dimension fields one subtracted from each
- if opcode == 'svremap':
+ # and svshape. note that the dimension fields one subtracted from each
+ if opcode == 'svshape':
insn = 22 << (31-5) # opcode 22, bits 0-5
fields = list(map(int, fields))
insn |= (fields[0]-1) << (31-10) # SVxd , bits 6-10
insn |= (fields[3]) << (31-25) # SVRM , bits 21-25
insn |= 0b00001 << (31-30) # XO , bits 26..30
#insn &= ((1<<32)-1)
- log ("svremap", bin(insn))
+ log ("svshape", bin(insn))
yield ".long 0x%x" % insn
return
ls = line.split("#")
# identify macros
op = ls[0].strip()
- if op.startswith("setvl") or op.startswith("svremap"):
+ if op.startswith("setvl") or op.startswith("svshape"):
ws, line = get_ws(ls[0])
lst = list(isa.translate_one(ls[0].strip(), macros))
lst = '; '.join(lst)
]
lst = [
'sv.fmadds 0.v, 8.v, 16.v, 4.v',
- 'svremap 8, 1, 1, 1',
+ 'svshape 8, 1, 1, 1',
'sv.ffadds 0.v, 8.v, 4.v',
]
isa = SVP64Asm(lst, macros=macros)