CIRCT 24.0.0git
Loading...
Searching...
No Matches
esi::ArrayType Class Reference

Arrays have a compile time specified (static) size and an element type. More...

#include <Types.h>

Inheritance diagram for esi::ArrayType:
Collaboration diagram for esi::ArrayType:

Public Member Functions

 ArrayType (const ID &id, const Type *elementType, uint64_t size, bool reverse=true)
const Type * getElementType () const
uint64_t getSize () const
bool isReverse () const
std::ptrdiff_t getBitWidth () const override
void ensureValid (const std::any &obj) const override
 Ensure that a std::any object is valid for this type.
MutableBitVector serialize (const std::any &obj) const override
 Serialize an object to a MutableBitVector (LSB-first stream).
std::any deserialize (BitVector &data) const override
 Deserialize from a BitVector stream (LSB-first).
std::any deserialize (const MessageData &data) const
Public Member Functions inherited from esi::Type
 Type (const ID &id)
virtual ~Type ()=default
ID getID () const
void setHWBitwidth (std::ptrdiff_t bw)
 Set from manifest JSON hwBitwidth.
std::any deserialize (const MessageData &data) const
std::optional< std::string > isValid (const std::any &obj) const
void dump (std::ostream &os, bool oneLine=false) const
std::string toString (bool oneLine=false) const

Private Attributes

const Type * elementType
uint64_t size
bool reverse

Additional Inherited Members

Public Types inherited from esi::Type
using ID = std::string
Protected Attributes inherited from esi::Type
ID id
std::ptrdiff_t hwBitwidth = -1

Detailed Description

Arrays have a compile time specified (static) size and an element type.

Definition at line 301 of file Types.h.

Constructor & Destructor Documentation

◆ ArrayType()

esi::ArrayType::ArrayType ( const ID & id,
const Type * elementType,
uint64_t size,
bool reverse = true )
inline

Definition at line 303 of file Types.h.

References elementType, esi::Type::id, reverse, size, and esi::Type::Type().

Member Function Documentation

◆ deserialize() [1/2]

std::any esi::ArrayType::deserialize ( BitVector & data) const
overridevirtual

Deserialize from a BitVector stream (LSB-first).

Implementations consume bits from 'data' in-place (via logical right shifts) and return the reconstructed value. Remaining bits stay in 'data'.

Reimplemented from esi::Type.

Definition at line 433 of file Types.cpp.

References elementType, isReverse(), and size.

◆ deserialize() [2/2]

std::any esi::Type::deserialize ( const MessageData & data) const
inline

Definition at line 67 of file Types.h.

◆ ensureValid()

void esi::ArrayType::ensureValid ( const std::any & obj) const
overridevirtual

Ensure that a std::any object is valid for this type.

Throws std::runtime_error if the object is not valid.

Reimplemented from esi::Type.

Definition at line 391 of file Types.cpp.

References elementType, and size.

Referenced by serialize().

◆ getBitWidth()

std::optional< int64_t > hw::ArrayType::getBitWidth ( ) const
inlineoverridevirtual

Reimplemented from esi::Type.

Definition at line 311 of file Types.h.

References elementType, and size.

◆ getElementType()

const Type * esi::ArrayType::getElementType ( ) const
inline

Definition at line 308 of file Types.h.

References elementType, and esi::Type::Type().

Referenced by NB_MODULE().

◆ getSize()

uint64_t esi::ArrayType::getSize ( ) const
inline

Definition at line 309 of file Types.h.

References size.

Referenced by NB_MODULE().

◆ isReverse()

bool esi::ArrayType::isReverse ( ) const
inline

Definition at line 310 of file Types.h.

References reverse.

Referenced by deserialize(), and serialize().

◆ serialize()

MutableBitVector esi::ArrayType::serialize ( const std::any & obj) const
overridevirtual

Serialize an object to a MutableBitVector (LSB-first stream).

The object should be passed via std::any. Implementations append fields in the order they are iterated (the first serialized field occupies the least-significant bits of the result).

Reimplemented from esi::Type.

Definition at line 414 of file Types.cpp.

References elementType, ensureValid(), and isReverse().

Member Data Documentation

◆ elementType

const Type* esi::ArrayType::elementType
private

Definition at line 323 of file Types.h.

Referenced by ArrayType(), deserialize(), ensureValid(), getBitWidth(), getElementType(), and serialize().

◆ reverse

bool esi::ArrayType::reverse
private

Definition at line 328 of file Types.h.

Referenced by ArrayType(), and isReverse().

◆ size

uint64_t esi::ArrayType::size
private

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