Deeploy.AbstractDataTypes.BaseType

class Deeploy.AbstractDataTypes.BaseType(typeName: str, typeWidth: int)

Bases: Generic[_PythonType, _DeeployType], _SlotPickleMixin

Deeploy abstraction to represent data types that can be expressed in the C language

Methods

__init__(typeName: str, typeWidth: int) None

__init__(typeName, typeWidth)

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

Attributes

value

typeName

The C typename of this type

typeWidth

the number of BITS to be assigned to the type

typeName: str

The C typename of this type

Type:

str

typeWidth: int

the number of BITS to be assigned to the type

Type:

int

abstract classmethod checkValue(value: _PythonType, ctxt: _NetworkContext | None = None) bool

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

abstract classmethod checkPromotion(value: _PythonType | _DeeployType, ctxt: _NetworkContext | None = None) bool

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