memory-per-range.py revision 11077:fae097742b7e
17199Sgblack@eecs.umich.edu# The backing store supporting the memories in the system has changed
27199Sgblack@eecs.umich.edu# in that it is now stored globally per address range. As a result the
37199Sgblack@eecs.umich.edu# actual storage is separate from the memory controllers themselves.
47199Sgblack@eecs.umich.edudef upgrader(cpt):
57199Sgblack@eecs.umich.edu    for sec in cpt.sections():
67199Sgblack@eecs.umich.edu        import re
77199Sgblack@eecs.umich.edu        # Search for a physical memory
87199Sgblack@eecs.umich.edu        if re.search('.*sys.*\.physmem$', sec):
97199Sgblack@eecs.umich.edu            # Add the number of stores attribute to the global physmem
107199Sgblack@eecs.umich.edu            cpt.set(sec, 'nbr_of_stores', '1')
117199Sgblack@eecs.umich.edu
127199Sgblack@eecs.umich.edu            # Get the filename and size as this is moving to the
137199Sgblack@eecs.umich.edu            # specific backing store
147199Sgblack@eecs.umich.edu            mem_filename = cpt.get(sec, 'filename')
157199Sgblack@eecs.umich.edu            mem_size = cpt.get(sec, '_size')
167199Sgblack@eecs.umich.edu            cpt.remove_option(sec, 'filename')
177199Sgblack@eecs.umich.edu            cpt.remove_option(sec, '_size')
187199Sgblack@eecs.umich.edu
197199Sgblack@eecs.umich.edu            # Get the name so that we can create the new section
207199Sgblack@eecs.umich.edu            system_name = str(sec).split('.')[0]
217199Sgblack@eecs.umich.edu            section_name = system_name + '.physmem.store0'
227199Sgblack@eecs.umich.edu            cpt.add_section(section_name)
237199Sgblack@eecs.umich.edu            cpt.set(section_name, 'store_id', '0')
247199Sgblack@eecs.umich.edu            cpt.set(section_name, 'range_size', mem_size)
257199Sgblack@eecs.umich.edu            cpt.set(section_name, 'filename', mem_filename)
267199Sgblack@eecs.umich.edu        elif re.search('.*sys.*\.\w*mem$', sec):
277199Sgblack@eecs.umich.edu            # Due to the lack of information about a start address,
287199Sgblack@eecs.umich.edu            # this migration only works if there is a single memory in
297199Sgblack@eecs.umich.edu            # the system, thus starting at 0
307199Sgblack@eecs.umich.edu            raise ValueError("more than one memory detected (" + sec + ")")
317199Sgblack@eecs.umich.edu
327199Sgblack@eecs.umich.edulegacy_version = 2
337199Sgblack@eecs.umich.edu