29 using ID = std::string;
49 std::vector<std::tuple<std::string, Direction, const Type *>>;
57 std::pair<const Type *, Direction>
findChannel(std::string name)
const {
58 for (
auto [channelName, dir, type] :
channels)
59 if (channelName == name)
60 return std::make_pair(type, dir);
61 throw std::runtime_error(
"Channel '" + name +
"' not found in bundle");
127 using IntegerType::IntegerType;
133 using IntegerType::IntegerType;
139 using FieldVector = std::vector<std::pair<std::string, const Type *>>;
146 std::ptrdiff_t size = 0;
148 std::ptrdiff_t fieldSize = ty->getBitWidth();
172 return elementSize *
size;
The "any" type is a special type which can be used to represent any type, as identified by the type i...
std::ptrdiff_t getBitWidth() const override
Arrays have a compile time specified (static) size and an element type.
ArrayType(const ID &id, const Type *elementType, uint64_t size)
const Type * getElementType() const
std::ptrdiff_t getBitWidth() const override
Bit vectors include signed, unsigned, and signless integers.
BitVectorType(const ID &id, uint64_t width)
std::ptrdiff_t getBitWidth() const override
uint64_t getWidth() const
Bits are just an array of bits.
Bundles represent a collection of channels.
BundleType(const ID &id, const ChannelVector &channels)
std::pair< const Type *, Direction > findChannel(std::string name) const
std::ptrdiff_t getBitWidth() const override
const ChannelVector & getChannels() const
std::vector< std::tuple< std::string, Direction, const Type * > > ChannelVector
Channels are the basic communication primitives.
ChannelType(const ID &id, const Type *inner)
const Type * getInner() const
std::ptrdiff_t getBitWidth() const override
Integers are bit vectors which may be signed or unsigned and are interpreted as numbers.
Structs are an ordered collection of fields, each with a name and a type.
std::ptrdiff_t getBitWidth() const override
std::vector< std::pair< std::string, const Type * > > FieldVector
StructType(const ID &id, const FieldVector &fields)
const FieldVector & getFields() const
Root class of the ESI type system.
virtual std::ptrdiff_t getBitWidth() const
The "void" type is a special type which can be used to represent no type.
std::ptrdiff_t getBitWidth() const override