avl._core.coverpoint module
- class avl._core.coverpoint.Coverpoint(*args: Any, **kwargs: Any)[source]
- __init__(name: str, parent: Covergroup, var: Any = None) None[source]
Initialize an instance of the class.
- Parameters:
name (str, optional) – The name of the instance, defaults to an empty string.
parent (object, optional) – The parent instance, defaults to None.
var (object, optional) – An optional variable, defaults to None.
- set_comment(comment: str) None[source]
Set the comment for the AVL coverpoint.
- Parameters:
comment (str) – The comment to be set.
- set_weight(weight: float) None[source]
Set the weight of the AVL cover point.
- Parameters:
weight (float) – The weight to be set.
- set_at_least(at_least: int) None[source]
Set the minimum threshold value.
- Parameters:
at_least (int) – The minimum value to be set.
- add_bin(name: str, *args: Any, **kwargs: Any) None[source]
Add a bin to the AVL coverpoint.
- Parameters:
name (str) – The name of the bin to add.
args – Additional arguments to pass to the Coverbin constructor.
illegal (bool, optional) – Flag indicating if the bin is illegal. Defaults to False.
stats (bool, optional) – Flag indicating if statistics should be collected for the bin. Defaults to False.
- Raises:
ValueError – If a bin with the given name already exists.
- remove_bin(name: str) None[source]
Remove a bin from the AVL coverpoint.
- Parameters:
name (str) – The name of the bin to remove.
- Raises:
KeyError – If the bin with the given name does not exist.
- get_hit() Coverbin | None[source]
Check if the variable matches any bin condition.
This method iterates over all bins stored in the _bins_ attribute and checks if the variable self.var matches any bin condition by calling the check method on each bin.
- Returns:
The bin that matches the variable condition, or None if no bin matches.
- Return type:
Coverbin or None
- sample() None[source]
Sample values from each bin in the _bins_ attribute.
This method iterates over all bins stored in the _bins_ attribute and calls the sample method on each bin, passing the result of self.var() as an argument.
- clear() None[source]
Clear the counts of all bins in the _bins_ attribute.
This method iterates over all bins stored in the _bins_ attribute and calls the clear method on each bin to reset their counts.
- get_bins() tuple[int, int][source]
Calculate the total number of bins and the number of covered bins.
This method iterates over all bins in the _bins_ dictionary and counts the total number of bins and the number of bins that have a count greater than or equal to at_least.
- Returns:
A tuple containing the total number of bins and the number of covered bins.
- Return type:
tuple(int, int)
- get_coverage() float[source]
Calculate and return the coverage percentage.
This method retrieves the total number of bins and the number of covered bins, then calculates the coverage percentage as (covered / total) * 100.
- Returns:
The coverage percentage. If the total number of bins is zero, returns 0.0 to avoid division by zero.
- Return type:
float
- report(full: bool = False) DataFrame[source]
Generate a report of the coverage data.
- Parameters:
full (bool, optional) – If True, generate a detailed report including all bins. If False, generate a summary report. Default is False.
- Returns:
A DataFrame containing the coverage data. The structure of the DataFrame depends on the value of the full parameter: - If full is True, the DataFrame contains columns: ‘covergroup’, ‘coverpoint’, ‘at_least’, ‘count’. - If full is False, the DataFrame contains columns: ‘covergroup’, ‘coverpoint’, ‘coverage’.
- Return type:
pandas.DataFrame