bag3_testbenches.measurement.search

Module Contents

Classes

AcceptMode

Support for flags

IntervalSearchMM

A Measurement manager that performs binary search for you.

Functions

_get(→ Any)

class bag3_testbenches.measurement.search.AcceptMode[source]

Bases: enum.Flag

Support for flags

POSITIVE[source]
NEGATIVE[source]
BOTH[source]
class bag3_testbenches.measurement.search.IntervalSearchMM(*args: Any, **kwargs: Any)[source]

Bases: bag.simulation.measure.MeasurementManagerFSM, abc.ABC

A Measurement manager that performs binary search for you.

Assumes that no parameters/corners are swept.

property bounds: Dict[str, Tuple[float, float]][source]
abstract process_init(cur_info: bag.simulation.measure.MeasInfo, sim_results: bag.simulation.cache.SimResults) Tuple[Dict[str, Any], bool][source]

Initialize this MeasurementManager.

Returns:

  • tbm (TestbenchManager) – the TestbenchManager object.

  • tb_params (Mapping[str, Any]) – the testbench schematic parameters dictionary.

  • intv_params (Mapping[str, Mapping[str, Any]]) – A dictionary from search parameter name to its configuration dictionary. The values have the following entries:

    lowfloat

    lower bound.

    highOptional[float]

    upper bound. If None, perform a unbounded binary search.

    stepfloat

    initial step size for unbounded binary search.

    tolfloat

    tolerance of the binary search. Terminate the search when it is below this value.

    max_errfloat

    Used only in unbounded binary search. If unbounded binary search exceeds this value, raise an error.

    overhead_factorfloat

    ratio of simulation startup time to time it takes to simulate one sweep point.

  • intv_defaults (Mapping[str, Any]) – If any interval configuration are not specified, the value is taken from this dictionary.

  • has_init (bool) – True to run an initialization step.

  • use_dut (bool) – True to instantiate DUT.

abstract process_output_helper(cur_info: bag.simulation.measure.MeasInfo, sim_results: bag.simulation.cache.SimResults, remaining: Set[str]) Mapping[str, Tuple[Tuple[float, float], Dict[str, Any], bool]][source]
get_init_result(adj_name: str) Dict[str, Any][source]
get_bound(adj_name: str) Tuple[float, float][source]
initialize(sim_db: bag.simulation.cache.SimulationDB, dut: bag.simulation.cache.DesignInstance) Tuple[bool, bag.simulation.measure.MeasInfo][source]

Initialize this MeasurementManager to get ready for measurement.

Parameters:
Returns:

  • done (bool) – If True, then do not run measurement.

  • info (MeasInfo) – the initial MeasInfo object.

get_sim_info(sim_db: bag.simulation.cache.SimulationDB, dut: bag.simulation.cache.DesignInstance, cur_info: bag.simulation.measure.MeasInfo) Tuple[Union[Tuple[bag.simulation.core.TestbenchManager, Mapping[str, Any]], bag.simulation.measure.MeasurementManager], bool][source]

Get the testbench manager needed for the current measurement state.

Override to customize your testbench manager.

Parameters:
  • sim_db (SimulationDB) – the simulation database object.

  • dut (DesignInstance) – the design instance.

  • cur_info (MeasInfo) – the MeasInfo object representing the current measurement state.

  • harnesses (Optional[Sequence[DesignInstance]]) – the list of harness instances

Returns:

  • sim_object (Union[Tuple[TestbenchManager, Mapping[str, Any]], MeasurementManager]) – either a TestbenchManager/tb_params tuple, or a measurement manager instance.

  • use_dut (bool) – True to run simulation with DesignInstance.

process_output(cur_info: bag.simulation.measure.MeasInfo, sim_results: Union[bag.simulation.cache.SimResults, bag.simulation.cache.MeasureResult]) Tuple[bool, bag.simulation.measure.MeasInfo][source]

Process simulation output data.

Parameters:
  • cur_info (MeasInfo) – the MeasInfo object representing the current measurement state.

  • sim_results (Union[SimResults, MeasureResult]) – the simulation results object.

Returns:

  • done (bool) – True if this measurement is finished.

  • next_info (MeasInfo) – the updated measurement state.

get_adj_interval(adj_name: str, adj_sign: bool, adj_values: numpy.ndarray, diff: numpy.ndarray, accept_mode: AcceptMode = AcceptMode.POSITIVE) Tuple[int, bool, float, float][source]
log_result(state: str, new_result: Mapping[str, Any]) None[source]
bag3_testbenches.measurement.search._get(key: str, table1: Mapping[str, Any], table2: Mapping[str, Any], *args: Any) Any[source]