simuhw.fp package
Subpackages
Module contents
- simuhw.fp.is_available() bool
Checks whether
simuhw.fpsubmodule is available or not.- Returns:
Trueifsimuhw.fpsubmodule is available.
Note
simuhw.fpsubmodule is available only when an appropriate version of softfloatpy module is found. The least version can be retrieved usingget_required_softfloatpy_least_version()
- simuhw.fp.get_required_softfloatpy_least_version() str
Retrieves the least version of softfloatpy module required for
simuhw.fpsubmodule.- Returns:
The least version of softfloatpy module required for
simuhw.fpsubmodule.
- simuhw.fp.raise_exception_if_not_available() None
Raises an exception if
simuhw.fpsubmodule is not available.- Raises:
RuntimeError – If
simuhw.fpsubmodule is not available.
Note
simuhw.fpsubmodule is available only when an appropriate version of softfloatpy module is found. The least version can be retrieved usingget_required_softfloatpy_least_version()
- class simuhw.fp.TininessMode(value)
Bases:
IntFlagThe tininess detection modes.
BEFORE_ROUNDING: Detecting tininess before rounding.AFTER_ROUNDING: Detecting tininess after rounding.
- BEFORE_ROUNDING = 0
- AFTER_ROUNDING = 1
- class simuhw.fp.RoundingMode(value)
Bases:
IntFlagThe rounding modes.
NEAR_EVEN: Rounding to nearest, with ties to even.NEAR_MAX_MAG: Rounding to nearest, with ties to maximum magnitude (away from zero).MIN_MAG: Rounding to minimum magnitude (toward zero).MIN: Rounding to minimum (down).MAX: Rounding to maximum (up).
- NEAR_EVEN = 0
- MIN_MAG = 1
- MIN = 2
- MAX = 3
- NEAR_MAX_MAG = 4
- class simuhw.fp.ExceptionFlag(value)
Bases:
IntFlagThe floating-point exception flags.
INEXACT: The exception set if the rounded value is different from the mathematically exact result of the operation.UNDERFLOW: The exception set if the rounded value is tiny and inexact.OVERFLOW: The exception set if the absolute value of the rounded value is too large to be represented.INFINITE: The exception set if the result is infinite given finite operands.INVALID: The exception set if a finite or infinite result cannot be returned.
- INEXACT = 1
- UNDERFLOW = 2
- OVERFLOW = 4
- INFINITE = 8
- INVALID = 16
- class simuhw.fp.Float16
Bases:
Float16An IEEE 754 binary16 floating point data type.
- class simuhw.fp.Float32
Bases:
Float32An IEEE 754 binary32 floating point data type.
- class simuhw.fp.Float64
Bases:
Float64An IEEE 754 binary64 floating point data type.
- class simuhw.fp.Float128
Bases:
Float128An IEEE 754 binary128 floating point data type.
- simuhw.fp.dsize_to_dtype(dsize: int) type[Float16 | Float32 | Float64 | Float128]
Returns a floating-point type that has the specified data size.
- Parameters:
dsize – The data size in bits.
- Returns:
A floating-point type that has the specified data size.
- Raises:
ValueError – If no floating-point type that has the specified data size.
- class simuhw.fp.FPState
Bases:
objectA class that manipulates the floating-point states.
- __init__() None
Creates a class that manipulates the floating-point states.
- apply_states() None
Applies the floating-point states from the input ports after saving the current ones.
- property port_fe_o: OutputPort
The output port to get the floating-point exception flags.
- reset() None
Resets the states.
- restore_states(time: float, not_bytes: bool) None
Restores the floating-point states after posting the current ones to the output port.
- Parameters:
time – The current device time in seconds.
not_bytes –
Trueif the type of the output word is notbytes.
- width_fe: int = 5
The bit width of the input and output ports to set and get floating-point exception flags.
- width_fr: int = 3
The bit width of the input port to set rounding mode.
- width_ft: int = 1
The bit width of the input port to set tininess detection mode.
- class simuhw.fp.FPUnaryOperator(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
UnaryOperator,FPStateThe super class for all floating-point unary operators.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point unary operators.
- Parameters:
dtype – The floating-point type.
- reset() None
Resets the states.
- class simuhw.fp.FPBinaryOperator(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
BinaryOperator,FPStateThe super class for all floating-point binary operators.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point binary operators.
- Parameters:
dtype – The floating-point type.
- reset() None
Resets the states.
- class simuhw.fp.FPTernaryOperator(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
TernaryOperator,FPStateThe super class for all floating-point ternary operators.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point ternary operators.
- Parameters:
dtype – The floating-point type.
- reset() None
Resets the states.
- class simuhw.fp.SIMD_FPUnaryOperator(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_UnaryOperator,FPStateThe super class for all SIMD floating-point unary operators.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point unary operators.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- reset() None
Resets the states.
- class simuhw.fp.SIMD_FPBinaryOperator(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_BinaryOperator,FPStateThe super class for all SIMD floating-point binary operators.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point binary operators.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- reset() None
Resets the states.
- class simuhw.fp.SIMD_FPTernaryOperator(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_TernaryOperator,FPStateThe super class for all SIMD floating-point ternary operators.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point ternary operators.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- reset() None
Resets the states.
- class simuhw.fp.FPNegator(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPUnaryOperatorA floating-point negator.
This device negates the floating-point value.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point negator.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPNegator(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPUnaryOperatorA SIMD floating-point negator.
This device negates the respective sign of multiple floating-point values simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point negator.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPAdder(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPBinaryOperatorA floating-point adder.
This device calculates an addition of two floating-point values.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point adder.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPAdder(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPBinaryOperatorA SIMD floating-point adder.
This device calculates respective additions of multiple pairs of floating-point values simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point adder.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPSubtractor(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPBinaryOperatorA floating-point subtractor.
This device calculates a subtraction of two floating-point values.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point subtractor.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPSubtractor(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPBinaryOperatorA SIMD floating-point subtractor.
This device calculates respective subtractions of multiple pairs of floating-point values simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point subtractor.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPMultiplier(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPBinaryOperatorA floating-point multiplier.
This device calculates a multiplication of two floating-point values.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point multiplier.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPMultiplier(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPBinaryOperatorA SIMD floating-point multiplier.
This device calculates respective multiplications of multiple pairs of floating-point values simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point multiplier.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPMultiplyAdder(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPTernaryOperatorA floating-point fused multiply-adder.
This device calculates a fused multiply-add of three floating-point values (
x * y + z).Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point fused multiply-adder.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPMultiplyAdder(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPTernaryOperatorA SIMD floating-point fused multiply-adder.
This device calculates respective fused multiply-add of multiple couples of floating-point values simultaneously (
x * y + z).Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point fused multiply-adder.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPDivider(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPBinaryOperatorA floating-point divider.
This device calculates a division of two floating-point values.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point divider.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPDivider(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPBinaryOperatorA SIMD floating-point divider.
This device calculates respective divisions of multiple pairs of floating-point values simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point divider.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPRemainder(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPBinaryOperatorA floating-point remainder calculator.
This device calculates a remainder of two floating-point values.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point remainder calculator.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPRemainder(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPBinaryOperatorA SIMD floating-point remainder calculator.
This device calculates respective remainders of multiple pairs of floating-point values simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point remainder calculator.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPSquareRoot(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPUnaryOperatorA floating-point square root calculator.
This device calculates the square root of the floating-point value.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point square root calculator.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPSquareRoot(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPUnaryOperatorA SIMD floating-point square root calculator.
This device calculates the respective square root of multiple floating-point values simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point square root calculator.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPComparator(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPBinaryOperatorA floating-point comparator.
This device compares two floating-point values. The result is an integer -1 if the first value is less than the second one, 1 if the first value is greater than the second one, or 0 otherwise. The result integer has the same number of bits as the input floating-points.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point comparator.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPComparator(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPBinaryOperatorA SIMD floating-point comparator.
This device compares multiple respective pairs of floating-point values simultaneously. Each result is an integer -1 if the first value is less than the second one, 1 if the first value is greater than the second one, or 0 otherwise. Each result integer has the same number of bits as the input floating-points.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point comparator.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPClassifier(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPUnaryOperatorA floating-point classifier.
This device classifies the floating-point value. The result is an integer 1 if the value is an infinity, 2 if the value is a signaling NaN, 3 if the value is a quiet NaN, or 0 otherwise. The result integer has the same number of bits as the input floating-points.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point classifier.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPClassifier(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPUnaryOperatorA SIMD floating-point classifier.
This device classifies multiple respective floating-point values simultaneously. Each result is an integer 1 if the value is an infinity, 2 if the value is a signaling NaN, 3 if the value is a quiet NaN, or 0 otherwise. Each result integer has the same number of bits as the input floating-points.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point classifier.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPToIntegerRounder(dtype: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPUnaryOperatorA floating-point to integer rounder.
This device rounds the floating-point value to an integer value as the same floating-point type.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point to integer rounder.
- Parameters:
dtype – The floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPToIntegerRounder(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])
Bases:
SIMD_FPUnaryOperatorA SIMD floating-point to integer rounder.
This device rounds the respective floating-point values to integer values as the same floating-point type simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]]) None
Creates a SIMD floating-point to integer rounder.
- Parameters:
width – The total width of words in bits.
dtype – The selectable floating-point type or types.
- Raises:
ValueError – If
widthis not divisible by any ofdtypesizes.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPToIntegerConverter(dtype_i: type[Float16 | Float32 | Float64 | Float128], width_o: int)
Bases:
UnaryOperator,FPStateA floating-point to integer converter.
This device converts the floating-point to an unsigned integer.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype_i: type[Float16 | Float32 | Float64 | Float128], width_o: int) None
Creates a floating-point to integer converter.
- Parameters:
dtype_i – The input floating-point type.
width_o – The output word width in bits. Must be less than or equal to the value of
FPToIntegerConverter.max_width().
- Raises:
ValueError – If
width_ois greater than the value ofFPToIntegerConverter.max_width().
- classmethod max_width() int
The maximum supported integer width in bits.
Currently, it is 64.
- reset() None
Resets the states.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPToIntegerConverter(multi: int, dtype_i: type[Float16 | Float32 | Float64 | Float128], dsize_o: int)
Bases:
SIMD_UnaryOperator,FPStateA SIMD floating-point to integer converter.
This device converts the respective floating-points to unsigned integers simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(multi: int, dtype_i: type[Float16 | Float32 | Float64 | Float128], dsize_o: int) None
Creates a SIMD floating-point to integer converter.
- Parameters:
multi – The number of SIMD elements.
dtype_i – The input floating-point type.
dsize_o – The output word width in bits. Must be less than or equal to the value of
FPToIntegerConverter.max_width().
- Raises:
ValueError – If
width_ois greater than the value ofFPToIntegerConverter.max_width().
- reset() None
Resets the states.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPFromIntegerConverter(width_i: int, dtype_o: type[Float16 | Float32 | Float64 | Float128])
Bases:
UnaryOperator,FPStateA integer to floating-point converter.
This device converts the unsigned integer to a floating-point.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width_i: int, dtype_o: type[Float16 | Float32 | Float64 | Float128]) None
Creates a integer to floating-point converter.
- Parameters:
width_i – The input word width in bits.
dtype_o – The output floating-point type.
- reset() None
Resets the states.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPFromIntegerConverter(multi: int, dsize_i: int, dtype_o: type[Float16 | Float32 | Float64 | Float128])
Bases:
SIMD_UnaryOperator,FPStateA SIMD integer to floating-point converter.
This device converts the respective unsigned integers to floating-points simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(multi: int, dsize_i: int, dtype_o: type[Float16 | Float32 | Float64 | Float128]) None
Creates a SIMD integer to floating-point converter.
- Parameters:
multi – The number of SIMD elements.
dsize_i – The input word width in bits.
dtype_o – The output floating-point type.
- reset() None
Resets the states.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPToSignedIntegerConverter(dtype_i: type[Float16 | Float32 | Float64 | Float128], width_o: int)
Bases:
FPToIntegerConverterA floating-point to signed-integer converter.
This device converts the floating-point to a signed integer.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype_i: type[Float16 | Float32 | Float64 | Float128], width_o: int) None
Creates a floating-point to signed-integer converter.
- Parameters:
dtype_i – The input floating-point type.
width_o – The output word width in bits. Must be less than or equal to the value of
FPToIntegerConverter.max_width().
- Raises:
ValueError – If
width_ois greater than the value ofFPToIntegerConverter.max_width().
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPToSignedIntegerConverter(multi: int, dtype_i: type[Float16 | Float32 | Float64 | Float128], dsize_o: int)
Bases:
SIMD_FPToIntegerConverterA SIMD floating-point to signed-integer converter.
This device converts the respective floating-points to signed integers simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(multi: int, dtype_i: type[Float16 | Float32 | Float64 | Float128], dsize_o: int) None
Creates a SIMD floating-point to signed-integer converter.
- Parameters:
multi – The number of SIMD elements.
dtype_i – The input floating-point type.
dsize_o – The output word width in bits. Must be less than or equal to the value of
FPToIntegerConverter.max_width().
- Raises:
ValueError – If
width_ois greater than the value ofFPToIntegerConverter.max_width().
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPFromSignedIntegerConverter(width_i: int, dtype_o: type[Float16 | Float32 | Float64 | Float128])
Bases:
FPFromIntegerConverterA signed-integer to floating-point converter.
This device converts the signed integer to a floating-point.
Available only if an appropriate version of softfloatpy module is found.
- __init__(width_i: int, dtype_o: type[Float16 | Float32 | Float64 | Float128]) None
Creates a signed-integer to floating-point converter.
- Parameters:
width_i – The input word width in bits.
dtype_o – The output floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPFromSignedIntegerConverter(multi: int, dsize_i: int, dtype_o: type[Float16 | Float32 | Float64 | Float128])
Bases:
SIMD_FPFromIntegerConverterA SIMD signed-integer to floating-point converter.
This device converts the respective signed integers to floating-points simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(multi: int, dsize_i: int, dtype_o: type[Float16 | Float32 | Float64 | Float128]) None
Creates a SIMD signed-integer to floating-point converter.
- Parameters:
multi – The number of SIMD elements.
dsize_i – The input word width in bits.
dtype_o – The output floating-point type.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.FPConverter(dtype_i: type[Float16 | Float32 | Float64 | Float128], dtype_o: type[Float16 | Float32 | Float64 | Float128])
Bases:
UnaryOperator,FPStateA floating-point converter.
This device converts the floating-point to that of another type.
Available only if an appropriate version of softfloatpy module is found.
- __init__(dtype_i: type[Float16 | Float32 | Float64 | Float128], dtype_o: type[Float16 | Float32 | Float64 | Float128]) None
Creates a floating-point converter.
- Parameters:
dtype_i – The input floating-point type.
dtype_o – The output floating-point type.
- reset() None
Resets the states.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.
- class simuhw.fp.SIMD_FPConverter(multi: int, dtype_i: type[Float16 | Float32 | Float64 | Float128], dtype_o: type[Float16 | Float32 | Float64 | Float128])
Bases:
SIMD_UnaryOperator,FPStateA SIMD floating-point converter.
This device converts the respective floating-points to those of another type simultaneously.
Available only if an appropriate version of softfloatpy module is found.
- __init__(multi: int, dtype_i: type[Float16 | Float32 | Float64 | Float128], dtype_o: type[Float16 | Float32 | Float64 | Float128]) None
Creates a SIMD floating-point converter.
- Parameters:
multi – The number of SIMD elements.
dtype_i – The input floating-point type.
dtype_o – The output floating-point type.
- reset() None
Resets the states.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds.
Nonewhen starting to make the device work.- Returns:
A tuple of the list of the input ports that are to be watched receive a signal, and the next resuming time in seconds. The next resuming time can be
Noneif resumable anytime.