|
CIRCT 23.0.0git
|
Root class of the ESI type system. More...
#include <Types.h>


Public Types | |
| using | ID = std::string |
Public Member Functions | |
| Type (const ID &id) | |
| virtual | ~Type ()=default |
| ID | getID () const |
| virtual std::ptrdiff_t | getBitWidth () const |
| void | setHWBitwidth (std::ptrdiff_t bw) |
| Set from manifest JSON hwBitwidth. | |
| virtual MutableBitVector | serialize (const std::any &obj) const |
| Serialize an object to a MutableBitVector (LSB-first stream). | |
| virtual std::any | deserialize (BitVector &data) const |
| Deserialize from a BitVector stream (LSB-first). | |
| std::any | deserialize (const MessageData &data) const |
| virtual void | ensureValid (const std::any &obj) const |
| Ensure that a std::any object is valid for this type. | |
| 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 |
Protected Attributes | |
| ID | id |
| std::ptrdiff_t | hwBitwidth = -1 |
| using esi::Type::ID = std::string |
|
virtualdefault |
|
inlinevirtual |
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 in esi::ChannelType, esi::VoidType, esi::TypeAliasType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, esi::ArrayType, esi::UnionType, esi::ChannelType, esi::VoidType, esi::TypeAliasType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, esi::ArrayType, and esi::UnionType.
Definition at line 60 of file Types.h.
Referenced by esi::ChannelType::deserialize(), esi::TypeAliasType::deserialize(), esi::StructType::deserialize(), esi::ArrayType::deserialize(), and deserialize().
|
inline |
Definition at line 67 of file Types.h.
References deserialize().
| void esi::Type::dump | ( | std::ostream & | os, |
| bool | oneLine = false |
||
| ) | const |
|
inlinevirtual |
Ensure that a std::any object is valid for this type.
Throws std::runtime_error if the object is not valid.
Reimplemented in esi::ChannelType, esi::VoidType, esi::TypeAliasType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, esi::ArrayType, and esi::UnionType.
Definition at line 74 of file Types.h.
Referenced by esi::ChannelType::ensureValid(), esi::TypeAliasType::ensureValid(), esi::ArrayType::ensureValid(), and isValid().
|
inlinevirtual |
Reimplemented in esi::BundleType, esi::ChannelType, esi::VoidType, esi::AnyType, esi::TypeAliasType, esi::BitVectorType, esi::StructType, esi::ArrayType, esi::WindowType, esi::UnionType, and esi::ListType.
Definition at line 43 of file Types.h.
References hwBitwidth.
Referenced by esi::ChannelType::getBitWidth(), esi::TypeAliasType::getBitWidth(), esi::ArrayType::getBitWidth(), esi::WindowType::getBitWidth(), esi::ChannelPort::getFrameSizeBytes(), and esi::ChannelPort::TranslationInfo::precomputeFrameInfo().
|
inline |
Definition at line 42 of file Types.h.
References id.
Referenced by esi::dumpType(), NB_MODULE(), esi::Context::registerType(), and esi::verifyTypeCompatibility().
|
inline |
Definition at line 80 of file Types.h.
References ensureValid().
|
inlinevirtual |
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 in esi::ChannelType, esi::VoidType, esi::TypeAliasType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, esi::ArrayType, and esi::UnionType.
Definition at line 53 of file Types.h.
Referenced by esi::ChannelType::serialize(), esi::TypeAliasType::serialize(), esi::StructType::serialize(), esi::ArrayType::serialize(), and esi::UnionType::serialize().
|
inline |
Set from manifest JSON hwBitwidth.
Allows types without specialized parsers (e.g. union types) to still report their width.
Definition at line 47 of file Types.h.
References hwBitwidth.
| std::string esi::Type::toString | ( | bool | oneLine = false | ) | const |
Definition at line 120 of file Types.cpp.
References dump().
Referenced by esi::WriteChannelPort::getMessageFrames(), esi::Context::registerType(), esi::services::ChannelService::ToHost::toString(), esi::services::ChannelService::FromHost::toString(), esi::services::FuncService::Function::toString(), esi::services::CallService::Callback::toString(), esi::services::TelemetryService::Metric::toString(), and esi::verifyTypeCompatibility().
|
protected |
Definition at line 97 of file Types.h.
Referenced by getBitWidth(), and setHWBitwidth().
|
protected |
Definition at line 96 of file Types.h.
Referenced by esiaccel.types.ESIType::__eq__(), and getID().