From 8ea804463351bc17032f450beadf3f20d42af84b Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Thu, 7 May 2020 10:37:20 -0400 Subject: [PATCH] Add test_mfcr --- src/soc/decoder/isa/test_caller.py | 7 +++++-- src/soc/decoder/selectable_int.py | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/soc/decoder/isa/test_caller.py b/src/soc/decoder/isa/test_caller.py index 21364340..78766f6c 100644 --- a/src/soc/decoder/isa/test_caller.py +++ b/src/soc/decoder/isa/test_caller.py @@ -128,8 +128,11 @@ class DecoderTestCase(FHDLTestCase): self.assertEqual(sim.gpr(1), SelectableInt(0x1234, 64)) self.assertEqual(sim.gpr(2), SelectableInt(0, 64)) - - + def test_mfcr(self): + lst = ["mfcr 1"] + with Program(lst) as program: + sim = self.run_tst_program(program) + self.assertEqual(sim.gpr(1), SelectableInt(0, 64)) def test_mtcrf(self): for i in range(4): diff --git a/src/soc/decoder/selectable_int.py b/src/soc/decoder/selectable_int.py index 33cbb74e..1227335e 100644 --- a/src/soc/decoder/selectable_int.py +++ b/src/soc/decoder/selectable_int.py @@ -342,6 +342,8 @@ def selectconcat(*args, repeat=1): args = tmp res = copy(args[0]) for i in args[1:]: + if isinstance(i, FieldSelectableInt): + i = i.si assert isinstance(i, SelectableInt), "can only concat SIs, sorry" res.bits += i.bits res.value = (res.value << i.bits) | i.value -- 2.30.2