From: Tobias Platen Date: Wed, 3 Mar 2021 18:23:01 +0000 (+0100) Subject: add RADIX skeleton and unit test X-Git-Tag: convert-csv-opcode-to-binary~124 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c9f3eb6eca6ef3e7de44e8cb9dd01a84ec3d55b7;p=soc.git add RADIX skeleton and unit test --- diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index 1190831d..bb69f754 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -75,6 +75,36 @@ def create_args(reglist, extra=None): return retval + +# see qemu/target/ppc/mmu-radix64.c for reference +class RADIX: + def __init__(self, mem, caller): + self.mem = mem + self.caller = caller + + def ld(self, address, width=8, swap=True, check_in_mem=False): + print("RADIX: ld from addr 0x{:x} width {:d}".format(address, width)) + + pte = self._walk_tree() + # use pte to caclculate phys address + #mem.ld(address,width,swap,check_in_mem) + + # TODO implement + # def st(self, addr, v, width=8, swap=True): + # def memassign(self, addr, sz, val): + def _next_level(self): + return True + ## DSISR_R_BADCONFIG + ## read_entry + ## DSISR_NOPTE + ## Prepare for next iteration + + def _walk_tree(self): + # walk tree starts on prtbl + while True: + ret = self._next_level() + if ret: return ret + class Mem: def __init__(self, row_bytes=8, initial_mem=None): diff --git a/src/soc/decoder/isa/test_caller_radix.py b/src/soc/decoder/isa/test_caller_radix.py new file mode 100644 index 00000000..52928500 --- /dev/null +++ b/src/soc/decoder/isa/test_caller_radix.py @@ -0,0 +1,17 @@ +from nmigen import Module, Signal +#from nmigen.back.pysim import Simulator, Delay, Settle +from nmutil.formaltest import FHDLTestCase +#import unittest +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.decoder.isa.caller import ISACaller, inject, RADIX +from soc.decoder.selectable_int import SelectableInt +from soc.decoder.orderedset import OrderedSet +from soc.decoder.isa.all import ISA + +if __name__ == "__main__": + radix = RADIX(None,None) #first test to avoid syntax errors + radix._walk_tree() + print("DONE")