Skip to content

Commit 1754b78

Browse files
bits_per_action can be set to a number
1 parent bb17c5c commit 1754b78

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

hwcomponents/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __add__(self, other: "EnergyLatency") -> "EnergyLatency":
1919

2020
def action(
2121
func: Callable[..., Union[float, tuple[float, float]]] = None,
22-
bits_per_action: str = None,
22+
bits_per_action: str | Number = None,
2323
pipelined_subcomponents: bool = False,
2424
) -> Callable[..., EnergyLatency]:
2525
"""
@@ -78,6 +78,8 @@ def wrapper(self: "ComponentModel", *args, **kwargs):
7878
nominal_bits = getattr(self, bits_per_action)
7979
except:
8080
pass
81+
if isinstance(bits_per_action, Number):
82+
nominal_bits = bits_per_action
8183
if nominal_bits is None:
8284
raise ValueError(
8385
f"{self.__name__} has no attribute {bits_per_action}. "

0 commit comments

Comments
 (0)