approximation.approx_method_ps module

class approximation.approx_method_ps.ApproximatorPS(settings=None)

Bases: circa.stages.approximation.approx_method.ApproxMethod

static methodId()

Returns this ApproxMethod’s unique ID string.

approximateVariant(variant, gen_info)

Generates approximated variant and stores it in a file.

Parameters:
  • variant (Variant) – The Variant instance to be approximated.
  • gen_info (GeneralInformation) – The framework’s GeneralInformation instance.
applyRules(variant)

Ensures that error bounds of metrics BitFlip and WorstCase will not create bit masks of different sizes by increasing the lower value until it matches the larger. This way, each increment of any of the two error bounds will increase the bit mask by one and therefore no bit mask will be applied twice for approximation. Variants which do not have both of these error metrics will not be changed.

If the options ‘PSPowerTwoSteps’ and PSPreciseMask are set to ‘True’, only WC error will be adjusted to fill the resulting bit mask with ones. Note that the resulting increase of the WC value may not be a multiple of the step attribute of the WC error metric.

_generateMask(cand, variant)

Generates a bit-mask for precision scaling and returns it as string.

Parameters:
  • cand (Candidate) – The Candidate for which to create the bit mask.
  • variant (Variant) – The Variant specifying the quality constraints.
Returns:

The bit mask as a string (LSB…MSB) containing only 1s and 0s and of length equal to the Candidate’s output size.

Return type:

str