arm,config: Refactor the example big.LITTLE(tm) configuration
This patch prepares future extensions and customisation of the example big.LITTLE configuration script. It breaks out the major phases into functions so they can be called from other python scripts. Change-Id: I2cb7c207c410fe14602cf17af7482719abba6c24 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
parent
80c17d0a8d
commit
54c478c0b8
1 changed files with 25 additions and 10 deletions
|
@ -108,10 +108,7 @@ def createSystem(caches, kernel, bootscript, disks=[]):
|
||||||
return sys
|
return sys
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def addOptions(parser):
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
description="Generic ARM big.LITTLE configuration")
|
|
||||||
|
|
||||||
parser.add_argument("--restore-from", type=str, default=None,
|
parser.add_argument("--restore-from", type=str, default=None,
|
||||||
help="Restore from checkpoint")
|
help="Restore from checkpoint")
|
||||||
parser.add_argument("--dtb", type=str, default=default_dtb,
|
parser.add_argument("--dtb", type=str, default=default_dtb,
|
||||||
|
@ -138,11 +135,12 @@ def main():
|
||||||
help="Big CPU clock frequency")
|
help="Big CPU clock frequency")
|
||||||
parser.add_argument("--little-cpu-clock", type=str, default="1GHz",
|
parser.add_argument("--little-cpu-clock", type=str, default="1GHz",
|
||||||
help="Little CPU clock frequency")
|
help="Little CPU clock frequency")
|
||||||
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
def build(options):
|
||||||
m5.ticks.fixGlobalFrequency()
|
m5.ticks.fixGlobalFrequency()
|
||||||
|
|
||||||
options = parser.parse_args()
|
|
||||||
|
|
||||||
kernel_cmd = [
|
kernel_cmd = [
|
||||||
"earlyprintk=pl011,0x1c090000",
|
"earlyprintk=pl011,0x1c090000",
|
||||||
"console=ttyAMA0",
|
"console=ttyAMA0",
|
||||||
|
@ -208,20 +206,27 @@ def main():
|
||||||
# Linux device tree
|
# Linux device tree
|
||||||
system.dtb_filename = SysPaths.binary(options.dtb)
|
system.dtb_filename = SysPaths.binary(options.dtb)
|
||||||
|
|
||||||
|
return root
|
||||||
|
|
||||||
|
|
||||||
|
def instantiate(checkpoint_path=None):
|
||||||
# Get and load from the chkpt or simpoint checkpoint
|
# Get and load from the chkpt or simpoint checkpoint
|
||||||
if options.restore_from is not None:
|
if checkpoint_path is not None:
|
||||||
m5.instantiate(options.restore_from)
|
m5.util.inform("Restoring from checkpoint %s", checkpoint_path)
|
||||||
|
m5.instantiate(checkpoint_path)
|
||||||
else:
|
else:
|
||||||
m5.instantiate()
|
m5.instantiate()
|
||||||
|
|
||||||
|
|
||||||
|
def run(checkpoint_dir=m5.options.outdir):
|
||||||
# start simulation (and drop checkpoints when requested)
|
# start simulation (and drop checkpoints when requested)
|
||||||
while True:
|
while True:
|
||||||
event = m5.simulate()
|
event = m5.simulate()
|
||||||
exit_msg = event.getCause()
|
exit_msg = event.getCause()
|
||||||
if exit_msg == "checkpoint":
|
if exit_msg == "checkpoint":
|
||||||
print "Dropping checkpoint at tick %d" % m5.curTick()
|
print "Dropping checkpoint at tick %d" % m5.curTick()
|
||||||
cpt_dir = os.path.join(m5.options.outdir, "cpt.%d" % m5.curTick())
|
cpt_dir = os.path.join(checkpoint_dir, "cpt.%d" % m5.curTick())
|
||||||
m5.checkpoint(os.path.join(cpt_dir))
|
m5.checkpoint(cpt_dir)
|
||||||
print "Checkpoint done."
|
print "Checkpoint done."
|
||||||
else:
|
else:
|
||||||
print exit_msg, " @ ", m5.curTick()
|
print exit_msg, " @ ", m5.curTick()
|
||||||
|
@ -230,5 +235,15 @@ def main():
|
||||||
sys.exit(event.getCode())
|
sys.exit(event.getCode())
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Generic ARM big.LITTLE configuration")
|
||||||
|
addOptions(parser)
|
||||||
|
options = parser.parse_args()
|
||||||
|
root = build(options)
|
||||||
|
instantiate(options.restore_from)
|
||||||
|
run()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__m5_main__":
|
if __name__ == "__m5_main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue