simuhw.float.riscv package

Module contents

simuhw.float.riscv.is_available() bool

Checks whether float subpackage is available or not.

Returns:

True if float subpackage is available.

Note

float subpackage is available only when an appropriate version of softfloatpy module is found. The least version can be retrieved using get_required_softfloatpy_least_version()

class simuhw.float.riscv.FRec7(dtype: type[Float16 | Float32 | Float64 | Float128])

Bases: FPUnaryOperator

A device to estimate a floating-point reciprocal to 7 bits.

This device is intended to be used for emulation of the RISC-V instruction vfrec7.

Available only if an appropriate version of softfloatpy module is found.

__init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None

Creates a device to estimate a floating-point reciprocal.

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. None when starting to make the device work.

Returns:

A tuple of the list of the input ports that are to be watched receive a data word, and the next resuming time in seconds. The next resuming time can be None if resumable anytime.

class simuhw.float.riscv.SIMD_FRec7(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])

Bases: SIMD_FPUnaryOperator

A SIMD device to estimate floating-point reciprocals to 7 bits simultaneously.

This device is intended to be used for emulation of the RISC-V instruction vfrec7.

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 device to estimate floating-point reciprocals.

Parameters:
  • width – The data word width in bits.

  • dtype – The selectable floating-point type or types.

Raises:

ValueError – If width is not divisible by any of dtype sizes.

work(time: float | None) tuple[list[InputPort], float | None]

Makes the device work.

Parameters:

time – The current time in seconds. None when starting to make the device work.

Returns:

A tuple of the list of the input ports that are to be watched receive a data word, and the next resuming time in seconds. The next resuming time can be None if resumable anytime.

class simuhw.float.riscv.FRSqrt7(dtype: type[Float16 | Float32 | Float64 | Float128])

Bases: FPUnaryOperator

A device to estimate a floating-point reciprocal square-root to 7 bits.

This device is intended to be used for emulation of the RISC-V instruction vfrsqrt7.

Available only if an appropriate version of softfloatpy module is found.

__init__(dtype: type[Float16 | Float32 | Float64 | Float128]) None

Creates a device to estimate a floating-point reciprocal square-root.

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. None when starting to make the device work.

Returns:

A tuple of the list of the input ports that are to be watched receive a data word, and the next resuming time in seconds. The next resuming time can be None if resumable anytime.

class simuhw.float.riscv.SIMD_FRSqrt7(width: int, dtype: type[Float16 | Float32 | Float64 | Float128] | Iterable[type[Float16 | Float32 | Float64 | Float128]])

Bases: SIMD_FPUnaryOperator

A SIMD device to estimate floating-point reciprocal square-roots to 7 bits simultaneously.

This device is intended to be used for emulation of the RISC-V instruction vfrsqrt7.

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 device to estimate floating-point reciprocal square-roots.

Parameters:
  • width – The data word width in bits.

  • dtype – The selectable floating-point type or types.

Raises:

ValueError – If width is not divisible by any of dtype sizes.

work(time: float | None) tuple[list[InputPort], float | None]

Makes the device work.

Parameters:

time – The current time in seconds. None when starting to make the device work.

Returns:

A tuple of the list of the input ports that are to be watched receive a data word, and the next resuming time in seconds. The next resuming time can be None if resumable anytime.