The upgraders in util/cpt_upgraders have been able to check the root.isa element of checkpoints to determine what "the" ISA is for a simulation, as a quick way to bail out of that particular updater applies only to specific ISAs. We are moving away from the idea that there is a single ISA, and so this mechanism will no longer work. Fortunately, these cpt_upgraders are only relevant for old checkpoints. If a checkpoint doesn't have a root.isa element inside it at all, we know (as of this writing) that it is newer than all of these upgraders and hence they do not apply. Any new upgraders will have to be written to not rely on the root.isa field which will be removed. If that sort of field is still needed, it can be added somewhere else in the hierarchy, perhaps at the system level, or as part of the actual ISA object. The simplest way to implement this new behavior is to add a fallback option when an upgrader looks for root.isa, specifically ''. If the root.isa element does not exist, the script will get '' back, and this will not match whatever ISA it's trying to check against. The one even remotely more complicated script is isa-is-simobject.py which has several behaviors for different ISAs. In that case, we just explicitly check for '' and return early if that's what we found. Jira Issue: https://gem5.atlassian.net/browse/GEM5-1056 Change-Id: Ie78deccb2bac51f38224e62a28dd733cefd63ed7 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48883 Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
def upgrader(cpt):
|
|
"""
|
|
Update the checkpoint to support initial SVE implemtation.
|
|
The updater is taking the following steps.
|
|
|
|
1) Set isa.haveSVE to false
|
|
2) Set isa.sveVL to 1
|
|
3) Add SVE misc registers in the checkpoint
|
|
"""
|
|
if cpt.get('root', 'isa', fallback='') == 'arm':
|
|
for sec in cpt.sections():
|
|
import re
|
|
# Search for all ISA sections
|
|
if re.search('.*sys.*\.cpu.*\.isa$', sec):
|
|
|
|
# haveSVE = false
|
|
cpt.set(sec, 'haveSVE', 'false')
|
|
|
|
# sveVL (sve Vector Length in quadword) = 1
|
|
# (This is a dummy value since haveSVE is set to false)
|
|
cpt.set(sec, 'sveVL', '1')
|
|
|
|
# Updating SVE misc registers (dummy values)
|
|
mr = cpt.get(sec, 'miscRegs').split()
|
|
if len(mr) == 820:
|
|
print("MISCREG_SVE registers already seems "
|
|
"to be inserted.")
|
|
else:
|
|
# Replace MISCREG_FREESLOT_1 with MISCREG_ID_AA64ZFR0_EL1
|
|
mr[-1] = 0;
|
|
|
|
mr.append(0); # Add dummy value for MISCREG_ZCR_EL3
|
|
mr.append(0); # Add dummy value for MISCREG_ZCR_EL2
|
|
mr.append(0); # Add dummy value for MISCREG_ZCR_EL12
|
|
mr.append(0); # Add dummy value for MISCREG_ZCR_EL1
|
|
cpt.set(sec, 'miscRegs', ' '.join(str(x) for x in mr))
|
|
|
|
legacy_version = 15
|