stdlib: Fix SimpleCore no ISA set use-case
The error was highlighted via this Nightly test failure: https://jenkins.gem5.org/job/nightly/324 The bug was triggered when creating a SimpleCore without passing an ISA. This is allowed but the SimpleCore should have ran `get_runtime_isa` to determine which ISA is to be used in the simulation. This was missing. This patch fixes this. Change-Id: I4b2718233819783f779462d24b694306e9e76e30 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62571 Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
committed by
Jiajie Chen
parent
38131c8a61
commit
d6e422c4dd
@@ -30,6 +30,7 @@ from .base_cpu_core import BaseCPUCore
|
||||
from .cpu_types import CPUTypes
|
||||
from ...isas import ISA
|
||||
from ...utils.requires import requires
|
||||
from ...runtime import get_runtime_isa
|
||||
import importlib
|
||||
import platform
|
||||
|
||||
@@ -43,6 +44,15 @@ class SimpleCore(BaseCPUCore):
|
||||
def __init__(
|
||||
self, cpu_type: CPUTypes, core_id: int, isa: Optional[ISA] = None
|
||||
):
|
||||
|
||||
# If the ISA is not specified, we infer it via the `get_runtime_isa`
|
||||
# function.
|
||||
if isa:
|
||||
requires(isa_required=isa)
|
||||
isa = isa
|
||||
else:
|
||||
isa = get_runtime_isa()
|
||||
|
||||
super().__init__(
|
||||
core=SimpleCore.cpu_simobject_factory(
|
||||
isa=isa, cpu_type=cpu_type, core_id=core_id
|
||||
@@ -66,6 +76,8 @@ class SimpleCore(BaseCPUCore):
|
||||
:param isa: The target ISA.
|
||||
:param core_id: The id of the core to be returned.
|
||||
"""
|
||||
|
||||
assert isa is not None
|
||||
requires(isa_required=isa)
|
||||
|
||||
_isa_string_map = {
|
||||
|
||||
Reference in New Issue
Block a user