From 36a1f299ee386659b4bf55c68379738331b8f974 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 31 May 2023 21:12:30 -0700 Subject: [PATCH] format code --- src/openpower/util.py | 48 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) 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<