configs,python: Clean some cruft out of m5.objects.
SimObject is already available as m5.SimObject, and it doesn't make a lot of sense to expose m5.internal.params, part of the internals of gem5's python interface, as a peer to all the SimObject types. Change-Id: I3030c1eb261877fd9648c9d3d73b7dbbd4c24345 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48364 Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import m5.objects
|
import m5.objects
|
||||||
|
import m5.internal.params
|
||||||
import inspect
|
import inspect
|
||||||
import sys
|
import sys
|
||||||
from textwrap import TextWrapper
|
from textwrap import TextWrapper
|
||||||
|
|||||||
@@ -1716,6 +1716,9 @@ class SimObject(object, metaclass=MetaSimObject):
|
|||||||
if self._ccParams:
|
if self._ccParams:
|
||||||
return self._ccParams
|
return self._ccParams
|
||||||
|
|
||||||
|
# Ensure that m5.internal.params is available.
|
||||||
|
import m5.internal.params
|
||||||
|
|
||||||
cc_params_struct = getattr(m5.internal.params, '%sParams' % self.type)
|
cc_params_struct = getattr(m5.internal.params, '%sParams' % self.type)
|
||||||
cc_params = cc_params_struct()
|
cc_params = cc_params_struct()
|
||||||
cc_params.name = str(self)
|
cc_params.name = str(self)
|
||||||
|
|||||||
@@ -24,14 +24,6 @@
|
|||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
from m5.internal import params
|
for module in __spec__.loader_state:
|
||||||
from m5.SimObject import *
|
|
||||||
|
|
||||||
try:
|
|
||||||
modules = __spec__.loader_state
|
|
||||||
except NameError:
|
|
||||||
modules = { }
|
|
||||||
|
|
||||||
for module in modules:
|
|
||||||
if module.startswith('m5.objects.'):
|
if module.startswith('m5.objects.'):
|
||||||
exec("from %s import *" % module)
|
exec("from %s import *" % module)
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ from . import stats
|
|||||||
from . import SimObject
|
from . import SimObject
|
||||||
from . import ticks
|
from . import ticks
|
||||||
from . import objects
|
from . import objects
|
||||||
|
from . import params
|
||||||
from m5.util.dot_writer import do_dot, do_dvfs_dot
|
from m5.util.dot_writer import do_dot, do_dvfs_dot
|
||||||
from m5.util.dot_writer_ruby import do_ruby_dot
|
from m5.util.dot_writer_ruby import do_ruby_dot
|
||||||
|
|
||||||
@@ -59,12 +60,6 @@ from .util import attrdict
|
|||||||
# define a MaxTick parameter, unsigned 64 bit
|
# define a MaxTick parameter, unsigned 64 bit
|
||||||
MaxTick = 2**64 - 1
|
MaxTick = 2**64 - 1
|
||||||
|
|
||||||
_memory_modes = {
|
|
||||||
"atomic" : objects.params.atomic,
|
|
||||||
"timing" : objects.params.timing,
|
|
||||||
"atomic_noncaching" : objects.params.atomic_noncaching,
|
|
||||||
}
|
|
||||||
|
|
||||||
_drain_manager = _m5.drain.DrainManager.instance()
|
_drain_manager = _m5.drain.DrainManager.instance()
|
||||||
|
|
||||||
# The final hook to generate .ini files. Called from the user script
|
# The final hook to generate .ini files. Called from the user script
|
||||||
@@ -292,8 +287,9 @@ def switchCpus(system, cpuList, verbose=True):
|
|||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Old CPU (%s) does not support CPU handover." % (old_cpu,))
|
"Old CPU (%s) does not support CPU handover." % (old_cpu,))
|
||||||
|
|
||||||
|
MemoryMode = params.allEnums["MemoryMode"]
|
||||||
try:
|
try:
|
||||||
memory_mode = _memory_modes[memory_mode_name]
|
memory_mode = MemoryMode(memory_mode_name).getValue()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise RuntimeError("Invalid memory mode (%s)" % memory_mode_name)
|
raise RuntimeError("Invalid memory mode (%s)" % memory_mode_name)
|
||||||
|
|
||||||
@@ -309,7 +305,7 @@ def switchCpus(system, cpuList, verbose=True):
|
|||||||
# Flush the memory system if we are switching to a memory mode
|
# Flush the memory system if we are switching to a memory mode
|
||||||
# that disables caches. This typically happens when switching to a
|
# that disables caches. This typically happens when switching to a
|
||||||
# hardware virtualized CPU.
|
# hardware virtualized CPU.
|
||||||
if memory_mode == objects.params.atomic_noncaching:
|
if memory_mode == MemoryMode("atomic_noncaching").getValue():
|
||||||
memWriteback(system)
|
memWriteback(system)
|
||||||
memInvalidate(system)
|
memInvalidate(system)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user