bag.data.digital
This module defines functions useful for digital verification/postprocessing.
Module Contents
Functions
|
Returns a De Bruijn sequence with subsequence of length n. |
|
Convert a list of digital bits to PWL waveform. |
|
Returns the first index that the given numpy array crosses the given threshold. |
|
Calculate flop timing parameters given the associated waveforms. |
- bag.data.digital.de_bruijn(n: int, symbols: Optional[List[float]] = None) List[float] [source]
Returns a De Bruijn sequence with subsequence of length n.
a De Bruijn sequence with subsequence of length n is a sequence such that all possible subsequences of length n appear exactly once somewhere in the sequence. This method is useful for simulating the worst case eye diagram given finite impulse response.
- bag.data.digital.dig_to_pwl(values: List[float], tper: float, trf: float, td: float = 0) Tuple[List[float], List[float]] [source]
Convert a list of digital bits to PWL waveform.
This function supports negative delay. However, time/value pairs for negative data are truncated.
- bag.data.digital.get_crossing_index(yvec: numpy.array, threshold: float, n: int = 0, rising: bool = True) int [source]
Returns the first index that the given numpy array crosses the given threshold.
- Parameters:
- Returns:
idx – the crossing edge index.
- Return type:
- bag.data.digital.get_flop_timing(tvec, d, q, clk, ttol, data_thres=0.5, clk_thres=0.5, tstart=0.0, clk_edge='rising', tag=None, invert=False)[source]
Calculate flop timing parameters given the associated waveforms.
This function performs the following steps:
find all valid clock edges. Compute period of the clock (clock waveform must be periodic).
For each valid clock edge:
Check if the input changes in the previous cycle. If so, compute tsetup. Otherwise, tsetup = tperiod.
Check if input changes in the current cycle. If so, compute thold. Otherwise, thold = tperiod.
Check that output transition at most once and that output = input. Otherwise, record an error.
record the output data polarity.
For each output data polarity, compute the minimum tsetup and thold and any errors. Return summary as a dictionary.
The output is a dictionary with keys ‘setup’, ‘hold’, ‘delay’, and ‘errors’. the setup/hold/delay entries contains 2-element tuples describing the worst setup/hold/delay time. The first element is the setup/hold/delay time, and the second element is the clock edge time at which it occurs. The errors field stores all clock edge times at which an error occurs.
- Parameters:
tvec (np.ndarray) – the time data.
d (np.ndarray) – the input data.
q (np.ndarray) – the output data.
clk (np.ndarray) – the clock data.
ttol (float) – time resolution.
data_thres (float) – the data threshold.
clk_thres (float) – the clock threshold.
tstart (float) – ignore data points before tstart.
clk_edge (str) – the clock edge type. Valid values are “rising”, “falling”, or “both”.
tag (obj) – an identifier tag to append to results.
invert (bool) – if True, the flop output is inverted from the data.
- Returns:
data – A dictionary describing the worst setup/hold/delay and errors, if any.
- Return type: