arithmetic library
Documentation-only family index. Import package:rohd_hcl/rohd_hcl.dart.
Classes
- AbsoluteValue
- Computes the exact magnitude of a signed two's-complement value.
- Accumulator
-
Accumulates an unsigned
amountwith optional natural-width saturation. - Adder
- An abstract class for adders..
- BinaryExtensionField
- An immutable descriptor for a binary extension field GF(2^m).
- BitCompressor
- Base class for bit-level column compressor function
-
BrentKung<
T extends Logic> - BrentKung implements the Brent-Kung shaped ParallelPrefix tree pattern.
- BruteSignExtension
- A Brute Sign Extension class.
- CarrySaveMultiplier
- A binary multiplier using carry-save technique with pipelining.
- CarrySelectCompoundAdder
- Carry-select compound adder.
- CarrySelectOnesComplementCompoundAdder
- Carry-select ones-complement compound adder.
- CeilDivide
-
Divides
dividendbydivisorand rounds the quotient up. - CircularPointer
- A registered pointer that advances by a variable increment and wraps modulo slots.
- ColumnCompressor
- A column compressor module
- CompactRectSignExtension
- A Partial Product Generator using Compact Rectangular Extension
- CompactSignExtension
- A Compact Sign Extension class.
- CompoundAdder
- An abstract class for all compound adder module implementations.
- CompressionTreeDelayConfig
- Relative path delays used when constructing a compression tree.
- CompressionTreeDotProduct
- An integer dot product module using a ColumnCompressor.
- CompressionTreeMultiplier
- An implementation of an integer multiplier using compression trees.
- CompressionTreeMultiplyAccumulate
- An implementation of an integer multiply-accumulate using compression trees
- Compressor2
- 2-input column compressor (half-adder)
- Compressor3
- 3-input column compressor (full-adder)
- Compressor4
- 4:2 compressor with a horizontal carry input and output.
- CompressorDelayTable
- Estimated input-to-output delays for a compressor.
- CompressTerm
- A compression term.
- Counter
- Keeps a count of the running sum of any number of sources with optional configuration for widths, saturation behavior, and restarting.
- DivisionRequest
- Describes one signed or unsigned integer division command.
- DivisionResult
- Describes one completed integer division result.
- DotProductBase
- A dot product module for integers.
- DynamicNumericNarrowing
- Runtime-shift counterpart of NumericNarrowing.
- FixedPoint
- A representation of (un)signed fixed-point logic following Q notation (Qm.n format) as introduced by Texas Instruments: (https://www.ti.com/lit/ug/spru565b/spru565b.pdf).
- FixedPointArray
- A fixed-size collection of FixedPoint signals.
-
FixedPointSqrt<
T extends FixedPoint> - Implementation Algorithm explained here; https://projectf.io/posts/square-root-in-verilog/
-
FixedPointSqrtBase<
T extends FixedPoint> - Base class for fixed-point square root
- FixedPointValue
- An immutable representation of (un)signed fixed-point values following Q notation (Qm.n format) as introduced by Texas Instruments: (https://www.ti.com/lit/ug/spru565b/spru565b.pdf).
-
FixedPointValuePopulator<
FxvType extends FixedPointValue> - A populator for FixedPointValues, a utility that can populate various forms of FixedPointValues.
-
FixedToFloat<
T extends FloatingPoint> - FixedToFloat converts a fixed point input to floating point, rounding to nearest even by default. If the input exceeds the floating point range, the output is infinity or the largest finite value, as the rounding mode directs. In a format without infinities, such as FloatingPoint8E4M3, it is always the largest finite value.
- Float8ToFixed
-
Float8ToFixed converts an 8-bit floating point (FP8) input
to a signed fixed-point output following Q notation (Qm.n) as introduced by
(Texas Instruments): (https://www.ti.com/lit/ug/spru565b/spru565b.pdf).
FP8 input must follow E4M3 or E5M2 as described in
(FP8 formats for deep learning): (https://arxiv.org/pdf/2209.05433).
This component offers re-using the same hardware for both FP8 formats.
Infinities and NaN's are not supported.
The output is of type Logic and in two's complement.
It can be cast to a FixedPoint by the consumer based on the mode.
if
modeistrue: Input is treated as E4M3 and converted to Q9.9 - FloatingPoint
- Flexible floating point logic representation.
- FloatingPoint16
- Sixteen-bit floating point representation.
- FloatingPoint16Value
- A representation of an FP16 floating-point value.
- FloatingPoint32
- Single floating point representation.
- FloatingPoint32Value
- A representation of a single-precision floating-point value.
- FloatingPoint32ValuePopulator
- A special type of FloatingPointValuePopulator that adjusts how FloatingPoint32Values are populated.
- FloatingPoint64
- Double floating point representation.
- FloatingPoint64Value
- A representation of a double-precision floating-point value.
- FloatingPoint64ValuePopulator
- A special type of FloatingPointValuePopulator that adjusts how FloatingPoint64Values are populated.
- FloatingPoint8E4M3
- Eight-bit floating point representation for deep learning: E4M3.
- FloatingPoint8E4M3Value
- The E4M3 representation of a 8-bit floating point value as defined in FP8 Formats for Deep Learning.
- FloatingPoint8E5M2
- Eight-bit floating point representation for deep learning: E5M2.
- FloatingPoint8E5M2Value
- The E5M2 representation of a 8-bit floating point value as defined in FP8 Formats for Deep Learning.
-
FloatingPointAdder<
FpTypeIn extends FloatingPoint, FpTypeOut extends FloatingPoint> - An abstract API for floating point adders.
-
FloatingPointAdderDualPath<
FpTypeIn extends FloatingPoint, FpTypeOut extends FloatingPoint> - A fast adder module for variable width FloatingPoint logic signals.
-
FloatingPointAdderSinglePath<
FpTypeIn extends FloatingPoint, FpTypeOut extends FloatingPoint> - A single-path adder implementation for FloatingPoint values.
- FloatingPointBF16
- Sixteen-bit BF16 floating point representation.
- FloatingPointBF16Value
- A representation of a BF16 floating-point value.
- FloatingPointClassifier
- Classifies a floating-point encoding without changing its bit pattern.
- FloatingPointComparator
- Compares two values in the same floating-point format.
-
FloatingPointConditionalSwap<
FpType extends FloatingPoint, MetaType extends Logic> - A module that swaps two floating point values based on a condition.
-
FloatingPointConverter<
FpTypeIn extends FloatingPoint, FpTypeOut extends FloatingPoint> - A converter module between different FloatingPoint logic signals.
-
FloatingPointMultiplier<
FpTypeIn extends FloatingPoint, FpTypeOut extends FloatingPoint> - An abstract API for floating-point multipliers.
-
FloatingPointMultiplierSimple<
FpTypeIn extends FloatingPoint, FpTypeOut extends FloatingPoint> - A multiplier module for FloatingPoint logic.
- FloatingPointRounder
- Determines whether discarded floating-point bits require an increment.
-
FloatingPointSort<
FpType extends FloatingPoint, MetaType extends Logic> - A module that sorts two floating point values, output the larger one first.
-
FloatingPointSortByExp<
FpType extends FloatingPoint, MetaType extends Logic> - A module that sorts two floating point values by exponent output the one with the larger exponent first.
-
FloatingPointSqrt<
FpType extends FloatingPoint> - An abstract API for floating point square root.
-
FloatingPointSqrtSimple<
FpType extends FloatingPoint> - A square root module for FloatingPoint logic signals.
- FloatingPointStatus
- IEEE 754 floating-point exception status.
-
FloatingPointSwap<
FpType extends FloatingPoint, MetaType extends Logic> - A module that swaps two floating point values.
- FloatingPointTF32
- TF32 floating point representation.
- FloatingPointTF32Value
- A representation of a TF32 floating-point value.
- FloatingPointUtilities
- A utility class for floating point operations.
- FloatingPointValue
-
A flexible representation of floating point values. A FloatingPointValue
has a mantissa in
[0,2)with0 <= exponent <= maxExponent();A value which FloatingPointValue.isNormal hasminExponent() <= exponent <= maxExponent()and a mantissa in the range of[1,2). Subnormal numbers are represented with a zero exponent and leading zeros in the mantissa capture the negative exponent value. -
FloatingPointValuePopulator<
FpvType extends FloatingPointValue> - A populator for FloatingPointValues, a utility that can populate various forms of FloatingPointValues.
-
FloatToFixed<
T extends FixedPoint> - FloatToFixed converts a floating point input to a signed fixed-point output following Q notation (Qm.n format) as introduced by (Texas Instruments): (https://www.ti.com/lit/ug/spru565b/spru565b.pdf). Infinities and NaN's are not supported. Conversion is lossless. The output is in two's complement and in Qm.n format where:
- FullAdder
-
A simple full-adder with single-bit inputs
aandbto be added with acarryIn. - GatedCounter
- A version of a Counter which includes ClockGateing and ToggleGateing for power savings.
- GeneralDotProduct
- General version of the DotProductBase module that uses provided Multiplier and Adder functions to construct the dot product computation.
- GeneratePropagate
- Named carry-generation and carry-propagation signals for prefix addition.
- GenericMultiplyAccumulate
-
A MultiplyAccumulate that accepts an arbitrary Multiplier generator
mulGento compute the product of a and b, then genuinely adds c to produce accumulate using an Adder generatoradderGen-- the same pluggable-generator convention already used for the final adder inside CompressionTreeMultiplyAccumulate and CompressionTreeMultiplier. - GfConstantMultiplier
- Combinational multiplication by a compile-time GF constant.
- GfInverse
- A combinational finite-field inverse using fixed-exponent powering.
- GfLogic
- A packed hardware signal representing an element of field.
- GfPolynomialEvaluator
- Combinational Horner evaluator for a GF polynomial.
- GfValue
- An immutable element of a BinaryExtensionField.
- IterativeDividerEngine
- Direct scheduled shell for the iterative multi-cycle divider.
-
KoggeStone<
T extends Logic> - KoggeStone implements the Kogge-Stone shaped ParallelPrefix tree pattern.
- LeadingDigitAnticipate
- Module for predicting the number of leading digits (position of first digit change) before the sum of the two 2s-complement numbers. The leading digit position is either leadingDigit or leadingDigit + 1.
- LeadingZeroAnticipate
- Module for predicting the number of leading zeros (position of leading 1) before an addition or subtraction.
- LeadingZeroAnticipateBase
- Base class for leading-zero anticipate modules.
- LeadingZeroAnticipateCarry
- Module for predicting the number of leading zeros (position of leading 1) before an addition or subtraction.
- Log2Ceil
-
Computes the ceiling of the base-2 logarithm of
inp. - MultiCycleDivider
- The Divider module definition.
- MultiCycleDividerInterface
- Internal interface to the Divider.
- MultiplicandSelector
- A class accessing the multiples of the multiplicand at a position.
- Multiplier
- An abstract class for all multiplier implementations.
- MultiplierEncoder
- A class that generates the Booth encoding of the multipler.
- MultiplyAccumulate
- An abstract class for all multiply accumulate implementations.
- MultiplyOnly
- A subclass of MultiplyAccumulate which ignores the third (c) accumulate term and applies the multiplier function.
- NativeAdder
- A class which wraps the native '+' operator so that it can be passed into other modules as a parameter for using the native operation. Note that NativeAdder is unsigned.
- NativeMultiplier
- A class which wraps the native '*' operator so that it can be passed into other modules as a parameter for using the native operation.
- NoneSignExtension
- A range of SignExtension classes to be used in building new arithmetic building blocks. Start with BruteSignExtension when composing new partial product array shapes as it should work in all situations. A Partial Product Generator using None Sign Extension
- NumericNarrowing
- Right-shifts, rounds, and narrows an unsigned or two's-complement value.
- OnesComplementAdder
- An adder (and subtractor) OnesComplementAdder that operates on ones-complement values, producing a magnitude and sign.
-
ParallelPrefix<
T extends Logic> -
A parallel prefix network retaining the payload type
T. - ParallelPrefixAdder
- Adder based on a typed ParallelPrefix tree.
- ParallelPrefixDecr
- Decrementer based on ParallelPrefix tree.
- ParallelPrefixIncr
- Incrementer based on ParallelPrefix tree.
- ParallelPrefixOrScan
- Or scan based on ParallelPrefix tree.
- ParallelPrefixPriorityFinder
- Priority Finder based on ParallelPrefix tree.
- ParallelPrefixScan
- An inclusive bitwise scan implemented using a ParallelPrefix network.
- PartialProduct
- A PartialProduct module wrapping partial product array manipulation and generation of outputs in an actual module as opposed to an inline generator class.
- PartialProductArray
- A PartialProductArray is a class that holds a set of partial products for manipulation by PartialProductGeneratorBase and column compressor.
- PartialProductGenerator
- A concrete base class for partial product generation
- PartialProductGeneratorBase
- A PartialProductGeneratorBase class that generates a set of partial products. Essentially a set of shifted rows of Logic addends generated by Booth recoding and manipulated by sign extension, before being compressed.
- PartialProductMatrix
- An module API that represents a set of partial products rows including their shifts. This is a base class for the PartialProduct module.
- PartialProductSignExtension
- API for sign extension classes.
- RadixEncode
- A bundle for the leaf radix compute nodes. This holds the multiples of the multiplicand that are needed for encoding.
- RadixEncoder
- Base interface for radix radixEncoder
- ReadyValidCarrySaveMultiplier
- Multiplies paired ready/valid operands with credit-backed admission.
- ReadyValidIterativeDivider
- Exposes an iterative divider as ready/valid command and retained-result channels.
-
Ripple<
T extends Logic> - A ripple shaped ParallelPrefix tree.
- RippleCarryAdder
- An RippleCarryAdder is a digital circuit used for binary addition. It consists of a series of full adders connected in a chain, with the carry output of each adder linked to the carry input of the next one. Starting from the least significant bit (LSB) to most significant bit (MSB), the adder sequentially adds corresponding bits of two binary numbers.
- RoundRNE
- Determines whether rounding-nearest-even requires an increment.
- SignBit
- Store a Signbit as Logic
- SignMagnitudeAdder
- A SignMagnitudeAdder performs addition on values in sign/magnitude format.
- SignMagnitudeAdderBase
- A SignMagnitudeAdderBase performs addition on values in sign/magnitude format.
- SignMagnitudeDualAdder
- A sign-magnitude adder implementation that uses two ones-complement adders wired in opposition to compute the magnitude and sign without using internal twos-complement addition. This will cost more area than a SignMagnitudeAdder but will not require the caller to guarantee the order of inputs or deal with the end-around carry and will be faster than adding the end-around carry to get the correct sum.
- SignMagnitudeValue
- An immutable representation of a sign-magnitude value.
-
SignMagnitudeValuePopulator<
SmvType extends SignMagnitudeValue> - A populator for SignMagnitudeValues, a utility that can populate various forms of SignMagnitudeValues.
-
Sklansky<
T extends Logic> - Sklansky implements the Sklansky-shaped ParallelPrefix tree pattern.
- StopBitsSignExtension
- A StopBits Sign Extension.
- Sum
- Computes a sum of any number of sources with optional configuration for widths and saturation behavior.
- SumInterface
- A PairInterface representing an amount and behavior for inclusion in a sum or count.
- SummationBase
- A base class for modules doing summation operation such as Counter and Sum.
- TrivialCompoundAdder
- A trivial compound adder.
- UnsignedAddWithOverflow
- Adds two unsigned values into a sum of sumWidth bits and reports whether the true sum did not fit in sumWidth bits.
- UnsignedMulWithOverflow
- Multiplies two unsigned values into a product of productWidth bits and reports whether the true product did not fit in productWidth bits.
- ValidOnlyCarrySaveMultiplier
- Multiplies valid-only operands with fixed physical-cycle latency.
Enums
- CompressTermType
- Compress terms
- FixedPointOverflowMode
- Overflow behavior used when converting a fixed-point value to a narrower integer format.
- FloatingPointConstants
- Critical threshold constants
- FloatingPointRoundingMode
- Floating Point Rounding Modes
- GfBasis
- The basis used to represent elements of a binary extension field.
- NumericOverflowMode
- Overflow behavior when a narrowed value is outside its output range.
- NumericRoundingMode
- Rounding policy applied when discarding low-order binary digits.
- PrefixScanDirection
- The direction in which a ParallelPrefixScan accumulates bits.
- PrefixScanOperation
- The associative bitwise operation used by ParallelPrefixScan.
- SignExtension
- Methods for sign extending the PartialProductGeneratorBase
Extensions
- EvaluateLiveColumnCompressor on ColumnCompressor
- Debug routines for printing out ColumnCompressor during simulation with live logic values.
- EvaluateLivePartialProduct on PartialProductGeneratorBase
- Debug routines for printing out partial product matrix during simulation with live logic values.
-
LogicList
on List<
Logic> - Helper evaluation methods for printing aligned arithmetic bitvectors.
- TestPartialProductSignage on PartialProductGeneratorBase
- The following routines are useful only during testing.
Functions
-
currySignExtensionFunction(
SignExtension signExtension) → SignExtensionFunction - Used to test different sign extension methods
-
largestPow2LessThan(
int x) → int - This computes the power of 2 less than x
-
roundBigIntByPowerOfTwo(
BigInt value, int discardedWidth, {required FloatingPointRoundingMode roundingMode}) → BigInt -
Divides
valueby2^[discardedWidth]usingroundingMode.
Typedefs
-
ColumnQueue
= PriorityQueue<
CompressTerm> - A column of partial product terms
-
ParallelPrefixGenerator<
T extends Logic> = ParallelPrefix< T> Function(List<T> inputs, T operation(T left, T right)) -
Constructs a prefix network retaining payload type
T. - PPGFunction = PartialProductGeneratorBase Function(Logic a, Logic b, RadixEncoder radixEncoder, {StaticOrRuntimeParameter? signedMultiplicand, StaticOrRuntimeParameter? signedMultiplier})
- Used to test different sign extension methods.
- SignExtensionFunction = PartialProductSignExtension Function(PartialProductGeneratorBase ppg, {String name})
- Used to test different sign extension methods
Exceptions / Errors
- InfinityNotSupportedException
- An exception thrown when a FloatingPointValue does not support infinity values.