stdlib: Fix SimpleSwitchableProcessor to allow Minor type
Without setting the correct memory mode the SimpleSwitchableProcessor, the Minor CPU could not be used as a valid core. This patch corrects this issue by setting the memory mode to TIMING for Minor CPU cores. Due to the increasingly complex if-else to determine the memory mode, a function has been added to CPUTypes to determine what MemMode is required for each CPUType. Change-Id: I9384b4a9c0673af34cca04917d763ca45d0ea434 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/61535 Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
committed by
Bobby Bruce
parent
117f1dd38c
commit
b2fee855d8
@@ -24,6 +24,8 @@
|
||||
# (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 ..boards.mem_mode import MemMode
|
||||
|
||||
from enum import Enum
|
||||
from typing import Set
|
||||
import os
|
||||
@@ -68,3 +70,21 @@ def get_cpu_type_from_str(input: str) -> CPUTypes:
|
||||
f"CPU type '{input}' does not correspond to a known CPU type. "
|
||||
f"Known CPU Types:{valid_cpu_types_list_str}"
|
||||
)
|
||||
|
||||
|
||||
def get_mem_mode(input: CPUTypes) -> MemMode:
|
||||
"""
|
||||
Returns the correct memory mode to be set for a given CPUType.
|
||||
|
||||
:param input: The CPUType to check.
|
||||
"""
|
||||
|
||||
cpu_mem_mode_map = {
|
||||
CPUTypes.TIMING: MemMode.TIMING,
|
||||
CPUTypes.O3: MemMode.TIMING,
|
||||
CPUTypes.MINOR: MemMode.TIMING,
|
||||
CPUTypes.KVM: MemMode.ATOMIC_NONCACHING,
|
||||
CPUTypes.ATOMIC: MemMode.ATOMIC,
|
||||
}
|
||||
|
||||
return cpu_mem_mode_map[input]
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
from ..boards.mem_mode import MemMode
|
||||
from ..boards.abstract_board import AbstractBoard
|
||||
from ..processors.simple_core import SimpleCore
|
||||
from ..processors.cpu_types import CPUTypes
|
||||
from ..processors.cpu_types import CPUTypes, get_mem_mode
|
||||
from .switchable_processor import SwitchableProcessor
|
||||
from ...isas import ISA
|
||||
|
||||
@@ -72,14 +72,7 @@ class SimpleSwitchableProcessor(SwitchableProcessor):
|
||||
self._switch_key = "switch"
|
||||
self._current_is_start = True
|
||||
|
||||
if starting_core_type in (CPUTypes.TIMING, CPUTypes.O3):
|
||||
self._mem_mode = MemMode.TIMING
|
||||
elif starting_core_type == CPUTypes.KVM:
|
||||
self._mem_mode = MemMode.ATOMIC_NONCACHING
|
||||
elif starting_core_type == CPUTypes.ATOMIC:
|
||||
self._mem_mode = MemMode.ATOMIC
|
||||
else:
|
||||
raise NotImplementedError
|
||||
self._mem_mode = get_mem_mode(starting_core_type)
|
||||
|
||||
switchable_cores = {
|
||||
self._start_key: [
|
||||
|
||||
Reference in New Issue
Block a user