stdlib: Add _pre_instantiate funcs for caches and memory
Note: At present this is not used but these functions can be filled or overriden in subclasses as required.
This commit is contained in:
@@ -420,8 +420,10 @@ class AbstractBoard:
|
||||
)
|
||||
|
||||
# 3. Call any of the components' `_pre_instantiate` functions.
|
||||
# Right now, only the processor requires this.
|
||||
self.get_processor()._pre_instantiate(root)
|
||||
self.get_memory()._pre_instantiate(root)
|
||||
if self.get_cache_hierarchy():
|
||||
self.get_cache_hierarchy()._pre_instantiate(root)
|
||||
|
||||
# 4. Return the root object.
|
||||
return root
|
||||
|
||||
@@ -42,7 +42,10 @@ from abc import (
|
||||
)
|
||||
from typing import Callable
|
||||
|
||||
from m5.objects import SubSystem
|
||||
from m5.objects import (
|
||||
Root,
|
||||
SubSystem,
|
||||
)
|
||||
from m5.util.fdthelper import *
|
||||
|
||||
from ..boards.abstract_board import AbstractBoard
|
||||
@@ -139,6 +142,18 @@ class AbstractCacheHierarchy(SubSystem):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def _pre_instantiate(self, root: Root) -> None:
|
||||
"""Called in the `AbstractBoard`'s `_pre_instantiate` method. This is
|
||||
called after `connect_things`, after the creation of the root object
|
||||
(which is passed in as an argument), but before `m5.instantiate`).
|
||||
|
||||
Subclasses should override this method to set up any connections.
|
||||
|
||||
At present there is no general task that must be specified here and is
|
||||
default or applicable to all cache hierarchies.
|
||||
"""
|
||||
pass
|
||||
|
||||
def _post_instantiate(self):
|
||||
"""Called to set up anything needed after ``m5.instantiate``."""
|
||||
pass
|
||||
|
||||
@@ -38,6 +38,7 @@ from m5.objects import (
|
||||
AddrRange,
|
||||
MemCtrl,
|
||||
Port,
|
||||
Root,
|
||||
SubSystem,
|
||||
)
|
||||
|
||||
@@ -50,6 +51,18 @@ class AbstractMemorySystem(SubSystem):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
def _pre_instantiate(self, root: Root) -> None:
|
||||
"""Called in the `AbstractBoard`'s `_pre_instantiate` method. This is
|
||||
called after `connect_things`, after the creation of the root object
|
||||
(which is passed in as an argument), but before `m5.instantiate`).
|
||||
|
||||
Subclasses should override this method to set up any connections.
|
||||
|
||||
At present there is no general task that must be specified here and is
|
||||
default or applicable to all memory systems.
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def incorporate_memory(self, board: AbstractBoard) -> None:
|
||||
"""This function completes all of the necessary steps to add this
|
||||
|
||||
Reference in New Issue
Block a user