FRT[4] = ~WORD[1]
FRT[5:64] = selectconcat(WORD[2:32], z29)
- # Denormalized Operand
- if e.value == 0 and m.value != 0:
- log ("denormalised")
- sign = WORD[0]
- exp = -126
- frac = selectconcat(z1, WORD[9:32], z29)
- # normalize the operand
- while frac[0].value == 0:
- frac[0:53] = selectconcat(frac[1:53], z1)
- exp = exp - 1
- FRT[0] = sign
- FRT[1:12] = exp + 1023
- FRT[12:64] = frac[1:53]
+ # Denormalized Operand
+ if e.value == 0 and m.value != 0:
+ log ("denormalised")
+ sign = WORD[0]
+ exp = -126
+ frac = selectconcat(z1, WORD[9:32], z29)
+ # normalize the operand
+ while frac[0].value == 0:
+ frac[0:53] = selectconcat(frac[1:53], z1)
+ exp = exp - 1
+ FRT[0] = sign
+ FRT[1:12] = exp + 1023
+ FRT[12:64] = frac[1:53]
# Zero / Infinity / NaN
- if e.value == 255 or m.value == 0:
+ if e.value == 255 or WORD[1:32].value == 0:
log ("z/inf/nan")
FRT[0:2] = WORD[0:2]
FRT[2] = WORD[1]
print("FPR 1", sim.fpr(1))
self.assertEqual(sim.fpr(1), SelectableInt(0x4040266660000000, 64))
+ def test_fpload2(self):
+ """>>> lst = ["lfsx 1, 0, 0",
+ ]
+ """
+ lst = ["lfsx 1, 0, 0",
+ ]
+ initial_mem = {0x0000: (0xac000000, 8),
+ 0x0020: (0x1828384822324252, 8),
+ }
+
+ with Program(lst, bigendian=False) as program:
+ sim = self.run_tst_program(program, initial_mem=initial_mem)
+ print("FPR 1", sim.fpr(1))
+ self.assertEqual(sim.fpr(1), SelectableInt(0xbd80000000000000, 64))
+
def test_fp_single_ldst(self):
""">>> lst = ["lfsx 1, 1, 0", # load fp 1 from mem location 0
"stfsu 1, 16(1)", # store fp 1 into mem 0x10, update RA