Skip to content

Commit

Permalink
remane to short_str
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Oct 21, 2024
1 parent 65df1f2 commit 9e2ecbe
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pacman/model/resources/abstract_sdram.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def report(self, timesteps: Optional[int], indent: str = "",

@property
@abstractmethod
def _str(self) -> str:
def short_str(self) -> str:
"""
A short string representation of this SDRAM.
Expand All @@ -92,4 +92,4 @@ def _str(self) -> str:
raise NotImplementedError

def __str__(self):
return f"SDRAM:{self._str}"
return f"SDRAM:{self.short_str}"
4 changes: 2 additions & 2 deletions pacman/model/resources/constant_sdram.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ def report(self, timesteps: Optional[int], indent: str = "",
print(indent, preamble, f"Constant {self._sdram} bytes", file=target)

@property
@overrides(AbstractSDRAM._str)
def _str(self):
@overrides(AbstractSDRAM.short_str)
def short_str(self):
return f"fixed: {self._sdram}"
8 changes: 4 additions & 4 deletions pacman/model/resources/multi_region_sdram.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class MultiRegionSDRAM(AbstractSDRAM):
__slots__ = (
# The regions of SDRAM, each of which is an AbstractSDRAM
"__regions",
# The todal cost of all the regions
# The total cost of all the regions
"__total")

def __init__(self) -> None:
Expand Down Expand Up @@ -177,6 +177,6 @@ def per_timestep(self) -> float:
return self.__total.per_timestep

@property
@overrides(AbstractSDRAM._str)
def _str(self):
return f"Multi:{self.__total._str}"
@overrides(AbstractSDRAM.short_str)
def short_str(self):
return f"Multi:{self.__total.short_str}"
10 changes: 5 additions & 5 deletions pacman/model/resources/shared_sdram.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ def report(self, timesteps: Optional[int], indent: str = "",
sdram.report(timesteps, indent+" ", key+":", target)

@property
@overrides(AbstractSDRAM._str)
def _str(self):
@overrides(AbstractSDRAM.short_str)
def short_str(self):
if self._per_core.fixed > 0 or self._per_core.per_timestep > 0:
per_core = f"per-core: {self._per_core._str} "
per_core = f"per-core: {self._per_core.short_str} "
else:
per_core = ""
shared: Optional[str] = None
for key, sdram in self._shared.items():
if shared is None:
shared = f"shared:{key}: {sdram._str}"
shared = f"shared:{key}: {sdram.short_str}"
else:
shared = f" {key}: {sdram._str}"
shared = f" {key}: {sdram.short_str}"
return per_core + shared
4 changes: 2 additions & 2 deletions pacman/model/resources/variable_sdram.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def report(self, timesteps: Optional[int], indent: str = "",
f"for a total of {self.get_total_sdram(timesteps)}", file=target)

@property
@overrides(AbstractSDRAM._str)
def _str(self):
@overrides(AbstractSDRAM.short_str)
def short_str(self):
return (f"fixed:{self._fixed_sdram} "
f"per_timestep:{self._per_timestep_sdram}")

0 comments on commit 9e2ecbe

Please sign in to comment.