Jason Lowe-Power has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/64016?usp=email )
Change subject: stdlib: Add _post_instantiate function
......................................................................
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 <ja...@lowepower.com>
---
M src/python/gem5/components/boards/abstract_board.py
M src/python/gem5/components/cachehierarchies/abstract_cache_hierarchy.py
M src/python/gem5/components/memory/abstract_memory_system.py
M src/python/gem5/components/processors/abstract_processor.py
M src/python/gem5/simulate/simulator.py
5 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/src/python/gem5/components/boards/abstract_board.py
b/src/python/gem5/components/boards/abstract_board.py
index 1ac31cb..8e3c3a4 100644
--- a/src/python/gem5/components/boards/abstract_board.py
+++ b/src/python/gem5/components/boards/abstract_board.py
@@ -338,3 +338,10 @@
# 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()
diff --git
a/src/python/gem5/components/cachehierarchies/abstract_cache_hierarchy.py
b/src/python/gem5/components/cachehierarchies/abstract_cache_hierarchy.py
index 5f6096e..8d59a38 100644
---
a/src/python/gem5/components/cachehierarchies/abstract_cache_hierarchy.py
+++
b/src/python/gem5/components/cachehierarchies/abstract_cache_hierarchy.py
@@ -70,3 +70,7 @@
: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
diff --git a/src/python/gem5/components/memory/abstract_memory_system.py
b/src/python/gem5/components/memory/abstract_memory_system.py
index 27bc152..cfbf6ac 100644
--- a/src/python/gem5/components/memory/abstract_memory_system.py
+++ b/src/python/gem5/components/memory/abstract_memory_system.py
@@ -71,3 +71,7 @@
will be raised.
"""
raise NotImplementedError
+
+ def _post_instantiate(self) -> None:
+ """Called to set up anything needed after m5.instantiate"""
+ pass
diff --git a/src/python/gem5/components/processors/abstract_processor.py
b/src/python/gem5/components/processors/abstract_processor.py
index 72fa5db..a0f8b5c 100644
--- a/src/python/gem5/components/processors/abstract_processor.py
+++ b/src/python/gem5/components/processors/abstract_processor.py
@@ -74,3 +74,7 @@
@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
diff --git a/src/python/gem5/simulate/simulator.py
b/src/python/gem5/simulate/simulator.py
index efa7c42..ad16220 100644
--- a/src/python/gem5/simulate/simulator.py
+++ b/src/python/gem5/simulate/simulator.py
@@ -381,6 +381,10 @@
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
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/64016?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: Ie2ab3fdddca5f3978d98191e5c08504561587fbb
Gerrit-Change-Number: 64016
Gerrit-PatchSet: 1
Gerrit-Owner: Jason Lowe-Power <power...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org