gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: stdlib: Add is_switchable() abstract method to AbstractProcessor

HN
Hoa Nguyen (Gerrit)
Fri, Apr 14, 2023 10:59 PM

Hoa Nguyen has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/69837?usp=email )

Change subject: stdlib: Add is_switchable() abstract method to
AbstractProcessor
......................................................................

stdlib: Add is_switchable() abstract method to AbstractProcessor

Allows other components to know where the processor is a switchable one.

Change-Id: I2174f2493dc1514a3370b99e2fbb8711ad5a9edd
Signed-off-by: Hoa Nguyen hoanguyen@ucdavis.edu

M src/python/gem5/components/processors/abstract_processor.py
M src/python/gem5/components/processors/base_cpu_processor.py
M src/python/gem5/components/processors/switchable_processor.py
3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/python/gem5/components/processors/abstract_processor.py
b/src/python/gem5/components/processors/abstract_processor.py
index a0f8b5c..f62f454 100644
--- a/src/python/gem5/components/processors/abstract_processor.py
+++ b/src/python/gem5/components/processors/abstract_processor.py
@@ -72,6 +72,10 @@
return self._isa

  @abstractmethod
  • def is_switchable(self) -> bool:
  •    raise NotImplementedError
    
  • @abstractmethod
    def incorporate_processor(self, board: AbstractBoard) -> None:
    raise NotImplementedError

diff --git a/src/python/gem5/components/processors/base_cpu_processor.py
b/src/python/gem5/components/processors/base_cpu_processor.py
index 9a75615..8b169b7 100644
--- a/src/python/gem5/components/processors/base_cpu_processor.py
+++ b/src/python/gem5/components/processors/base_cpu_processor.py
@@ -70,6 +70,10 @@
self.kvm_vm = KvmVM()

  @overrides(AbstractProcessor)
  • def is_switchable(self) -> bool:

  •    return False
    
  • @overrides(AbstractProcessor)
    def incorporate_processor(self, board: AbstractBoard) -> None:

     if any(core.is_kvm_core() for core in self.get_cores()):
    

diff --git a/src/python/gem5/components/processors/switchable_processor.py
b/src/python/gem5/components/processors/switchable_processor.py
index 20754fb..036e391 100644
--- a/src/python/gem5/components/processors/switchable_processor.py
+++ b/src/python/gem5/components/processors/switchable_processor.py
@@ -84,6 +84,10 @@
self.kvm_vm = KvmVM()

  @overrides(AbstractProcessor)
  • def is_switchable(self):

  •    return True
    
  • @overrides(AbstractProcessor)
    def incorporate_processor(self, board: AbstractBoard) -> None:

     # This is a bit of a hack. The `m5.switchCpus` function, used in  
    

the

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/69837?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2174f2493dc1514a3370b99e2fbb8711ad5a9edd
Gerrit-Change-Number: 69837
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen hoanguyen@ucdavis.edu
Gerrit-MessageType: newchange

Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/69837?usp=email ) Change subject: stdlib: Add is_switchable() abstract method to AbstractProcessor ...................................................................... stdlib: Add is_switchable() abstract method to AbstractProcessor Allows other components to know where the processor is a switchable one. Change-Id: I2174f2493dc1514a3370b99e2fbb8711ad5a9edd Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> --- M src/python/gem5/components/processors/abstract_processor.py M src/python/gem5/components/processors/base_cpu_processor.py M src/python/gem5/components/processors/switchable_processor.py 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/python/gem5/components/processors/abstract_processor.py b/src/python/gem5/components/processors/abstract_processor.py index a0f8b5c..f62f454 100644 --- a/src/python/gem5/components/processors/abstract_processor.py +++ b/src/python/gem5/components/processors/abstract_processor.py @@ -72,6 +72,10 @@ return self._isa @abstractmethod + def is_switchable(self) -> bool: + raise NotImplementedError + + @abstractmethod def incorporate_processor(self, board: AbstractBoard) -> None: raise NotImplementedError diff --git a/src/python/gem5/components/processors/base_cpu_processor.py b/src/python/gem5/components/processors/base_cpu_processor.py index 9a75615..8b169b7 100644 --- a/src/python/gem5/components/processors/base_cpu_processor.py +++ b/src/python/gem5/components/processors/base_cpu_processor.py @@ -70,6 +70,10 @@ self.kvm_vm = KvmVM() @overrides(AbstractProcessor) + def is_switchable(self) -> bool: + return False + + @overrides(AbstractProcessor) def incorporate_processor(self, board: AbstractBoard) -> None: if any(core.is_kvm_core() for core in self.get_cores()): diff --git a/src/python/gem5/components/processors/switchable_processor.py b/src/python/gem5/components/processors/switchable_processor.py index 20754fb..036e391 100644 --- a/src/python/gem5/components/processors/switchable_processor.py +++ b/src/python/gem5/components/processors/switchable_processor.py @@ -84,6 +84,10 @@ self.kvm_vm = KvmVM() @overrides(AbstractProcessor) + def is_switchable(self): + return True + + @overrides(AbstractProcessor) def incorporate_processor(self, board: AbstractBoard) -> None: # This is a bit of a hack. The `m5.switchCpus` function, used in the -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69837?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I2174f2493dc1514a3370b99e2fbb8711ad5a9edd Gerrit-Change-Number: 69837 Gerrit-PatchSet: 1 Gerrit-Owner: Hoa Nguyen <hoanguyen@ucdavis.edu> Gerrit-MessageType: newchange