# transform.mismatch_generatorο

transform.mismatch_generator(prototype: Dict[str, bool], percent_deviation: float = 0.3, sigma_rule: float = 3.0) Callable[[Tuple[Dict[str, Array], Array]], Dict[str, Array]][source]ο

mismatch_generator returns a function which simulates the analog device mismatch effect. The function deviates the parameter values provided in statistical means. The calculation parameters should be based on statistical knowledge obtained from emprical observations. That is, if one observes up-to-30% mismatch between the expected current and the measured current actually flowing through the transistors: percent should be 0.30. Therefore, letβs say

mismatched current / actual current < %30 for 95 percent of the cases

Using gaussian distribution and statistics, we could obtain this. In statistics, the 68-95-99.7 rule, also known as the empirical rule, is a shorthand used to remember the percentage of values that lie within an interval estimate in a normal distribution: 68%, 95%, and 99.7% of the values lie within one, two, and three standard deviations of the mean, respectively.

$\begin{split}Pr(\mu -1\sigma \leq X\leq \mu +1\sigma ) \approx 68.27\\ Pr(\mu -2\sigma \leq X\leq \mu +2\sigma ) \approx 95.45\\ Pr(\mu -3\sigma \leq X\leq \mu +3\sigma ) \approx 99.73\\\end{split}$

So, to obtain βmismatched current / actual current < %30 for 95 percent of the casesβ, the sigma should be half of the maximum deviation desired. That is the 30% percent of the theoretical current value.

Parameters:
Returns:

a function which takes a pytree and computes the mismatch amount accordingly

Return type:

Callable[ [Tuple[Dict[str, jax.Array], jax.Array]], Dict[str, jax.Array] ]