Operator list for FloPoCo version 4.1
Shifters, Leading Zero Counters, etc
- Shifter
- A classical barrel shifter. The output size is computed.
- Parameters:
-
wIn
(int
) - input size in bits
-
maxShift
(int
) - maximum shift distance in bits
-
dir
(bool
) - 0=left, 1=right
- LZOC
- A classical barrel shifter. The output size is computed.
- Parameters:
-
wIn
(int
) - input size in bits
- LZOCShifterSticky
- A combined leading zero/one counter and shifter, useful for floating-point normalization.
- Parameters:
-
wIn
(int
) - input size in bits
-
wOut
(int
) - output size in bits
-
wCount
(int
) - size in bits of the count output
-
computeSticky
(bool
) (optional, default value is false) - if false the shifted-out bits are discarded, if true they are ORed into a sticky bit which is output
-
countType
(int
) (optional, default value is -1) - 0 to count zeroes, 1 to count ones, -1 to have a dynamic OZb input that tells what to count
Basic integer operators (pipelined)
- IntAdder
- Integer adder. In modern VHDL, integer addition is expressed by a + and one usually needn't define an entity for it. However, this operator will be pipelined if the addition is too large to be performed at the target frequency.
- Parameters:
-
wIn
(int
) - input size in bits
-
arch
(int
) (optional, default value is -1) - -1 for automatic, 0 for classical, 1 for alternative, 2 for short latency
-
optObjective
(int
) (optional, default value is 2) - 0 to optimize for logic, 1 to optimize for register, 2 to optimize for slice/ALM count
-
SRL
(bool
) (optional, default value is true) - optimize for shift registers
- IntComparator
- An integer comparator.
- Parameters:
-
wIn
(int
) - input size in bits
-
criteria
(int
) - -2=lesser than, -1=lesser or equal, 0=equal, 1=greater or equal, 2=greater
-
constant
(bool
)
-
constValue
(int
) - the value to compare to
- IntDualSub
- Pipelined dual adder/subtractor
- Parameters:
-
wIn
(int
) - input size in bits
-
opType
(int
) - 1=compute X-Y and X+Y, 2=compute X-Y and Y-X
- IntMultiplier
- A pipelined integer multiplier.
- Parameters:
-
wX
(int
) - size of input X
-
wY
(int
) - size of input Y
-
wOut
(int
) (optional, default value is 0) - size of the output if you want a truncated multiplier. 0 for full multiplier
-
signedIO
(bool
) (optional, default value is false) - inputs and outputs can be signed or unsigned
-
superTile
(bool
) (optional, default value is false) - if true, attempts to use the DSP adders to chain sub-multipliers. This may entail lower logic consumption, but higher latency.
- IntSquarer
- A pipelined integer squarer.
- Parameters:
-
wIn
(int
) - size of input in bits
Basic floating-point Operators
- FPAdd
- A correctly rounded floating-point adder.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
sub
(bool
) (optional, default value is false) - implement a floating-point subtractor instead of an adder
-
dualPath
(bool
) (optional, default value is false) - use a dual-path algorithm, more expensive but shorter latency
- Single-path is lower hardware, longer latency than dual-path.
The difference between single-path and dual-path is well explained in textbooks such as Ercegovac and Lang's Digital Arithmetic, or Muller et al's Handbook of floating-point arithmetic.
- FPAddSub
- A fused floating-point adder and subtracter, computes both a+b and a-b.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
- FPAddDualPath
- Floating-point adder with dual-path architecture. Trades a larger circuit size for a smaller latency.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
- FPAdd3Input
- A 3-operand floating-point adder.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
- FPAddSinglePath
- A floating-point adder with a new, more compact single-path architecture.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
- FPAddSinglePathIEEE
- A floating-point adder with a new, more compact single-path architecture.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
- FPMult
- A floating-point multiplier. The actual FloPoCo component supports different input and output sizes, but this is not available from the command line.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - input's mantissa size in bits
-
wFout
(int
) (optional, default value is 0) - output's mantissa size in bits (if 0 or ommitted, will be equal to wFIn)
- FPSquare
- A floating-point squarer, using IntSquarer for the mantissa.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF_in
(int
) - input's mantissa size in bits
-
wF_out
(int
) - output's mantissa size in bits
- FPDiv
- A correctly rounded floating-point division.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
radix
(int
) (optional, default value is 0) - Can be 0, 4 or 8. Default 0 means: let FloPoCo choose between 4 and 8. In your context, the other choice may have a better area/speed trade-offs
- The algorithm used here is the division by digit recurrence (SRT). In radix 4, we use a maximally redundant digit set. In radix 8, we use split-digits in [-10,10], and a bit of prescaling.
- FPSqrt
- A correctly rounded floating-point square root function.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
Multipliers and dividers by constants
- FPConstMult
- Floating-point constant multiplier using the shift-and-add approach.
- Parameters:
-
wE_in
(int
) - input exponent width
-
wF_in
(int
) - input significand part width
-
wE_out
(int
) - output exponent width
-
wF_out
(int
) - output significand width
-
constant
(string
) - constant in sollya formalism (e.g. "cos(3*pi/2)" or "13176795b-22")
-
cst_width
(int
) (optional, default value is 0) - constant precision. If set to zero, the actual width will be computed in order to get a faithful result.
- An early version of the technique used is described in this article.
- FPConstMultRational
- Correctly rounded floating-point multiplier by a rational constant.
- Parameters:
-
wE_in
(int
) - input exponent width
-
wF_in
(int
) - input significand part width
-
wE_out
(int
) - output exponent width
-
wF_out
(int
) - output significand width
-
a
(int
) - numerator
-
b
(int
) - denominator
- The technique used is described in this article.
- FPRealKCM
- Table based real multiplier for floating points input.
- Parameters:
-
wE
(int
) - exponent width
-
wF
(int
) - significand width
-
constant
(string
) - constant given in arbitrary-precision decimal, or as a Sollya expression, e.g "log(2)"
- KCM is a table-based method well suited to LUT-based FPGAs. It is due to Ken Chapman who published it in 1994.
- IntConstDiv
- Integer divider by a small constant.
- Parameters:
-
wIn
(int
) - input size in bits
-
d
(int
) - small integer to divide by
-
arch
(int
) (optional, default value is 0) - architecture used -- 0 for linear-time, 1 for log-time
-
remainderOnly
(bool
) (optional, default value is false) - if true, the architecture doesn't output the quotient
-
alpha
(int
) (optional, default value is -1) - Algorithm uses radix 2^alpha. -1 choses a sensible default.
- This operator is described, for arch=0, in this article, and for arch=1, in this article.
- FPConstDiv
- Correctly rounded floating-point divider by a small constant.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
d
(int
) - small integer to divide by
-
dExp
(int
) (optional, default value is 0) - binary exponent of d (the operator will divide by d.2^dExp)
-
alpha
(int
) (optional, default value is -1) - Algorithm uses radix 2^alpha. -1 choses a sensible default.
- Correct rounding to the nearest (if you want other rounding modes contact us). This operator is described in this article.
- FixRealKCM
- Table based real multiplier. Output size is computed
- Parameters:
-
signedInput
(bool
) - 0=unsigned, 1=signed
-
msbIn
(int
) - weight associated to most significant bit (including sign bit)
-
lsbIn
(int
) - weight associated to least significant bit
-
lsbOut
(int
) - weight associated to output least significant bit
-
constant
(string
) - constant given in arbitrary-precision decimal, or as a Sollya expression, e.g "log(2)"
-
targetUlpError
(real
) (optional, default value is 1.0) - required precision on last bit. Should be strictly greater than 0.5 and lesser than 1
- This variant of Ken Chapman's Multiplier is briefly described in this article.
Special constants, such as 0 or powers of two, are handled efficiently.
- FixComplexKCM
- Table-based complex multiplier. Inputs are two's complement. Output size is computed
- Parameters:
-
msbIn
(int
) - weight associated to most significant bit (including sign bit)
-
lsbIn
(int
) - weight associated to least significant bit
-
lsbOut
(int
) - weight associated to output least significant bit
-
constantRe
(string
) - real part of the constant, given as a Sollya expression, e.g "log(2)"
-
constantIm
(string
) - imaginary part of the constant, given as a Sollya expression, e.g "log(2)"
Composite floating-point operators
- FPLargeAcc
- Accumulator of floating-point numbers into a large fixed-point accumulator. CURRENTLY BROKEN, contact us if you want to use it
- Parameters:
-
wEX
(int
) - the width of the exponent
-
wFX
(int
) - the width of the fractional part
-
MaxMSBX
(int
) - the weight of the MSB of the expected exponent of X
-
MSBA
(int
) - the weight of the least significand bit of the accumulator
-
LSBA
(int
) - the weight of the most significand bit of the accumulator
- Kulisch-like accumulator of floating-point numbers into a large fixed-point accumulator. By tuning the MaxMSB_in, LSB_acc and MSB_acc parameters to a given application, rounding error may be reduced to a provably arbitrarily low level, at a very small hardware cost compared to using a floating-point adder for accumulation.
For details on the technique used and an example of application, see this article
- LargeAccToFP
- Post-normalisation unit for FPLargeAcc.
- Parameters:
-
wE_out
(int
) - the width of the output exponent
-
wF_out
(int
) - the width of the output fractional part
-
MSBA
(int
) - the weight of the most significand bit of the accumulator
-
LSBA
(int
) - the weight of the least significand bit of the accumulator
- Converts the (fixed-point) output of FPLargeAcc or FPDotProduct (with the same parameters) into a floating-point number.
For details on the technique used and an example of application, see this article
- FPDotProduct
- Floating-point dot product unit based on FPLargeAcc
- Parameters:
-
wE
(int
) - the width of the exponent for the inputs X and Y
-
wFX
(int
) - the width of the fraction for the input X
-
wFY
(int
) - the width of the fraction for the input Y
-
MaxMSBX
(int
) - maximum expected weight of the MSB of the summand
-
MSBA
(int
) - The weight of the LSB of the accumulator determines the final accuracy of the result
-
LSBA
(int
) - The weight of the MSB of the accumulator has to greater than that of the maximal expected result
- Kulisch-like dot product operator. It feeds a long accumulator with the unrounded result of a floating-point multiplier, thus removing rounding errors from the multiplication as well.
Composite fixed-point operators
Elementary functions in fixed- or floating-Point
- FPExp
- A faithful floating-point exponential function.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
d
(int
) (optional, default value is 0) - degree of the polynomial. 0 choses a sensible default.
-
k
(int
) (optional, default value is 0) - input size to the range reduction table, should be between 5 and 15. 0 choses a sensible default.
-
g
(int
) (optional, default value is -1) - number of guard bits
- Parameter d and k control the DSP/RamBlock tradeoff. In both cases, a value of 0 choses a sensible default. Parameter g is mostly for internal use.
For all the details, see this article.
- FPLog
- Floating-point logarithm using an iterative method.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
inTableSize
(int
) (optional, default value is 0) - The input size to the tables, in bits, between 6 and 16. 0 choses a a sensible value
- For details on the technique used, see this article and this research report.
- FPPow
- A floating-point power function.
- Parameters:
-
wE
(int
) - exponent size in bits for both inputs
-
wF
(int
) - mantissa size in bits for both inputs
-
logSizeTable
(int
) (optional, default value is 0) - The table size input for the log in bits
-
type
(int
) (optional, default value is 0) - type of power function (0 pow - 1 powr. See IEEE754-2008)
-
expTableSize
(int
) (optional, default value is 0) - The table size input for the exponent in bit
-
expDegree
(int
) (optional, default value is 0)
- For all the details, see this article
- FixSinCos
- Computes (1-2^(-w)) sin(pi*x) and (1-2^(-w)) cos(pi*x) for x in -[1,1[, using tables and multipliers.
- Parameters:
-
lsb
(int
) - weight of the LSB of the input and outputs
- For a fixed-point 2's complement input x in [-1,1[, calculates (1-2^(lsbIn))*{sin,cos}(pi*x) using a table- and multiplier-based technique.
For more details, see this article.
- CordicSinCos
- Computes (1-2^(-w)) sin(pi*x) and (1-2^(-w)) cos(pi*x) for x in -[1,1[, using CORDIC algorithm
- Parameters:
-
lsb
(int
) - weight of the LSB of the input and outputs
-
reducedIterations
(int
) (optional, default value is 0) - If 1, number of iterations will be reduced at the cost of two multiplications.
- This is a classical CORDIC, implemented the FloPoCo way: it is last-bit accurate, hopefully at the minimum cost.
For more details, see this article.
- FixAtan2
- Computes atan(x/y) as a=(angle in radian)/pi so a in [-1,1[.
- Parameters:
-
lsb
(int
) - weight of the LSB of both inputs and outputs
-
method
(int
) - parameter select between: InvMultAtan with approximations of the corresponding degree (0..7), plain CORDIC (8), CORDIC with scaling (9), a method using surface approximation (10), Taylor approximation of order 1 (11) and 2 (12)
- For more details, see this article.
Arbitrary function approximators
- FixFunctionByTable
- Evaluator of function f on [0,1) or [-1,1), depending on signedIn, using a table.
- Parameters:
-
f
(string
) - function to be evaluated between double-quotes, for instance "exp(x*x)"
-
signedIn
(bool
) - true if the function input is [-1,1), false if it is [0,1)
-
lsbIn
(int
) - weight of input LSB, for instance -8 for an 8-bit input
-
msbOut
(int
) - weight of output MSB
-
lsbOut
(int
) - weight of output LSB
- This operator uses a table to store function values.
- FixFunctionBySimplePoly
- Evaluator of function f on [0,1) or [-1,1), using a single polynomial with Horner scheme
- Parameters:
-
f
(string
) - function to be evaluated between double-quotes, for instance "exp(x*x)"
-
lsbIn
(int
) - weight of input LSB, for instance -8 for an 8-bit input
-
msbOut
(int
) - weight of output MSB
-
lsbOut
(int
) - weight of output LSB
-
signedIn
(bool
) (optional, default value is true) - defines the input range : [0,1) if false, and [-1,1) otherwise
- This operator uses a table for coefficients, and Horner evaluation with truncated multipliers sized just right.
For more details, see this article.
- FixFunctionByPiecewisePoly
- Evaluator of function f on [0,1), using a piecewise polynomial of degree d with Horner scheme.
- Parameters:
-
f
(string
) - function to be evaluated between double-quotes, for instance "exp(x*x)"
-
lsbIn
(int
) - weight of input LSB, for instance -8 for an 8-bit input
-
msbOut
(int
) - weight of output MSB
-
lsbOut
(int
) - weight of output LSB
-
d
(int
) - degree of the polynomial
-
approxErrorBudget
(real
) (optional, default value is 0.25) - error budget in ulp for the approximation, between 0 and 0.5
- This operator uses a table for coefficients, and Horner evaluation with truncated multipliers sized just right.
For more details, see this article.
- FixFunctionByMultipartiteTable
- A function evaluator using the multipartite method.
- Parameters:
-
f
(string
) - function to be evaluated between double-quotes, for instance "exp(x*x)"
-
nbTables
(int
) - the number of tables used to decompose the function, between 2 (bipartite) to 4 or 5 for large input sizes
-
lsbIn
(int
) - weight of input LSB, for instance -8 for an 8-bit input
-
msbOut
(int
) - weight of output MSB
-
lsbOut
(int
) - weight of output LSB
-
signedIn
(bool
) (optional, default value is false) - defines the input range : [0,1) if false, and [-1,1) otherwise
- This operator uses the multipartite table method as introduced in this article, with the improvement described in this article.
- BasicPolyApprox
- Helper/Debug feature, does not generate VHDL. Polynomial approximation of function f, accurate to targetAcc on [0,1)
- Parameters:
-
f
(string
) - function to be evaluated between double-quotes, for instance "exp(x*x)"
-
targetAcc
(real
) - the target approximation errror of the polynomial WRT the function
-
signedIn
(bool
) (optional, default value is true) - defines the input range : [0,1) if false, and [-1,1) otherwise
-
g
(int
) (optional, default value is -1) - the number of guardbits added. Using -1 gives sensible default
- PiecewisePolyApprox
- Helper/Debug feature, does not generate VHDL. Uniformly segmented piecewise polynomial approximation of function f, accurate to targetAcc on [0,1)
- Parameters:
-
f
(string
) - function to be evaluated between double-quotes, for instance "exp(x*x)"
-
targetAcc
(real
) - the target approximation errror of the polynomial WRT the function
-
d
(int
) - the degree to use
Conversions between number systems
- Fix2FP
- Conversion from FloPoCo floating-point to fixed-point.
- Parameters:
-
signed
(bool
) (optional, default value is true) - can be false if all numbers will be positive
-
MSB
(int
) - weight of the MSB of the output
-
LSB
(int
) - weight of LSB of the input
-
wE
(int
) - output exponent size in bits
-
wF
(int
) - output mantissa size in bits
- FP2Fix
- Conversion from FloPoCo floating-point to fixed-point.
- Parameters:
-
wE
(int
) - input exponent size in bits
-
wF
(int
) - input mantissa size in bits
-
signed
(bool
) (optional, default value is true) - can be false if all numbers will be positive
-
MSB
(int
) - weight of the MSB of the output
-
LSB
(int
) - weight of LSB of the output
-
trunc
(bool
) (optional, default value is true) - true means truncated (cheaper), false means rounded
- InputIEEE
- Conversion from IEEE-754-like to FloPoCo floating-point formats. Subnormals are all flushed to zero at the moment.
- Parameters:
-
wEIn
(int
) - input exponent size in bits
-
wFIn
(int
) - input mantissa size in bits
-
wEOut
(int
) - output exponent size in bits
-
wFOut
(int
) - output mantissa size in bits
- OutputIEEE
- Conversion from FloPoCo to IEEE-754-like floating-point formats.
- Parameters:
-
wEIn
(int
) - input exponent size in bits
-
wFIn
(int
) - input mantissa size in bits
-
wEOut
(int
) - output exponent size in bits
-
wFOut
(int
) - output mantissa size in bits
-
onlyPositiveZeroes
(bool
) (optional, default value is false) - when true, normalize +0 and -0 to +0
Filters and FFTs
- FixFIR
- A fix-point Finite Impulse Filter generator.
- Parameters:
-
lsbInOut
(int
) - integer size in bits
-
rescale
(bool
) (optional, default value is false) - If true, divides all coefficient by 1/sum(|coeff|)
-
coeff
(string
) - colon-separated list of real coefficients using Sollya syntax. Example: coeff="1.234567890123:sin(3*pi/8)"
- For more details, see this article.
- FixSOPC
- A fix-point Sum of Product by Constants.
- Parameters:
-
lsbIn
(int
) - input's last significant bit
-
lsbOut
(int
) - output's last significant bit
-
coeff
(string
) - colon-separated list of real coefficients using Sollya syntax. Example: coeff="1.234567890123:sin(3*pi/8)"
- FixIIR
- A fix-point Infinite Impulse Response filter generator.
- Parameters:
-
lsbIn
(int
) - input most significant bit
-
lsbOut
(int
) - output least significant bit
-
H
(real
) (optional, default value is 0) - worst-case peak gain. if 0, it will be computed by the WCPG library
-
Heps
(real
) (optional, default value is 0) - worst-case peak gain of the feedback loop. if 0, it will be computed by the WCPG library
-
coeffa
(string
) - colon-separated list of real coefficients using Sollya syntax. Example: coeffa="1.234567890123:sin(3*pi/8)"
-
coeffb
(string
) - colon-separated list of real coefficients using Sollya syntax. Example: coeffb="1.234567890123:sin(3*pi/8)"
Test Benches
- TestBench
- Behavorial test bench for the preceding operator.
- Parameters:
-
n
(int
) (optional, default value is -2) - number of random tests. If n=-2, an exhaustive test is generated (use only for small operators)
-
file
(bool
) (optional, default value is true) - Inputs and outputs are stored in file test.input (lower VHDL compilation time). If false, they are stored in the VHDL
- Wrapper
- Wraps the preceding operator between registers (for frequency testing).
- Parameters:
AutoTest
- AutoTest
- A tester for operators.
- Parameters:
-
Operator
(string
) - name of the operator to test, All if we need to test all the operators
-
Dependences
(bool
) (optional, default value is false) - test the operator's dependences
Miscellaneous
- NbBitsMin
- A tool for FPDiv to compute where to truncate both partial remainder and divider.
- Parameters:
-
radix
(int
) - It has to be 2^n
-
digitSet
(int
) - the range you allow for each digit [-digitSet, digitSet]
- TargetModel
- A dummy operator useful when designing a new Target
- Parameters:
-
type
(int
) (optional, default value is 0) - when 0, build an adder of size 32
- This operator is for FloPoCo developers only.
Synthesize this operator, then look at its critical path.
Also see Target.hpp.
- UserDefinedOperator
- An heavily commented example operator to start with FloPoCo.
- Parameters:
-
param0
(int
) (optional, default value is 16) - A first parameter, here used as the input size
-
param1
(int
) - A second parameter, here used as the output size
- Feel free to experiment with its code, it will not break anything in FloPoCo.
Also see the developper manual in the doc/ directory of FloPoCo.