From: Jacob Lifshay Date: Thu, 1 Jun 2023 04:12:30 +0000 (-0700) Subject: format code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c20bf068f47ecc99f49478280c44d6fed95aeeb9;p=openpower-isa.git format code --- diff --git a/src/openpower/util.py b/src/openpower/util.py index 71952de5..131dc50a 100644 --- a/src/openpower/util.py +++ b/src/openpower/util.py @@ -9,26 +9,26 @@ from openpower.decoder.power_enums import SPRfull as SPR, spr_dict # note that we can get away with using SPRfull here because the values # (numerical values) are what is used for lookup. spr_to_fast = { - SPR.LR: FastRegsEnum.LR, - SPR.CTR: FastRegsEnum.CTR, - SPR.SRR0: FastRegsEnum.SRR0, - SPR.SRR1: FastRegsEnum.SRR1, - SPR.HSRR0: FastRegsEnum.HSRR0, - SPR.HSRR1: FastRegsEnum.HSRR1, - SPR.SPRG0_priv: FastRegsEnum.SPRG0, - SPR.SPRG1_priv: FastRegsEnum.SPRG1, - SPR.SPRG2_priv: FastRegsEnum.SPRG2, - SPR.SPRG3: FastRegsEnum.SPRG3, - SPR.HSPRG0: FastRegsEnum.HSPRG0, - SPR.HSPRG1: FastRegsEnum.HSPRG1, - SPR.XER: FastRegsEnum.XER, - SPR.TAR: FastRegsEnum.TAR, - SPR.SVSRR0: FastRegsEnum.SVSRR0, - } - -spr_to_state = { SPR.DEC: StateRegsEnum.DEC, - SPR.TB: StateRegsEnum.TB, - } + SPR.LR: FastRegsEnum.LR, + SPR.CTR: FastRegsEnum.CTR, + SPR.SRR0: FastRegsEnum.SRR0, + SPR.SRR1: FastRegsEnum.SRR1, + SPR.HSRR0: FastRegsEnum.HSRR0, + SPR.HSRR1: FastRegsEnum.HSRR1, + SPR.SPRG0_priv: FastRegsEnum.SPRG0, + SPR.SPRG1_priv: FastRegsEnum.SPRG1, + SPR.SPRG2_priv: FastRegsEnum.SPRG2, + SPR.SPRG3: FastRegsEnum.SPRG3, + SPR.HSPRG0: FastRegsEnum.HSPRG0, + SPR.HSPRG1: FastRegsEnum.HSPRG1, + SPR.XER: FastRegsEnum.XER, + SPR.TAR: FastRegsEnum.TAR, + SPR.SVSRR0: FastRegsEnum.SVSRR0, +} + +spr_to_state = {SPR.DEC: StateRegsEnum.DEC, + SPR.TB: StateRegsEnum.TB, + } sprstr_to_state = {} state_to_spr = {} @@ -36,6 +36,7 @@ for (k, v) in spr_to_state.items(): sprstr_to_state[k.name] = v state_to_spr[v] = k + def state_reg_to_spr(spr_num): return state_to_spr[spr_num].value @@ -52,6 +53,7 @@ for (k, v) in spr_to_fast.items(): sprstr_to_fast[k.name] = v fast_to_spr[v] = k + def fast_reg_to_spr(spr_num): return fast_to_spr[spr_num].value @@ -77,9 +79,9 @@ def spr_to_slow_reg(spr_num): # TODO: make this a util routine (somewhere) def mask_extend(x, nbits, repeat): res = 0 - extended = (1<