stdlib: Add _post_instantiate function
This function will be called on the board after m5.instantiate is called. This is useful, for instance, to start traffic generators. Currently all implementations simply `pass`. Change-Id: Ie2ab3fdddca5f3978d98191e5c08504561587fbb Signed-off-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64016 Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Jason Lowe-Power
parent
55f80ae0a1
commit
d2a6d2f7ee
@@ -338,3 +338,10 @@ class AbstractBoard:
|
||||
|
||||
# Incorporate the processor into the motherboard.
|
||||
self.get_processor().incorporate_processor(self)
|
||||
|
||||
def _post_instantiate(self):
|
||||
"""Called to set up anything needed after m5.instantiate"""
|
||||
self.get_processor()._post_instantiate()
|
||||
if self.get_cache_hierarchy():
|
||||
self.get_cache_hierarchy()._post_instantiate()
|
||||
self.get_memory()._post_instantiate()
|
||||
|
||||
@@ -70,3 +70,7 @@ class AbstractCacheHierarchy(SubSystem):
|
||||
:returns: True if the cache hierarchy is ruby. Otherwise False.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def _post_instantiate(self):
|
||||
"""Called to set up anything needed after m5.instantiate"""
|
||||
pass
|
||||
|
||||
@@ -71,3 +71,7 @@ class AbstractMemorySystem(SubSystem):
|
||||
will be raised.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def _post_instantiate(self) -> None:
|
||||
"""Called to set up anything needed after m5.instantiate"""
|
||||
pass
|
||||
|
||||
@@ -74,3 +74,7 @@ class AbstractProcessor(SubSystem):
|
||||
@abstractmethod
|
||||
def incorporate_processor(self, board: AbstractBoard) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
def _post_instantiate(self) -> None:
|
||||
"""Called to set up anything needed after m5.instantiate"""
|
||||
pass
|
||||
|
||||
@@ -405,6 +405,10 @@ class Simulator:
|
||||
m5.instantiate(self._checkpoint_path)
|
||||
self._instantiated = True
|
||||
|
||||
# Let the board know that instantiate has been called so it can do
|
||||
# any final things.
|
||||
self._board._post_instantiate()
|
||||
|
||||
def run(self, max_ticks: int = m5.MaxTick) -> None:
|
||||
"""
|
||||
This function will start or continue the simulator run and handle exit
|
||||
|
||||
Reference in New Issue
Block a user