sim: Move the MemPools object out of System and into SEWorkload.

This removes the need for all the FullSystem checks in the System class,
and simplifies that class in general.

Change-Id: Ie8a3bc67db9195027d2111009b15ca59221bdeb2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50348
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-09-13 18:22:38 -07:00
parent 473d3c72c8
commit 1a1ba692c3
17 changed files with 85 additions and 65 deletions

View File

@@ -0,0 +1,32 @@
# This upgrader moves memory pools from the system object to the SE workload
# object.
def upgrader(cpt):
systems = {}
# Find sections with 'num_mem_pools' options, and assume those are system
# objects which host MemPools.
for sec in cpt.sections():
num_mem_pools = cpt.get(sec, 'num_mem_pools', fallback=None)
if num_mem_pools is not None:
systems[sec] = num_mem_pools
for sec, num_mem_pools in systems.items():
# Transfer num_mem_pools to the new location.
cpt.remove_option(sec, 'num_mem_pools')
cpt.set(f'{sec}.workload', 'num_mem_pools', num_mem_pools)
for idx in range(int(num_mem_pools)):
old_name = f'{sec}.memPool{idx}'
new_name = f'{sec}.workload.memPool{idx}'
# Create the new section.
cpt.add_section(new_name)
# Copy items from the old section into it.
for item in cpt.items(old_name):
cpt.set(new_name, *item)
# Delete the old section.
cpt.remove_section(old_name)
depends = 'mempool-sections'