avl._core.factory module
- class avl._core.factory.Factory[source]
- static print_factory() None[source]
- Print the current factory topology including:
Type overrides
Instance overrides
Config variables
- static specificity(pattern: str) tuple[float, int][source]
Calculate specificity score for a pattern (higher = more specific) This function evaluates the pattern based on the number of literal characters, wildcards, and character classes. The more literal characters, the more specific the pattern. Wildcards reduce specificity, while character classes add a bit of specificity.
- Parameters:
pattern (str) – The pattern to evaluate.
- Returns:
Specificity score.
- Return type:
tuple[float, int]
- static set_override_by_type(original: Any, override: Any) None[source]
Set an override for a type.
- Parameters:
original (type) – The original type to override.
override (type) – The override type.
- static set_override_by_instance(path: str, override: Any) None[source]
Set an override by instance path.
- Parameters:
path (str) – The instance path to override.
override (type) – The override type.
- static get_by_type(original: type) type[source]
Get the override for a type if it exists, otherwise return the original type.
- Parameters:
original (type) – The original type.
- Returns:
The override type or the original type.
- Return type:
type
- static get_by_instance(original: type, path: str) type[source]
Get the override by instance path if it exists, otherwise return the original type.
- Parameters:
original (type) – The original type.
path (str) – The instance path to look up.
- Returns:
The override type or the original type.
- Return type:
type
- static get_factory_override(original: type, path: str) type[source]
Get the override for a type, name, and instance path.
- Parameters:
original (type) – The original type.
name (str) – The name to look up.
path (str) – The instance path to look up.
- Returns:
The override type or the original type.
- Return type:
type
- static set_variable(path: str, value: Any, allow_override=False) None[source]
Set a variable. This is equivalent to setting a value in the UVM config_db.
- Parameters:
path (str) – The path to the variable.
value (Any) – The value to set for the variable.
allow_override (bool) – Allow existing variable to be overridden
- static get_variable(path: str, default: Any = <object object>) Any[source]
Get the value of a variable by its path if it exists, otherwise return the default value.
- Parameters:
default (Any) – The default value to return if no match is found.
path (str) – The path to the variable.
- Raises:
KeyError – when there is no match and no default
- Returns:
The value of the variable or the default value.
- Return type:
Any