From: Luke Kenneth Casson Leighton Date: Mon, 13 Jul 2020 12:02:22 +0000 (+0100) Subject: add simulator test against qemu for extswsli X-Git-Tag: div_pipeline~66 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=50da2a03d1f004240cd0ea9b6ed9cfd77d41d9fc;p=soc.git add simulator test against qemu for extswsli --- diff --git a/src/soc/fu/shift_rot/test/test_pipe_caller.py b/src/soc/fu/shift_rot/test/test_pipe_caller.py index c1b20b1a..9c5701ee 100644 --- a/src/soc/fu/shift_rot/test/test_pipe_caller.py +++ b/src/soc/fu/shift_rot/test/test_pipe_caller.py @@ -146,7 +146,7 @@ class ShiftRotTestCase(FHDLTestCase): sh = random.randint(0, 63) lst = [f"extswsli 3, 1, {sh}"] initial_regs = [0] * 32 - initial_regs[1] = random.randint(0, (1<<64)-1) + initial_regs[1] = random.randint(0, (1<<15)-1) self.run_tst_program(Program(lst, bigendian), initial_regs) def test_rlc(self): diff --git a/src/soc/simulator/test_shift_sim.py b/src/soc/simulator/test_shift_sim.py new file mode 100644 index 00000000..3ac85998 --- /dev/null +++ b/src/soc/simulator/test_shift_sim.py @@ -0,0 +1,46 @@ +from nmigen import Module, Signal +from nmigen.back.pysim import Simulator, Delay, Settle +from nmigen.test.utils import FHDLTestCase +import unittest +from soc.decoder.power_decoder import (create_pdecode) +from soc.decoder.power_enums import (Function, MicrOp, + In1Sel, In2Sel, In3Sel, + OutSel, RC, LdstLen, CryIn, + single_bit_flags, Form, SPR, + get_signal_name, get_csv) +from soc.decoder.power_decoder2 import (PowerDecode2) +from soc.simulator.program import Program +from soc.simulator.qemu import run_program +from soc.decoder.isa.all import ISA +from soc.fu.test.common import TestCase +from soc.simulator.test_sim import DecoderBase +from soc.config.endian import bigendian + + + +class MulTestCases(FHDLTestCase): + test_data = [] + + def __init__(self, name="div"): + super().__init__(name) + self.test_name = name + + def test_1_extswsli(self): + lst = ["addi 1, 0, 0x5678", + "extswsli 3, 1, 34"] + self.run_tst_program(Program(lst, bigendian), [3]) + + def run_tst_program(self, prog, initial_regs=None, initial_sprs=None, + initial_mem=None): + initial_regs = [0] * 32 + tc = TestCase(prog, self.test_name, initial_regs, initial_sprs, 0, + initial_mem, 0) + self.test_data.append(tc) + + +class MulDecoderTestCase(DecoderBase, MulTestCases): + pass + + +if __name__ == "__main__": + unittest.main()