From: Luke Kenneth Casson Leighton Date: Tue, 4 May 2021 16:32:40 +0000 (+0100) Subject: missed that soc.regfile.util has moved to openpower.util X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1035e9c257edd5d37e6e3fef22f2a5f3cd01cb64;p=soc.git missed that soc.regfile.util has moved to openpower.util --- diff --git a/src/soc/regfile/util.py b/src/soc/regfile/util.py index 7f4e8778..30a0f6c8 100644 --- a/src/soc/regfile/util.py +++ b/src/soc/regfile/util.py @@ -1,41 +1,4 @@ -from soc.regfile.regfiles import FastRegs -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.CTR: FastRegs.CTR, - SPR.LR: FastRegs.LR, - SPR.TAR: FastRegs.TAR, - SPR.SRR0: FastRegs.SRR0, - SPR.SRR1: FastRegs.SRR1, - SPR.XER: FastRegs.XER, - SPR.DEC: FastRegs.DEC, - SPR.TB: FastRegs.TB, - } - -sprstr_to_fast = {} -fast_to_spr = {} -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 - - -def spr_to_fast_reg(spr_num): - if not isinstance(spr_num, str): - spr_num = spr_dict[spr_num].SPR - return sprstr_to_fast.get(spr_num, None) - - -def slow_reg_to_spr(slow_reg): - for i, x in enumerate(SPR): - if slow_reg == i: - return x.value - - -def spr_to_slow_reg(spr_num): - for i, x in enumerate(SPR): - if spr_num == x.value: - return i +# XXX DO NOT NORMALLY USE WILDCARD IMPORTS, IT IS EXTREMELY BAD PRACTICE +# however it solves a migration issue moving over to the openpower library +# so a temporary exemption can be made +from openpower.util import *