From 5c97b5ef4bce2eb475319d43f0791b6e77ba1cb5 Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Sun, 5 Apr 2020 13:59:40 -0400 Subject: [PATCH] Add class for combining multiple instruction classes --- src/soc/decoder/isa/__init__.py | 6 ++++++ src/soc/decoder/isa/test_caller.py | 27 ++------------------------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/soc/decoder/isa/__init__.py b/src/soc/decoder/isa/__init__.py index e69de29b..8f5f9f2a 100644 --- a/src/soc/decoder/isa/__init__.py +++ b/src/soc/decoder/isa/__init__.py @@ -0,0 +1,6 @@ +from fixedarith import fixedarith +from fixedload import fixedload + + +class ISA(fixedarith, fixedload): + pass diff --git a/src/soc/decoder/isa/test_caller.py b/src/soc/decoder/isa/test_caller.py index b1a90de3..73692f00 100644 --- a/src/soc/decoder/isa/test_caller.py +++ b/src/soc/decoder/isa/test_caller.py @@ -6,33 +6,10 @@ from soc.decoder.isa.caller import ISACaller from soc.decoder.power_decoder import (create_pdecode) from soc.decoder.power_decoder2 import (PowerDecode2) from soc.simulator.program import Program -from soc.simulator.qemu import run_program from soc.decoder.isa.caller import ISACaller, inject -from soc.decoder.helpers import (EXTS64, EXTZ64, ROTL64, ROTL32, MASK,) from soc.decoder.selectable_int import SelectableInt -from soc.decoder.selectable_int import selectconcat as concat from soc.decoder.orderedset import OrderedSet - -class fixedarith(ISACaller): - - @inject() - def op_addi(self, RA): - if RA == 0: - RT = SI - else: - RT = RA + SI - return (RT,) - @inject() - def op_add(self, RA, RB): - RT = RA + RB - return (RT,) - - instrs = {} - instrs['addi'] = (op_addi, OrderedSet(['RA']), - OrderedSet(), OrderedSet(['RT'])) - instrs['add'] = (op_add, OrderedSet(['RA', 'RB']), - OrderedSet(), OrderedSet(['RT'])) - +from soc.decoder.isa import ISA class Register: @@ -48,7 +25,7 @@ class DecoderTestCase(FHDLTestCase): instruction = Signal(32) pdecode = create_pdecode() - simulator = fixedarith(pdecode, initial_regs) + simulator = ISA(pdecode, initial_regs) m.submodules.pdecode2 = pdecode2 = PowerDecode2(pdecode) comb += pdecode2.dec.raw_opcode_in.eq(instruction) -- 2.30.2