FloatingPointSqrt<FpType extends FloatingPoint> constructor

FloatingPointSqrt<FpType extends FloatingPoint>(
  1. FpType a, {
  2. Logic? clk,
  3. Logic? reset,
  4. Logic? enable,
  5. String name = 'floating_point_square_root',
  6. bool reserveName = false,
  7. bool reserveDefinitionName = false,
  8. String? definitionName,
})

Square root a floating point number a, returning result in sqrt.

  • clk, reset, enable are optional inputs to control a pipestage (only inserted if clk is provided)

Implementation

FloatingPointSqrt(FpType a,
    {Logic? clk,
    Logic? reset,
    Logic? enable,
    super.name = 'floating_point_square_root',
    super.reserveName,
    super.reserveDefinitionName,
    String? definitionName})
    : exponentWidth = a.exponent.width,
      mantissaWidth = a.mantissa.width,
      super(
          definitionName: definitionName ??
              'FloatingPointSquareRoot_E${a.exponent.width}'
                  'M${a.mantissa.width}') {
  this.clk = (clk != null) ? addInput('clk', clk) : null;
  this.reset = (reset != null) ? addInput('reset', reset) : null;
  this.enable = (enable != null) ? addInput('enable', enable) : null;
  this.a = (a.clone(name: 'a') as FpType)
    ..gets(addInput('a', a, width: a.width));

  addOutput('sqrt', width: exponentWidth + mantissaWidth + 1);
  addOutput('error');
}