Deeploy.AbstractDataTypes.IntegerImmediate

class Deeploy.AbstractDataTypes.IntegerImmediate(value: int | float | Immediate, ctxt: _NetworkContext | None = None)

Bases: Immediate[int | Iterable[int], Immediate]

Methods

__init__(value: int | float | Immediate, ctxt: _NetworkContext | None = None)

__init__(value[, ctxt])

checkPromotion(value[, ctxt])

Checks whether a given Python-typed or Deeploy-typed value can be represented with the Deeploy type

checkValue(value[, ctxt])

Checks whether a given Python-type value (usually FP64) can be represented with a Deeploy type

partialOrderUpcast(otherCls)

This method checks whether a data type (cls) can be used to represent any value that can be represented by another data type (otherCls).

Attributes

value

typeMax

Represents the largest possible representable value, i.e. 2^{typeWidth}-1 for unsigned values and 2^{typeWidth-1}-1 for signed values.

typeMin

Represenst the smallest possible representable value, i.e. 0 for unsigned values and -2^{typeWidth-1} for signed values.

signed

Represents whether the underlying integer is signed or unsigned

typeName

The C typename of this type

typeWidth

the number of BITS to be assigned to the type

signed: bool

Represents whether the underlying integer is signed or unsigned

Type:

bool

typeMax: int

Represents the largest possible representable value, i.e. 2^{typeWidth}-1 for unsigned values and 2^{typeWidth-1}-1 for signed values.

Type:

int

typeMin: int

Represenst the smallest possible representable value, i.e. 0 for unsigned values and -2^{typeWidth-1} for signed values.

Type:

int

classmethod partialOrderUpcast(otherCls: Type[Immediate]) bool

This method checks whether a data type (cls) can be used to represent any value that can be represented by another data type (otherCls). For more information on partial order sets and type conversion, check:https://en.wikipedia.org/wiki/Partially_ordered_set https://en.wikipedia.org/wiki/Type_conversion

Parameters:

otherCls (Type[Immediate]) – The class you want to upcast an immediate of this cls to

Returns:

Returns true if this cls can be statically promoted to otherCls

Return type:

bool

classmethod checkValue(value: int | Iterable[int] | ndarray, ctxt: _NetworkContext | None = None)

Checks whether a given Python-type value (usually FP64) can be represented with a Deeploy type

Parameters:
  • value (_PythonType) – Python-typed value to check

  • ctxt (Optional[_NetworkContext]) – Current NetworkContext

Returns:

Returns true if value can represented by cls

Return type:

bool

classmethod checkPromotion(value: _PythonType | Immediate, ctxt: _NetworkContext | None = None)

Checks whether a given Python-typed or Deeploy-typed value can be represented with the Deeploy type

Parameters:
  • value (Union[_PythonType, _DeeployType]) – Python-typed or Deeploy-typed value to be checked for promotion to cls

  • ctxt (Optional[_NetworkContext]) – Current NetworkContext

Returns:

Returns true if the value can be promoted to cls

Return type:

bool

typeName: str

The C typename of this type

Type:

str

typeWidth: int

the number of BITS to be assigned to the type

Type:

int