Operator list for FloPoCo version 5.0.git
Shifters, Leading Zero Counters, etc
- Shifter
- A flexible shifter.
- Parameters:
-
wX
(int
) - input size in bits
-
maxShift
(int
) - maximum shift distance in bits
-
dir
(bool
) - 0=left, 1=right
-
wR
(int
) (optional, default value is -1) - size of the shifted output , -1 means computed, will be equal to wX+maxShift
-
computeSticky
(bool
) (optional, default value is false) - if true and wR
-
inputPadBit
(bool
) (optional, default value is false) - if true, add an input bit used for left-padding, as in sign extension
- LZOC
- A leading zero or one counter. The output size is computed.
- Parameters:
-
wIn
(int
) - input size in bits
-
countType
(int
) (optional, default value is -1) - 0 means count zeroes, 1 means count ones, -1 means add an input that defines what to count
- GenericMux
- A Multiplexer
- Parameters:
-
wIn
(int
) - input word size
-
inputCount
(int
) - the number of data inputs (NOT counting the select input!)
- GenericLut
- A simple look up table.
- Parameters:
-
wIn
(int
) - input word size
-
wOut
(int
) - output word size
-
entityName
(string
) - unique name for the LUT
-
inputValues
(string
) - colon seperated list of (unsigned) ints specifying the inputs for the LUT
-
outputValues
(string
) - colon seperated list of (unsigned) ints specifying the corrisponding outputs
- Normalizer
- A combined leading zero/one counter and left shifter, useful for floating-point normalization.
- Parameters:
-
wX
(int
) - input size in bits
-
wR
(int
) - output size in bits, with wR <= wX
-
maxShift
(int
) - how many bits to count, with maxShift<= wX
-
computeSticky
(bool
) (optional, default value is false) - if true and wR
-
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
- LZOC3
- A leading zero counter. The output size is computed.
- Parameters:
-
wIn
(int
) - input size in bits
-
useLargeLut
(bool
) (optional, default value is false) - Use max unrouted lut size to build the encoding
- ShiftReg
- A plain shift register implementation.
- Parameters:
-
w
(int
) - the size of the input
-
n
(int
) - the number of stages in the shift register, also the number of outputs
-
reset
(int
) (optional, default value is 0) - the reset type (0 for none, 1 for synchronous, 2 for asynchronous)
Basic integer operators (pipelined)
- FixMultAdd
- A generic fixed-point A+X*Y. With so many parameters, it is probably mostly for internal use.
- Parameters:
-
signedIO
(bool
) - signedness of multiplicands X and Y
-
msbX
(int
) - position of the MSB of multiplicand X
-
lsbX
(int
) - position of the LSB of multiplicand X
-
msbY
(int
) - position of the MSB of multiplicand Y
-
lsbY
(int
) - position of the LSB of multiplicand Y
-
msbA
(int
) - position of the MSB of addend A
-
lsbA
(int
) - position of the LSB of addend A
-
msbOut
(int
) - position of the MSB of output
-
lsbOut
(int
) - position of the LSB of output
-
correctlyRounded
(bool
) (optional, default value is false) - if true no attempt to truncate the product will be made, if false optimize for a faithful result
- IntSquarerLUT
- Implements a LUT squarer by simply tabulating all results in the LUT, should only be used for very small word sizes
- Parameters:
-
wIn
(int
) - size of the input XxX
-
isSigned
(bool
) - signedness of the input
- IntMultiAdder
- A component adding n integers, bitheap based. If wIn=1 it is also a population count
- Parameters:
-
signedIn
(bool
) - 0=unsigned, 1=signed
-
n
(int
) - number of inputs to add
-
wIn
(int
) - input size in bits
-
wOut
(int
) (optional, default value is 0) - output size in bits -- if 0, wOut is computed to be large enough to represent the result
- IntAddSub
- Generic Integer adder/subtractor that supports addition and subtraction of up to three inputs (ternary adder) as well as runtime configuration of the signs of operation but no fancy pipelining like IntAdder.
- Parameters:
-
wIn
(int
) - input size in bits
-
isSigned
(bool
) (optional, default value is false) - set to true if you want a signed adder (with correct sign extension of the inputs) or not, unsigned only works when not input is negative or configurable (as negative output numbers may occur)
-
isTernary
(bool
) (optional, default value is false) - set to true if you want a ternary (3-input adder)
-
xNegative
(bool
) (optional, default value is false) - set to true if X (first) input should be subtracted
-
yNegative
(bool
) (optional, default value is false) - set to true if Y (second) input should be subtracted
-
zNegative
(bool
) (optional, default value is false) - set to true if Z (third) input should be subtracted, only valid when isTernary=true
-
xConfigurable
(bool
) (optional, default value is false) - set to true if X input should be configurable with its sign (an extra input is added to decide add/subtract operation)
-
yConfigurable
(bool
) (optional, default value is false) - set to true if Y input should be configurable with its sign (an extra input is added to decide add/subtract operation)
-
zConfigurable
(bool
) (optional, default value is false) - set to true if Z input should be configurable with its sign (an extra input is added to decide add/subtract operation), only valid when isTernary=true
- 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
- IntKaratsubaRectangular
- Implements a large unsigned Multiplier using rectangular shaped tiles as appears for Xilinx FPGAs. Currently limited to specific, hand-optimized sizes
- Parameters:
-
wX
(int
) - size of input X
-
wY
(int
) - size of input Y
-
useKaratsuba
(bool
) (optional, default value is 1) - Uses Karatsuba when set to 1, instead a standard tiling without sharing is used.
-
useRectangularTiles
(bool
) (optional, default value is 1) - Uses rectangular tiles when set to 1, otherwise quadratic tiles are used
- FixMultiAdder
- A component adding n fixed-point number using a BitHeap. Each input can be individually specified by MSL, LSB and a shift value. This allows arbitrary BitHeaps.
- Parameters:
-
signedIn
(bool
) - 0=unsigned, 1=signed
-
n
(int
) - number of inputs to add
-
msbIn
(string
) - msb of input when all inputs have the same lsb position, colon separated list of msb positions, if they are different
-
lsbIn
(string
) (optional, default value is 0) - lsb of input when all inputs have the same lsb position, colon separated list of lsb positions, if they are different
-
lsbOut
(int
) (optional, default value is FULL) - lsb position of the output, specifying lsbOut to larger than input LSB values will faithfully round the result, if set to FULL, no truncation is performed
-
shifts
(string
) (optional, default value is 0) - colon separated list of left bit shifts for each input, no shift when not specified
- IntMultiplierLUT
- Implements a LUT multiplier by simply tabulating all results in the LUT, should only be used for very small word sizes
- Parameters:
-
wX
(int
) - size of input X
-
wY
(int
) - size of input Y
- IntConstantComparator
- An integer comparator.
- Parameters:
-
w
(int
) - size in bits of integers to be compared
-
c
(int
) - constant
-
flags
(int
) (optional, default value is 7) - if bit 0 set output XC
-
method
(int
) (optional, default value is -1) - method to be used, for experimental purpose (-1: automatic, 0: symmetric, 1: asymmetric where gt is computed out of lt and eq, 2: binary tree) (plainVHDL option also supported)
- Outputs up to 3 mutually exclusive signals: XltC (less than, strictly), XeqC (equal), XgtC (greater than, strictly)
- DSPBlock
- Implements a DSP block commonly found in FPGAs incl. pre-adders and post-adders computing R = (X1+X2) * Y + Z
- Parameters:
-
wX
(int
) - size of input X (or X1 and X2 if pre-adders are used)
-
wY
(int
) - size of input Y
-
wZ
(int
) (optional, default value is 0) - size of input Z (if post-adder is used)
-
xIsSigned
(bool
) (optional, default value is 0) - input X is signed
-
yIsSigned
(bool
) (optional, default value is 0) - input Y is signed
-
usePostAdder
(bool
) (optional, default value is 0) - use post-adders
-
usePreAdder
(bool
) (optional, default value is 0) - use pre-adders
-
preAdderSubtracts
(bool
) (optional, default value is 0) - if true, the pre-adder performs a pre-subtraction
- IntDualAddSub
- 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
- BitheapTest
- A random test generator for the bitheap.
- Parameters:
-
msb
(int
) - the msb of the bitheap
-
lsb
(int
) - the lsb of the bitheap
-
nbInputs
(int
) - the number of signals to add to the bitheap
-
isSigned
(bool
) - the signness of the bitheap
-
weight
(int
) - the weight of the inputs in the bitheap
- IntMultiplier
- A pipelined integer multiplier. Also uses the global options: tiling, ilpSolver, etc
- 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 (overrides value for individual inputs)
-
signedX
(bool
) (optional, default value is false) - The X-inputs can be signed or unsigned
-
signedY
(bool
) (optional, default value is false) - The Y-inputs can be signed or unsigned
-
maxDSP
(int
) (optional, default value is -1) - limits the number of DSP-Tiles used in Multiplier
-
optiTrunc
(bool
) (optional, default value is true) - if true and using tiling=optimal, considers the truncation error dynamicly, instead of defining a hard border for tiling (see ARITH'21 paper)
-
minStages
(bool
) (optional, default value is true) - if true, minimizes stages in combined opt. of tiling an comp., otherwise try to find a sol. with less LUTs but possibly more stages
-
beamRange
(int
) (optional, default value is 3) - beam range parameter when using heuristicBeamSearchTiling, larger values are slower but lead to better quality
-
use2xk
(bool
) (optional, default value is auto) - if true, attempts to use the 2xk-LUT-Multiplier with relatively high efficiency
-
useirregular
(bool
) (optional, default value is auto) - if true, irregular-LUT-Multipliers with higher area/lut efficiency are forced, if false, they are forbidden, if auto, they are used if the target and tiling method allows
-
useLUT
(bool
) (optional, default value is auto) - if true, attempts to use the LUT-Multipliers for tiling
-
useBooth
(bool
) (optional, default value is auto) - if true, attempts to use LUT-based Booth Arrays
-
useLUTMap
(bool
) (optional, default value is auto) - if true, attempts to use LUT-based Tiles found by Nicolai
-
useKaratsuba
(bool
) (optional, default value is auto) - if true, attempts to use rectangular Karatsuba for tiling
-
useSuperTile
(bool
) (optional, default value is auto) - if true, attempts to use the DSP adders to chain sub-multipliers. This may entail lower logic consumption, but higher latency.
-
useGenLUT
(bool
) (optional, default value is false) - if true, attempts to use the generalized LUT Multipliers, as defined by file multiplier_shapes.tiledef
-
isSquarer
(bool
) (optional, default value is false) - generates a squarer
- IntSquarer
- An integer squarer.
- Parameters:
-
wIn
(int
) - size of input in bits
-
wOut
(int
) (optional, default value is 0) - size of the output if you want a truncated squarer. 0 for exact (full) squarer
-
method
(string
) (optional, default value is schoolbook) - squarer design method, schoolbook (standard) or optimal
-
maxDSP
(int
) (optional, default value is 0) - limit DSPs, 0 (standard) or allow more
-
signedIn
(bool
) (optional, default value is false) - inputs can be signed or unsigned (output always unsigned)
- Compressor
- A basic compressor.
- Parameters:
-
columnHeights
(string
) - comma separated list of heights for the columns of the compressor, in decreasing order of the weight. For example, columnHeights="2,3" produces a (2,3:4) GPC
-
compactView
(bool
) (optional, default value is false) - whether the VHDL code is printed in a more compact way, or not
- IntComparator
- An integer comparator.
- Parameters:
-
w
(int
) - size in bits of integers to be compared
-
flags
(int
) (optional, default value is 7) - if bit 0 set output XY
-
method
(int
) (optional, default value is -1) - method to be used, for experimental purpose (-1: automatic, 0: symmetric, 1: asymmetric where gt is computed out of lt and eq, 2: binary tree, 3: two-level minimum latency)
- Outputs up to 3 mutually exclusive signals: XltY (less than, strictly), XeqY (equal), XgtY (greater than, strictly)
Basic floating-point operators
- IEEEFPFMA
- A correctly rounded floating-point FMA.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
- FPSqrt
- A correctly rounded floating-point square root function.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
method
(int
) (optional, default value is 1) - 0 for plain restoring, 1 for nonrestoring method
- FPComparator
- An IEEE-like floating-point comparator.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
flags
(int
) (optional, default value is 31) - generate XltY output if bit 0 set, XeqY if bit 1, XgtY if bit 2, XleY if bit 3, XgeY if bit 4
-
method
(int
) (optional, default value is -1) - method to be used in the IntComparator, see IntComparator
- Outputs up to 4 mutually exclusive signals: unordered (when one input is NaN), XltY (less than, strictly), XeqY (equal), XsgtY (greater than, strictly). Also two derived signals XleY (less or equal) and XgeY (greater or equal). unordered is set iff at least one of the inputs is NaN. The other ones behave as expected on two non-NaN values, with the IEEE 754 conventions: +0 = -0; +infinity = +infinity; -infinity = -infinity. The flags argument controls which signal is generated.;
- FPDiv
- A correctly rounded floating-point division.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
srt
(int
) (optional, default value is 42) - Can be 42, 43 or 87 so far. Default 42 means radix 4 with digits between -2 and 2. Other choices 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 [-7,7], and a bit of prescaling.
- 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
) - input exponent size in bits, for X or for both X and Y
-
wF
(int
) - input significand fraction size in bits, for X or for both X and Y
-
wEY
(int
) (optional, default value is 0) - second input exponent size in bits (0 means wEY=wE)
-
wFY
(int
) (optional, default value is 0) - second input significand fraction size in bits (0 means wFY=wF)
-
wEOut
(int
) (optional, default value is 0) - result exponent size in bits (0 means wEOout=wE)
-
wFOut
(int
) (optional, default value is 0) - result significand fraction size in bits (0 means wFOout=wF)
-
correctlyRounded
(bool
) (optional, default value is true) - correct (true) or faithful (false) rounding
-
dspThreshold
(real
) (optional, default value is 0.0) - threshold of relative occupation ratio of a DSP multiplier to be used or not
- IEEEFPAdd
- A single-path floating-point adder for standard IEEE floating-point data.
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
- 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
-
onlyPositiveIO
(bool
) (optional, default value is false) - only for dualPath adders, optimize for only positive input and output numbers
- 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.
Posit operators
- PositExp
- A faithful posit exponential function.
- Parameters:
-
width
(int
) - Posit size in bits
-
wES
(int
) - exponent 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.
- PositAdd
- A correctly rounded posit adder.
- Parameters:
-
width
(int
) - posit size in bits
-
wES
(int
) - exponent size in bits
- PositFunctionByTable
- Evaluator of function f using a table.
- Parameters:
-
f
(string
) - function to be evaluated between double-quotes, for instance "exp(x*x)"
-
width
(int
) - size of the Posit
-
wES
(int
) - size of the Posit's exponent.
- This operator uses a table to store function values.
Multipliers and dividers by constants
- IntConstMult
- An operator for building constant multipliers. It basically creates the instances of the highly optimized variants using shift and add or KCM
- Parameters:
-
wIn
(int
) - Wordsize of pag inputs
-
constant
(string
) - constant(s) to multiply with, can be a single constant, multiple constants separated by commas, or constant matrices, where rows are separated by semicolons (like in Matlab)
-
wOut
(int
) (optional, default value is -1) - Output word size (-1 means full precision according to the constant and wIn)
-
signed
(bool
) (optional, default value is true) - signedness of input and output
-
method
(string
) (optional, default value is auto) - desired method. Can be 'KCM', 'minAdd', 'minAddTernary', 'ShiftAddRPAG', 'ShiftAddPlain' or 'auto' (let FloPoCo decide which operator performs best on the given target)
- FPConstMult
- Floating-point constant multiplier using the shift-and-add approach.
- Parameters:
-
wE
(int
) - input exponent width, also output exponent width if weOut=-1
-
wF
(int
) - input significand width, also output significand width if wFOut=-1
-
constant
(string
) - constant in sollya formalism (e.g. "cos(3*pi/2)" or "13176795b-22")
-
wEout
(int
) (optional, default value is -1) - output exponent width, -1 means same as wE
-
wFout
(int
) (optional, default value is -1) - output significand width, -1 means same as wF
-
cst_width
(int
) (optional, default value is 0) - constant precision (number of bits). If set to zero, the width will be computed to ensure a faithful result.
- An early version of the technique used is described in this article.
- FixRealShiftAdd
- Table based real multiplier. Output size is computed
- Parameters:
-
signedIn
(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 shift-and-add multiplier is briefly described in this article.
Special constants, such as 0 or powers of two, are handled efficiently.
- FPConstMultRational
- Correctly rounded floating-point multiplier by a rational constant.
- Parameters:
-
wE
(int
) - input exponent width, also output exponent width if weOut=-1
-
wF
(int
) - input significand width, also output significand width if wFOut=-1
-
a
(int
) - numerator
-
b
(int
) - denominatorwEout(int)=-1: output exponent width, -1 means same as wE
-
wFout
(int
) (optional, default value is -1) - output significand width, -1 means same as wF
- The technique used is described 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)
-
arch
(int
) (optional, default value is 0) - architecture used for the mantissa IntConstDiv -- 0 for linear-time, 1 for log-time, 2 for multiply-and-add by the reciprocal
-
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.
- FixRealConstMult
- Table based real multiplier. Output size is computed
- Parameters:
-
signedIn
(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
-
method
(string
) (optional, default value is auto) - desired method. Can be 'KCM', 'ShiftAdd' or 'auto' (let FloPoCo decide which operator performs best)
- The KCM variant is described in this article. The Shift-and-Add variant is described in this article.
Special constants, such as 0 or powers of two, are handled efficiently.
- IntConstDiv
- Integer divider by a small constant.
- Parameters:
-
wIn
(int
) - input size in bits
-
d
(intlist
) - integer to divide by. Either a small integer, or a colon-separated list of small integers, in which case a composite divider by the product is built
-
arch
(int
) (optional, default value is 0) - architecture used -- 0 for linear-time, 1 for log-time, 2 for multiply-and-add by the reciprocal, 3 for table-and-addition
-
computeQuotient
(bool
) (optional, default value is true) - if true, the architecture outputs the quotient
-
computeRemainder
(bool
) (optional, default value is true) - if true, the architecture outputs the remainder
-
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, for arch=1, in this article, for arch=2 in TODO article, and for arch=3 in the TODO-Arith-2023 article.
- IntConstMultShiftAddOptTernary
- Integer constant multiplication using shift and ternary additions in an optimal way (i.e., with minimum number of ternary adders). Works for coefficients up to 4194303 (22 bit)
- Parameters:
-
wIn
(int
) - Input word size
-
constant
(int
) - constant
-
signed
(bool
) (optional, default value is true) - signedness of input and output
-
errorBudget
(int
) (optional, default value is 0) - Allowable error for truncated constant multipliers
- Nope.
- FixRealKCM
- Table based real multiplier. Output size is computed
- Parameters:
-
signedIn
(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.
- FixFixConstMult
- Table based real multiplier. Output size is computed
- Parameters:
-
signedIn
(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)"
-
extrabit
(bool
) (optional, default value is true) - do we need extra bit for addition
- IntConstMultShiftAddOpt
- Integer constant multiplication using shift and add in an optimal way (i.e., with minimum number of adders). Works for coefficients up to 524287 (19 bit)
- Parameters:
-
wIn
(int
) - Input word size
-
constant
(int
) - constant
-
signed
(bool
) (optional, default value is true) - signedness of input and output
-
errorBudget
(int
) (optional, default value is 0) - Allowable error for truncated constant multipliers
- Nope.
- IntConstMultShiftAddRPAG
- Integer constant multiplication using shift and add using the RPAG algorithm
- Parameters:
-
wIn
(int
) - Input word size
-
constants
(string
) - list of constants
-
signed
(bool
) (optional, default value is true) - signedness of input and output
-
errorBudget
(int
) (optional, default value is 0) - Allowable error for truncated constant multipliers
- Nope.
- IntConstMultShiftAddPlain
- Integer multiplier of an unsigned number by a constant using a shift-and-add tree.
- Parameters:
-
wIn
(int
) - input size in bits
-
constant
(int
) - constant to multiply with
- An early version of this operator is described in this article.
- IntConstMultShiftAdd
- A component for building constant multipliers based on pipelined adder graphs (PAGs).
- Parameters:
-
wIn
(int
) - Wordsize of pag inputs
-
graph
(string
) - Adder graph description (see PAGSuite project) as string or as text file with file extension ".ag"
-
signed
(bool
) (optional, default value is true) - signedness of input and output
-
errorBudget
(int
) (optional, default value is 0) - Allowable error for truncated constant multipliers
-
truncations
(string
) (optional, default value is "") - provides the truncations for intermediate values (format: const1,stage:trunc_input_0,trunc_input_1,...|const2,stage:trunc_input_0,trunc_input_1,...)
Composite fixed-point operators
- Fix3DNorm
- Computes sqrt(x*x+y*y+z*z)
- Parameters:
-
lsbIn
(int
) - weight of the LSB of input
-
lsbOut
(int
) - weight of the LSB of output
-
method
(string
) - general method, among Naive and CORDIC
-
squareMethod
(string
) (optional, default value is auto) - technique for the sum of squares in the Naive method, will be passed as method to FixSumOfSquares
-
sqrtMethod
(string
) (optional, default value is auto) - sqrt approximation technique for the Naive method, among PlainTable, MultiPartite, PiecewiseHorner1, PiecewiseHorner2, PiecewiseHorner3, auto
- Fix2DNorm
- Computes sqrt(x*x+y*y)
- Parameters:
-
lsbIn
(int
) - weight of the LSB of input
-
lsbOut
(int
) - weight of the LSB of output
-
method
(string
) - general method, among Naive and CORDIC
-
squareMethod
(string
) (optional, default value is auto) - technique for the sum of squares in the Naive method, will be passed as method to FixSumOfSquares
-
sqrtMethod
(string
) (optional, default value is auto) - sqrt approximation technique for the Naive method, among PlainTable, MultiPartite, PiecewiseHorner1, ... PiecewiseHorner4, auto
- FixSumOfSquares
- Computes X²+Y²(+Z²)
- Parameters:
-
lsbIn
(int
) - weight of the LSB of input
-
lsbOut
(int
) (optional, default value is 0) - weight of the LSB of output, 0 for an exact sum of squares
-
N
(int
) - number of squares, should be 2 or 3
-
method
(string
) (optional, default value is auto) - among TablesSigned, TablesUnsigned, Multipliers, Squarers, FusedSumOfProducts, FusedSumOfSquares, auto
Elementary functions in fixed- or floating-Point
- FixSinCos
- Computes (1-2^(-w)) sin(pi*x) and (1-2^(-w)) cos(pi*x) for x in -[1,1[
- Parameters:
-
lsb
(int
) - weight of the LSB of the input and outputs
-
method
(int
) (optional, default value is 0) - 0 for table- and mult-based, 1 for traditional CORDIC, 2 for reduced-iteration CORDIC
-
wA
(int
) (optional, default value is 0) - input size to the table. 0 choses a sensible value matching the target block RAM size.
- For a fixed-point 2's complement input x in [-1,1[, evaluates (1-2^(lsbIn))*{sin,cos}(pi*x).
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.
- FixSinOrCos
- Computes (1-2^(-w)) sin(pi*x) or (1-2^(-w)) cos(pi*x) for x in -[1,1[.
- Parameters:
-
w
(int
) - fixed-point precision of inputs and outputs in bits
-
degree
(int
) - degree of the polynomial-based method (-1 should default to something sensible )
- For a fixed-point 2's complement input x in [-1,1[, evaluates (1-2^(lsbIn))*sin(pi*x) or (1-2^(lsbIn))*sin(pi*x) depending on the input SinCosbar.
For more details, see this article.
- 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
-
fullInput
(bool
) (optional, default value is 0) - input a mantissa of wF+wE+g bits (useful mostly for FPPow)
- 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
- Parameters:
-
wE
(int
) - exponent size in bits
-
wF
(int
) - mantissa size in bits
-
method
(int
) (optional, default value is 0) - 0 for iterative, 1 for polynomial
-
inTableSize
(int
) (optional, default value is 0) - The input size to the tables of the iterative method, 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
-
type
(int
) (optional, default value is 0) - 0 for pow, 1 for the powr function introduced in IEEE754-2008
- IEEEFPExp
- A faithful IEEE 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
-
fullInput
(bool
) (optional, default value is 0) - input a mantissa of wF+wE+g bits (useful mostly for FPPow)
- 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.
- Exp
- A helper operator for the 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
-
IEEEFPMode
(bool
) (optional, default value is 0) - true when the output format is destined to be IEEEFP
-
fullInput
(bool
) (optional, default value is 0) - input a mantissa of wF+wE+g bits (useful mostly for FPPow)
- 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.
Arbitrary function approximators
- FixFunctionByMultipartiteTable
- A function evaluator using the multipartite method.
- Parameters:
-
f
(string
) - function to be evaluated between double-quotes, for instance "exp(x*x)"
-
signedIn
(bool
) (optional, default value is 0) - if true the function input range is [-1,1), if false it is [0,1)
-
lsbIn
(int
) - weight of input LSB, for instance -8 for an 8-bit input
-
lsbOut
(int
) - weight of output LSB
-
nbTO
(int
) (optional, default value is 0) - number of Tables of Offsets, between 1 (bipartite) to 4 or 5 for large input sizes. -- 0: let the tool choose
-
method
(string
) (optional, default value is analytical) - Which method to use for the multipartite evaluation, [3manalytical[0m, [3mILP[0m (not implemented yet), or [3mfile[0m to use a provided file.
- This operator uses the multipartite table method as introduced in this article, with the improvement described in this article.
- 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
) (optional, default value is 0) - if true the function input range is [-1,1), if false it is [0,1)
-
lsbIn
(int
) - weight of input LSB, for instance -8 for an 8-bit input
-
lsbOut
(int
) - weight of output LSB
- This operator uses a table to store function values.
- 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
-
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.
- 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)"
-
signedIn
(bool
) (optional, default value is true) - if true the function input range is [-1,1), if false it is [0,1)
-
lsbIn
(int
) - weight of input LSB, for instance -8 for an 8-bit input
-
lsbOut
(int
) - weight of output LSB
- This operator uses a table for coefficients, and Horner evaluation with truncated multipliers sized just right.
For more details, see this article.
Conversions between number systems
- Posit2PIF
- Converts Posits to Posit Intermediate Format
- Parameters:
-
width
(int
) - The input size
-
wES
(int
) - The exponent size
- 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
- 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
- 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
- PIF2Posit
- Converts Posit Intermediate Format to Posits
- Parameters:
-
width
(int
) - The size of the posit
-
wES
(int
) - The exponent size (for the posit)
- FP2Fix
- Conversion from FloPoCo floating-point to fixed-point.
- Parameters:
-
wE
(int
) - input exponent size in bits
-
wF
(int
) - input mantissa size in bits
-
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, false means rounded. Truncated is not really cheaper.
- PIF2Fix
- Converts Posit Intermediate Format to the FixPoint format used in the exponential
- Parameters:
-
width
(int
) - The size of the posit
-
wES
(int
) - The exponent size (for the posit)
- Posit2Posit
- This should do nothing
- Parameters:
-
width
(int
) - The size of the posit
-
wES
(int
) - The width of the exponent
- Posit2FP
- Convert Posit to floating point
- Parameters:
-
width
(int
) - total size of the encoding
-
es
(int
) - exponent field length
Filters and FFTs
- FixRootRaisedCosine
- A generator of fixed-point Root-Raised Cosine filters, for inputs between -1 and 1
- Parameters:
-
alpha
(real
) - roll-off factor, between 0 and 1
-
lsbIn
(int
) - position of the LSB of the input, e.g. -15 for a 16-bit signed input
-
lsbOut
(int
) - position of the LSB of the output
-
n
(int
) - filter order (number of taps will be 2n+1)
- FixHalfSine
- A generator of fixed-point Half-Sine filters, for inputs between -1 and 1
- Parameters:
-
lsbIn
(int
) - position of the LSB of the input, e.g. -15 for a 16-bit signed input
-
lsbOut
(int
) - position of the LSB of the output
-
n
(int
) - filter order (number of taps will be 2n)
- For more details, see this article.
- FixFIR
- A fix-point Finite Impulse Filter generator.
- Parameters:
-
lsbIn
(int
) - integer size in bits
-
lsbOut
(int
) - integer size in bits
-
symmetry
(int
) (optional, default value is 0) - 0 for normal filter, 1 for symmetric, -1 for antisymmetric. If not 0, only the first half of the coeff list is used.
-
rescale
(bool
) (optional, default value is false) - If true, divides all coefficients 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.
- IntFIRTransposed
- A fix-point Finite Impulse Filter generator in transposed form using shif-and-add.
- Parameters:
-
wIn
(int
) - input word size in bits
-
wOut
(int
) (optional, default value is -1) - output word size in bits, -1 means automatic determination without truncation, if wOut is less then necessary it will be rounded
-
coeff
(string
) - colon-separated list of integer coefficients. Example: coeff="123:321:123"
-
graph
(string
) (optional, default value is "") - Realization string of the adder graph
-
errorBudget
(int
) (optional, default value is 0) - Allowable error for truncated constant multipliers (currently only used to check error for given truncations in testbench)
-
graph_truncations
(string
) (optional, default value is "") - provides the truncations for intermediate values of the adder graph (format: const1,stage:trunc_input_0,trunc_input_1,...|const2,stage:trunc_input_0,trunc_input_1,...)"
-
sa_truncations
(string
) (optional, default value is "") - provides the truncations for the strucutal adder (format: sa_1_trunc_input_0,sa_1_trunc_input_1|...|sa_2_trunc_input_0,sa_2_trunc_input_1,...|...)
- FixSOPCfull
- A fix-point Sum of Product by Constants (detailed interface).
- Parameters:
-
msbIn
(string
) - colon-separated string of ints, input's last significant bit
-
lsbIn
(string
) - colon-separated string of ints, input's last significant bit
-
msbOut
(int
) - output's most 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 least 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
) - coefficients of the transfer function denominator, a colon-separated list of reals using Sollya syntax. Example: coeffa="1.234567890123:sin(3*pi/8)"
-
coeffb
(string
) - coefficients of the transfer function denominator, a colon-separated list of reals using Sollya syntax. Example: coeffb="1.234567890123:sin(3*pi/8)"
-
buildWorstCaseTestBench
(bool
) (optional, default value is false) - if true, the TestBench for this IIR will begin with a stimulation by the worst-case input signal
- FixIIRShiftAdd
- An Infinite Impulse Response filter generator using IntConstMultShiftAdd (optional).
- Parameters:
-
msbIn
(int
) - input most significant bit
-
lsbIn
(int
) - input least 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
-
guardbits
(int
) (optional, default value is -1) - number of guard bits for computation in recursive feedback path (-1: automatic)
-
coeffa
(string
) (optional, default value is -1) - 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)"
-
shifta
(int
) (optional, default value is -1) - Num of rightshifts for coeffa (must be positive)
-
shiftb
(int
) - Num of rightshifts for coeffb (must be positive)
-
method
(string
) (optional, default value is plain) - plain or multiplierless
-
grapha
(string
) (optional, default value is emptya) - graph in rpag format for coeffa
-
graphb
(string
) (optional, default value is emptyb) - graph in rpag format for coeffb
- 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)"
Sorting operators
- SortWrapper
- Wrapper for sorting methods, can sort keys with payload
- Parameters:
-
N
(int
) - Number of elements we are sorting
-
wKey
(int
) - Width of the integer we are comparing
-
wPayload
(int
) - Width of the payload. Can be 0 if no payload is needed
-
direction
(bool
) - Sorts increasing if true and decreasing if false
-
indexPayload
(bool
) (optional, default value is false) - If true then use indices in the sorting network instead of the payload. This is useful when the payload takes more time to compute than the key, but it is a bit more expensive in area.
-
method
(int
) - Which sort to use, 0 for sorting network, 1 for Tao sort
- This is VHDL code is a wrapper for sorters
- SortingNetwork
- Implements a sorting network on unsigned integers with payload
- Parameters:
-
N
(int
) - Number of elements we are sorting
-
wKey
(int
) - Width of the integer we are comparing
-
wPayload
(int
) - Width of the payload. Can be 0 for no payload
-
direction
(bool
) - Sorts increasing if true and decreasing if false
- This is VHDL code following the bitonic sort, but can support different sorts if needed.
- TaoSort
- Implements a sorting method on unsigned integers that returns the index of how to sort them
- Parameters:
-
N
(int
) - Number of elements we are sorting
-
wKey
(int
) - Width of the integer we are comparing
-
outputDifference
(bool
) (optional, default value is false) - If true, will output the absolute value of the difference between the inputs. Regular user should not need this option
- This is VHDL code following a sort introduced in 'Correctly Rounded Architectures for Floating-Point Multi-Operand Addition and Dot-Product Computation' Yao Tao, Gao Deyuan, Fan Xiaoya, Jari Nurmi. The outputDifference is needed to reproduce the architecture in this paper
Miscellaneous
- 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.
- TutorialOperator
- 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.
- DAGOperator
- DAG operator for FloPoCo. Example input files in doc/web/DAGOperator/
- Parameters:
-
infile
(string
) - name of the file containing the DAG specification
- SRTDivNbBitsMin
- A SRT design tool
- Parameters:
-
radix
(int
) - It has to be 2^n
-
alpha
(int
) - digit set is [-alpha, alpha]
Test Benches
- RegisterSandwich
- Wraps the preceding operator between registers (for frequency testing).
- Parameters:
- TestBench
- Behavorial test bench for the preceding operator.
- Parameters:
-
n
(int
) (optional, default value is -1) - number of random tests. If n=-2, an exhaustive test is generated (use only for small operators). If n=-1, an exhaustive test is selected if there are fewer than 16 input bits, otherwise 10000 random tests are performed
-
inputFile
(string
) (optional, default value is test.input) - input file name
AutoTest
- AutoTest
- A tester for operators.
- Parameters:
-
Operator
(string
) - name of the operator to test, All if we need to test all the operators
-
testLevel
(int
) (optional, default value is 0) - test level (0-3), 0=only quick tests (< 1 second per operator), 1=substantial tests, 2=exhaustive tests, 3=infinite tests (which produce random parameter combinations which may take forever)
-
output
(string
) (optional, default value is random) - explicit path for .csv generation output (otherwise unique random directory)