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.
|
||||
|
||||
import m5.objects
|
||||
import m5.internal.params
|
||||
import inspect
|
||||
import sys
|
||||
from textwrap import TextWrapper
|
||||
|
||||
@@ -1716,6 +1716,9 @@ class SimObject(object, metaclass=MetaSimObject):
|
||||
if 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 = cc_params_struct()
|
||||
cc_params.name = str(self)
|
||||
|
||||
@@ -24,14 +24,6 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from m5.internal import params
|
||||
from m5.SimObject import *
|
||||
|
||||
try:
|
||||
modules = __spec__.loader_state
|
||||
except NameError:
|
||||
modules = { }
|
||||
|
||||
for module in modules:
|
||||
for module in __spec__.loader_state:
|
||||
if module.startswith('m5.objects.'):
|
||||
exec("from %s import *" % module)
|
||||
|
||||
@@ -50,6 +50,7 @@ from . import stats
|
||||
from . import SimObject
|
||||
from . import ticks
|
||||
from . import objects
|
||||
from . import params
|
||||
from m5.util.dot_writer import do_dot, do_dvfs_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
|
||||
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()
|
||||
|
||||
# The final hook to generate .ini files. Called from the user script
|
||||
@@ -292,8 +287,9 @@ def switchCpus(system, cpuList, verbose=True):
|
||||
raise RuntimeError(
|
||||
"Old CPU (%s) does not support CPU handover." % (old_cpu,))
|
||||
|
||||
MemoryMode = params.allEnums["MemoryMode"]
|
||||
try:
|
||||
memory_mode = _memory_modes[memory_mode_name]
|
||||
memory_mode = MemoryMode(memory_mode_name).getValue()
|
||||
except KeyError:
|
||||
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
|
||||
# that disables caches. This typically happens when switching to a
|
||||
# hardware virtualized CPU.
|
||||
if memory_mode == objects.params.atomic_noncaching:
|
||||
if memory_mode == MemoryMode("atomic_noncaching").getValue():
|
||||
memWriteback(system)
|
||||
memInvalidate(system)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user