CIRCT 24.0.0git
Loading...
Searching...
No Matches
esiaccel.types.StructType Class Reference
Inheritance diagram for esiaccel.types.StructType:
Collaboration diagram for esiaccel.types.StructType:

Public Member Functions

 __init__ (self, str id, List[Tuple[str, "ESIType"]] fields)
Tuple[bool, Optional[str]] is_valid (self, obj)
bytearray serialize (self, obj)
Tuple[Dict[str, Any], bytearray] deserialize (self, bytearray data)
Public Member Functions inherited from esiaccel.types.ESIType
 __init__ (self, str id)
 wrap_cpp (cls, cpp.Type cpp_type)
str id (self)
Tuple[bool, Optional[str]] supports_host (self)
int bit_width (self)
int max_size (self)
int __hash__ (self)
bool __eq__ (self, other)
str __str__ (self)

Public Attributes

list fields = [(name, _get_esi_type(ty)) for (name, ty) in cpp_type.fields]
Public Attributes inherited from esiaccel.types.ESIType
 cpp_type = cpp_type
str id

Protected Member Functions

 _init_from_cpp (self, cpp.StructType cpp_type)

Detailed Description

Definition at line 300 of file types.py.

Constructor & Destructor Documentation

◆ __init__()

esiaccel.types.StructType.__init__ ( self,
str id,
List[Tuple[str, "ESIType"]] fields )

Definition at line 302 of file types.py.

References esiaccel.types.ESIType._init_from_cpp().

Member Function Documentation

◆ _init_from_cpp()

esiaccel.types.StructType._init_from_cpp ( self,
cpp.StructType cpp_type )
protected
Initialize instance attributes from a C++ type object.

Reimplemented from esiaccel.types.ESIType.

Definition at line 307 of file types.py.

References _init_from_cpp().

Referenced by _init_from_cpp().

◆ deserialize()

Tuple[Dict[str, Any], bytearray] esiaccel.types.StructType.deserialize ( self,
bytearray data )
Convert a bytearray to a Python object. Return the object and the
leftover bytes.

Reimplemented from esiaccel.types.ESIType.

Definition at line 342 of file types.py.

References esiaccel.types.ESIType.cpp_type, circt::om::evaluator::ObjectValue.fields, esi::StructType.fields, esi::UnionType.fields, esi::WindowType::Frame.fields, and fields.

◆ is_valid()

Tuple[bool, Optional[str]] esiaccel.types.StructType.is_valid ( self,
obj )
Is a Python object compatible with HW type?  Returns either '(True,
None)' if it is, or '(False, reason)' if it is not.

Reimplemented from esiaccel.types.ESIType.

Definition at line 313 of file types.py.

References circt::om::evaluator::ObjectValue.fields, esi::StructType.fields, esi::UnionType.fields, esi::WindowType::Frame.fields, and fields.

◆ serialize()

bytearray esiaccel.types.StructType.serialize ( self,
obj )

Member Data Documentation

◆ fields

list esiaccel.types.StructType.fields = [(name, _get_esi_type(ty)) for (name, ty) in cpp_type.fields]

The documentation for this class was generated from the following file: