FltPt¶
FltPt[G,E] represents an arbitrary precision, IEEE-754-like representation. FltPt values are always assumed to be signed.
The type parameters for FltPt are:
| G | INT | Number of significand bits, including sign bit | (_2 - _64) |
| E | INT | Number of exponent bits | (_1 - _64) |
Note that numbers of bits use the underscore prefix as integers cannot be used as type parameters in Scala.
Type Aliases
Specific types of FltPt values can be managed using type aliases. New type aliases can be created using::
type MyType = FltPt[_##,_##]
Spatial defines the following type aliases by default:
| type | Half | FltPt[_11,_5] | IEEE-754 half precision |
| type | Float | FltPt[_24,_8] | IEEE-754 single precision |
| type | Double | FltPt[_53,_11] | IEEE-754 double precision |
Note that the Float and Double types shadow their respective unstaged Scala types. In the case where an unstaged type is required, use the full scala.* name.
Infix methods
| class FltPt[G,E] | |
|---|---|
def unary_-(): FltPt[G,E]
Returns the negation of this floating point value.
|
|
def \*\*(exp: scala.Int): FltPt[G,E]
Integer exponentiation, implemented in hardware as a reduction tree with exp inputs.
|
|
def < (that: FltPt[G,E]): MBoolean
Less than comparison.
Returns true if this value is less than that value. Otherwise returns false.
|
|
def <=(that: FltPt[G,E]): MBoolean
Less than or equal comparison.
Returns true if this value is less than or equal to that value. Otherwise returns false.
|
|
def > (that: FltPt[G,E]): MBoolean
Greater than comparison.
Returns true if this value is greater than that value. Otherwise returns false.
|
|
def >=(that: FltPt[G,E]): MBoolean
Greater than or equal comparison.
Returns true if this value is less than that value. Otherwise returns false.
|
|
def apply(i: scala.Int): Bit
Returns the given bit in this value.
0 corresponds to the least significant bit (LSB).
|
|
def reverse: FltPt[G,E]
Returns a floating point value with this value’s bits in reverse order.
|
|
def toString: String
Creates a printable String representation of this value.
NOTE: This method is unsynthesizable, and can be used only on the CPU or in simulation.
|