From 448222111ee73e75c9276fddaaa73c4e17218fc5 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 7 Apr 2020 15:37:35 +0100 Subject: [PATCH] add CR and add field-selectable versions of CR0-7 --- src/soc/decoder/isa/caller.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index d07e54ca..90f1d764 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -1,6 +1,7 @@ from functools import wraps from soc.decoder.orderedset import OrderedSet -from soc.decoder.selectable_int import SelectableInt, selectconcat +from soc.decoder.selectable_int import (FieldSelectableInt, SelectableInt, + selectconcat) from collections import namedtuple import math @@ -145,13 +146,25 @@ class ISACaller: # 3.2.2 p45 XER (actually SPR #0) # 3.2.3 p46 p232 VRSAVE (actually SPR #256) + # create CR then allow portions of it to be "selectable" (below) + self.cr = SelectableInt(0, 32) + self.namespace = {'GPR': self.gpr, 'MEM': self.mem, 'memassign': self.memassign, 'NIA': self.pc.NIA, 'CIA': self.pc.CIA, + 'CR': self.cr, } + # field-selectable versions of Condition Register TODO check bitranges? + self.crl = [] + for i in range(8): + bits = tuple(range(i*4, (i+1)*4))# errr... maybe? + _cr = FieldSelectableInt(self.cr, bits) + self.crl.append(_cr) + self.namespace["CR%d" % i] = _cr + self.decoder = decoder2 def memassign(self, ea, sz, val): -- 2.30.2