-Subproject commit 3cde5558a3df42b4a08be86881b03dbbdf5ea3e2
+Subproject commit 1bfe6d5bd723b78bd694a1f0955f1982f453196d
res = yield from get_cu_inputs(dec2, sim)
return res
- def check_cu_outputs(self, res, dec2, sim, code):
+ def check_cu_outputs(self, res, dec2, sim, alu, code):
"""naming (res) must conform to ALUFunctionUnit output regspec
"""
yield from ALUHelpers.get_sim_int_o(sim_o, sim, dec2)
yield from ALUHelpers.get_wr_sim_cr_a(sim_o, sim, dec2)
- yield from ALUHelpers.get_sim_xer_ov(sim_o, sim, dec2)
+ yield from ALUHelpers.get_wr_sim_xer_ov(sim_o, sim, alu, dec2)
yield from ALUHelpers.get_wr_sim_xer_ca(sim_o, sim, dec2)
- yield from ALUHelpers.get_sim_xer_so(sim_o, sim, dec2)
+ yield from ALUHelpers.get_wr_sim_xer_so(sim_o, sim, alu, dec2)
ALUHelpers.check_cr_a(self, res, sim_o, "CR%d %s" % (cridx, code))
ALUHelpers.check_xer_ov(self, res, sim_o, code)
res = yield from get_cu_inputs(dec2, sim)
return res
- def check_cu_outputs(self, res, dec2, sim, code):
+ def check_cu_outputs(self, res, dec2, sim, alu, code):
"""naming (res) must conform to BranchFunctionUnit output regspec
"""
from soc.decoder.isa.all import ISA
from soc.experiment.compalu_multi import find_ok # hack
-
+from soc.config.test.test_loadstore import TestMemPspec
def set_cu_input(cu, idx, data):
rdop = cu.get_in_name(idx)
if self.funit == Function.LDST:
from soc.experiment.l0_cache import TstL0CacheBuffer
- m.submodules.l0 = l0 = TstL0CacheBuffer(n_units=1, regwid=64,
- addrwid=3,
- ifacetype='test_bare_wb')
+ pspec = TestMemPspec(ldst_ifacetype='test_bare_wb',
+ addr_wid=48,
+ mask_wid=8,
+ reg_wid=64)
+ m.submodules.l0 = l0 = TstL0CacheBuffer(pspec, n_units=1)
pi = l0.l0.dports[0]
- m.submodules.cu = cu = self.fukls(pi, awid=3)
+ m.submodules.cu = cu = self.fukls(pi, idx=0, awid=3)
m.d.comb += cu.ad.go.eq(cu.ad.rel) # link addr-go direct to rel
m.d.comb += cu.st.go.eq(cu.st.rel) # link store-go direct to rel
else:
yield from dump_sim_memory(self, l0, sim, code)
yield from self.iodef.check_cu_outputs(res, pdecode2,
- sim, code)
+ sim, cu.alu, code)
# sigh. hard-coded. test memory
if self.funit == Function.LDST:
res = yield from get_cu_inputs(dec2, sim)
return res
- def check_cu_outputs(self, res, dec2, sim, code):
+ def check_cu_outputs(self, res, dec2, sim, alu, code):
"""naming (res) must conform to CRFunctionUnit output regspec
"""
res = yield from get_cu_inputs(dec2, sim)
return res
- def check_cu_outputs(self, res, dec2, sim, code):
+ def check_cu_outputs(self, res, dec2, sim, alu, code):
"""naming (res) must conform to LogicalFunctionUnit output regspec
"""
res = yield from get_cu_inputs(dec2, sim)
return res
- def check_cu_outputs(self, res, dec2, sim, code):
+ def check_cu_outputs(self, res, dec2, sim, alu, code):
"""naming (res) must conform to ShiftRotFunctionUnit output regspec
"""
res = yield from get_cu_inputs(dec2, sim)
return res
- def check_cu_outputs(self, res, dec2, sim, code):
+ def check_cu_outputs(self, res, dec2, sim, alu, code):
"""naming (res) must conform to SPRFunctionUnit output regspec
"""
sim_o = {}
+ yield from ALUHelpers.get_int_o(res, alu, dec2)
+ yield from ALUHelpers.get_fast_spr1(res, alu, dec2)
+ yield from ALUHelpers.get_slow_spr1(res, alu, dec2)
+ yield from ALUHelpers.get_xer_ov(res, alu, dec2)
+ yield from ALUHelpers.get_xer_ca(res, alu, dec2)
+ yield from ALUHelpers.get_xer_so(res, alu, dec2)
+
+ print ("output", res)
+
yield from ALUHelpers.get_sim_int_o(sim_o, sim, dec2)
- yield from ALUHelpers.get_wr_sim_cr_a(sim_o, sim, dec2)
- yield from ALUHelpers.get_sim_xer_ov(sim_o, sim, dec2)
+ yield from ALUHelpers.get_wr_sim_xer_so(sim_o, sim, alu, dec2)
+ yield from ALUHelpers.get_wr_sim_xer_ov(sim_o, sim, alu, dec2)
yield from ALUHelpers.get_wr_sim_xer_ca(sim_o, sim, dec2)
yield from ALUHelpers.get_wr_fast_spr1(sim_o, sim, dec2)
yield from ALUHelpers.get_wr_slow_spr1(sim_o, sim, dec2)
+ print ("sim output", sim_o)
+
ALUHelpers.check_xer_ov(self, res, sim_o, code)
ALUHelpers.check_xer_ca(self, res, sim_o, code)
+ ALUHelpers.check_xer_so(self, res, sim_o, code)
ALUHelpers.check_int_o(self, res, sim_o, code)
ALUHelpers.check_fast_spr1(self, res, sim_o, code)
ALUHelpers.check_slow_spr1(self, res, sim_o, code)
- ALUHelpers.check_xer_so(self, res, sim_o, code)
if __name__ == "__main__":
res = yield from get_cu_inputs(dec2, sim)
return res
- def check_cu_outputs(self, res, dec2, sim, code):
+ def check_cu_outputs(self, res, dec2, sim, alu, code):
"""naming (res) must conform to TrapFunctionUnit output regspec
"""
def test_1_mfspr(self):
lst = ["mfspr 1, 26", # SRR0
"mfspr 2, 27", # SRR1
- "mfspr 2, 8",] # LR
+ "mfspr 3, 8", # LR
+ "mfspr 4, 1",] # XER
initial_regs = [0] * 32
- initial_sprs = {'SRR0': 0x12345678, 'SRR1': 0x5678, 'LR': 0x1234}
+ initial_sprs = {'SRR0': 0x12345678, 'SRR1': 0x5678, 'LR': 0x1234,
+ 'XER': 0xe00c0000}
+ self.run_tst_program(Program(lst), initial_regs, initial_sprs)
+
+ def test_1_mtspr(self):
+ lst = ["mtspr 26, 1", # SRR0
+ "mtspr 27, 2", # and into reg 2
+ "mtspr 1, 3",] # XER
+ initial_regs = [0] * 32
+ initial_regs[1] = 0x129518230011feed
+ initial_regs[2] = 0x129518230011feed
+ initial_regs[3] = 0xe00c0000
+ initial_sprs = {'SRR0': 0x12345678, 'SRR1': 0x5678, 'LR': 0x1234,
+ 'XER': 0x0}
self.run_tst_program(Program(lst), initial_regs, initial_sprs)
def test_ilang(self):
print ("output", res)
yield from ALUHelpers.get_sim_int_o(sim_o, sim, dec2)
- yield from ALUHelpers.get_wr_sim_cr_a(sim_o, sim, dec2)
- yield from ALUHelpers.get_sim_xer_ov(sim_o, sim, dec2)
+ yield from ALUHelpers.get_wr_sim_xer_so(sim_o, sim, alu, dec2)
+ yield from ALUHelpers.get_wr_sim_xer_ov(sim_o, sim, alu, dec2)
yield from ALUHelpers.get_wr_sim_xer_ca(sim_o, sim, dec2)
yield from ALUHelpers.get_wr_fast_spr1(sim_o, sim, dec2)
yield from ALUHelpers.get_wr_slow_spr1(sim_o, sim, dec2)
+ print ("sim output", sim_o)
+
ALUHelpers.check_xer_ov(self, res, sim_o, code)
ALUHelpers.check_xer_ca(self, res, sim_o, code)
+ ALUHelpers.check_xer_so(self, res, sim_o, code)
ALUHelpers.check_int_o(self, res, sim_o, code)
ALUHelpers.check_fast_spr1(self, res, sim_o, code)
ALUHelpers.check_slow_spr1(self, res, sim_o, code)
- ALUHelpers.check_xer_so(self, res, sim_o, code)
if __name__ == "__main__":
oe = yield dec2.e.do.oe.oe
oe_ok = yield dec2.e.do.oe.ok
xer_out = yield dec2.e.xer_out
+ if not (yield alu.n.data_o.xer_so.ok):
+ return
if xer_out or (oe and oe_ok):
res['xer_so'] = yield alu.n.data_o.xer_so.data[0]
oe = yield dec2.e.do.oe.oe
oe_ok = yield dec2.e.do.oe.ok
xer_out = yield dec2.e.xer_out
+ if not (yield alu.n.data_o.xer_ov.ok):
+ return
if xer_out or (oe and oe_ok):
res['xer_ov'] = yield alu.n.data_o.xer_ov.data
def get_xer_ca(res, alu, dec2):
cry_out = yield dec2.e.do.output_carry
xer_out = yield dec2.e.xer_out
+ if not (yield alu.n.data_o.xer_ca.ok):
+ return
if xer_out or (cry_out):
res['xer_ca'] = yield alu.n.data_o.xer_ca.data
res['spr1'] = sim.spr[spr_name].value
def get_wr_sim_xer_ca(res, sim, dec2):
+ #if not (yield alu.n.data_o.xer_ca.ok):
+ # return
cry_out = yield dec2.e.do.output_carry
- if cry_out:
+ xer_out = yield dec2.e.xer_out
+ if cry_out or xer_out:
expected_carry = 1 if sim.spr['XER'][XER_bits['CA']] else 0
expected_carry32 = 1 if sim.spr['XER'][XER_bits['CA32']] else 0
res['xer_ca'] = expected_carry | (expected_carry32 << 1)
+ def get_wr_sim_xer_ov(res, sim, alu, dec2):
+ oe = yield dec2.e.do.oe.oe
+ oe_ok = yield dec2.e.do.oe.ok
+ xer_out = yield dec2.e.xer_out
+ print ("get_wr_sim_xer_ov", xer_out)
+ if not (yield alu.n.data_o.xer_ov.ok):
+ return
+ if xer_out or (oe and oe_ok):
+ expected_ov = 1 if sim.spr['XER'][XER_bits['OV']] else 0
+ expected_ov32 = 1 if sim.spr['XER'][XER_bits['OV32']] else 0
+ res['xer_ov'] = expected_ov | (expected_ov32 << 1)
+
+ def get_wr_sim_xer_so(res, sim, alu, dec2):
+ oe = yield dec2.e.do.oe.oe
+ oe_ok = yield dec2.e.do.oe.ok
+ xer_out = yield dec2.e.xer_out
+ if not (yield alu.n.data_o.xer_so.ok):
+ return
+ if xer_out or (oe and oe_ok):
+ res['xer_so'] = 1 if sim.spr['XER'][XER_bits['SO']] else 0
+
def get_sim_xer_ov(res, sim, dec2):
oe = yield dec2.e.do.oe.oe
oe_ok = yield dec2.e.do.oe.ok
initial_regs[1] = 0xffffffffffffffff
self.run_tst_program(Program(lst), initial_regs)
- def test_2_mtmsr_1(self):
+ def test_3_mtmsr_1(self):
lst = ["mtmsr 1,1"]
initial_regs = [0] * 32
initial_regs[1] = 0xffffffffffffffff