From: Luke Kenneth Casson Leighton Date: Thu, 2 Dec 2021 15:04:30 +0000 (+0000) Subject: use namedtuple for regspec_decode X-Git-Tag: sv_maxu_works-initial~674 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e207e166deb962642ed8c6192c05bed279e427eb;p=openpower-isa.git use namedtuple for regspec_decode --- diff --git a/src/openpower/decoder/power_regspec_map.py b/src/openpower/decoder/power_regspec_map.py index ecea6c9c..749bdb2e 100644 --- a/src/openpower/decoder/power_regspec_map.py +++ b/src/openpower/decoder/power_regspec_map.py @@ -38,7 +38,9 @@ from nmigen import Const from openpower.consts import XERRegsEnum, FastRegsEnum, StateRegsEnum from openpower.decoder.power_enums import CryIn from openpower.util import log +from collections import namedtuple +RegDecodeInfo = namedtuple("RedDecodeInfo", ['okflag', 'regport']) def regspec_decode_read(m, e, regfile, name): """regspec_decode_read @@ -49,24 +51,24 @@ def regspec_decode_read(m, e, regfile, name): if regfile == 'INT': # Int register numbering is *unary* encoded if name == 'ra': # RA - return e.read_reg1.ok, e.read_reg1.data + return RegDecodeInfo(e.read_reg1.ok, e.read_reg1.data) if name == 'rb': # RB - return e.read_reg2.ok, e.read_reg2.data + return RegDecodeInfo(e.read_reg2.ok, e.read_reg2.data) if name == 'rc': # RS - return e.read_reg3.ok, e.read_reg3.data + return RegDecodeInfo(e.read_reg3.ok, e.read_reg3.data) # CR regfile if regfile == 'CR': # CRRegs register numbering is *unary* encoded if name == 'full_cr': # full CR (from FXM field) - return e.do.read_cr_whole.ok, e.do.read_cr_whole.data + return RegDecodeInfo(e.do.read_cr_whole.ok, e.do.read_cr_whole.data) if name == 'cr_a': # CR A - return e.read_cr1.ok, 1<<(7-e.read_cr1.data) + return RegDecodeInfo(e.read_cr1.ok, 1<<(7-e.read_cr1.data)) if name == 'cr_b': # CR B - return e.read_cr2.ok, 1<<(7-e.read_cr2.data) + return RegDecodeInfo(e.read_cr2.ok, 1<<(7-e.read_cr2.data)) if name == 'cr_c': # CR C - return e.read_cr3.ok, 1<<(7-e.read_cr3.data) + return RegDecodeInfo(e.read_cr3.ok, 1<<(7-e.read_cr3.data)) # XER regfile @@ -78,14 +80,15 @@ def regspec_decode_read(m, e, regfile, name): if name == 'xer_so': # SO needs to be read for overflow *and* for creation # of CR0 and also for MFSPR - return ((e.do.oe.oe[0] & e.do.oe.ok) | (e.xer_in & SO == SO)| - (e.do.rc.rc & e.do.rc.ok)), SO + return RegDecodeInfo(((e.do.oe.oe[0] & e.do.oe.ok) | + (e.xer_in & SO == SO)| + (e.do.rc.rc & e.do.rc.ok)), SO) if name == 'xer_ov': - return ((e.do.oe.oe[0] & e.do.oe.ok) | - (e.xer_in & CA == CA)), OV + return RegDecodeInfo(((e.do.oe.oe[0] & e.do.oe.ok) | + (e.xer_in & CA == CA)), OV) if name == 'xer_ca': - return ((e.do.input_carry == CryIn.CA.value) | - (e.xer_in & OV == OV)), CA + return RegDecodeInfo(((e.do.input_carry == CryIn.CA.value) | + (e.xer_in & OV == OV)), CA) # STATE regfile @@ -95,29 +98,32 @@ def regspec_decode_read(m, e, regfile, name): MSR = 1<