FloatingPointSqrt<FpType extends FloatingPoint> constructor
Square root a floating point number a
, returning result in sqrt.
clk
,reset
,enable
are optional inputs to control a pipestage (only inserted ifclk
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');
}