Cerata
A library to generate structural hardware designs
|
#include <stream.h>
Public Member Functions | |
Stream (const std::string &name, const std::string &element_name, const std::shared_ptr< Type > &element_type, const std::vector< std::shared_ptr< Field >> &control) | |
Stream constructor. | |
Field * | data () |
Return the stream data field. | |
Stream & | SetElementType (std::shared_ptr< Type > type) |
Set the element type of this stream. | |
![]() | |
bool | IsPhysical () const override |
Return true if the Type has an immediate physical representation, false otherwise. | |
bool | IsGeneric () const override |
Return true if the Type is a generic type. | |
bool | IsNested () const override |
Return true if the Type is a nested, false otherwise. | |
Record (std::string name, std::vector< std::shared_ptr< Field >> fields={}) | |
Record constructor. | |
Record & | AddField (const std::shared_ptr< Field > &field, std::optional< size_t > index=std::nullopt) |
Add a field to this Record. | |
bool | Has (const std::string &name) const |
Return true if record has field with name name. | |
Field * | at (const std::string &name) const |
Return the field with a specific name. | |
Field * | at (size_t i) const |
Return the field at index i contained by this record. | |
Field * | operator[] (size_t i) const |
Return the field at index i contained by this record. | |
Field * | operator[] (const std::string &name) const |
Return the field with name name contained by this record. | |
std::vector< std::shared_ptr< Field > > | fields () const |
Return all fields contained by this record. | |
size_t | num_fields () const |
Return the number of fields in this record. | |
bool | IsEqual (const Type &other) const override |
Determine if this Type is exactly equal to an other Type. | |
std::vector< Node * > | GetGenerics () const override |
Return all nodes that potentially parametrize the fields of this record. | |
std::vector< Type * > | GetNested () const override |
Obtain any nested types. | |
std::shared_ptr< Type > | Copy (const NodeMap &rebinding) const override |
Make a copy of the type, and rebind any type generic nodes that are keys in the rebinding to their values. More... | |
std::string | ToStringFieldNames () const |
Return the names of the fields as a comma separated string. | |
![]() | |
Type (std::string name, ID id) | |
Type constructor. More... | |
ID | id () const |
Return the Type ID. | |
bool | Is (ID type_id) const |
Return true if the Type ID is type_id, false otherwise. | |
virtual std::optional< Node * > | width () const |
Return the width of the type, if it is synthesizable. | |
std::string | ToString (bool show_meta=false, bool show_mappers=false) const |
Return the Type ID as a human-readable string. | |
std::vector< std::shared_ptr< TypeMapper > > | mappers () const |
Return possible type mappers. | |
void | AddMapper (const std::shared_ptr< TypeMapper > &mapper, bool remove_existing=true) |
Add a type mapper. | |
std::optional< std::shared_ptr< TypeMapper > > | GetMapper (Type *other, bool generate_implicit=true) |
Get a mapper to another type, if it exists. Generates one, if possible, when generate_implicit = true. | |
int | RemoveMappersTo (Type *other) |
Remove all mappers to a specific type. | |
std::optional< std::shared_ptr< TypeMapper > > | GetMapper (const std::shared_ptr< Type > &other) |
Get a mapper to another type, if it exists. | |
virtual bool | CanGenerateMapper (const Type &other) const |
Check if a mapper can be generated to another specific type. | |
virtual std::shared_ptr< TypeMapper > | GenerateMapper (Type *other) |
Generate a new mapper to a specific other type. Should be checked with CanGenerateMapper first, or throws. | |
virtual std::shared_ptr< Type > | Copy () const |
Make a copy of the type without rebinding. More... | |
std::shared_ptr< Type > | operator() (std::vector< Node * > nodes) |
Make a copy of the type, and rebind any type generic nodes in order of the GetGenerics call. More... | |
std::shared_ptr< Type > | operator() (const std::vector< std::shared_ptr< Node >> &nodes) |
Make a copy of the type, and rebind any type generic nodes in order of the GetGenerics call. More... | |
![]() | |
Named (std::string name) | |
Named constructor. | |
std::string | name () const |
Return the name of the object. | |
void | SetName (std::string name) |
Change the name of the object. | |
virtual | ~Named ()=default |
Destructor. | |
Static Public Member Functions | |
static std::shared_ptr< Type > | valid () |
Return a 'valid' bit type. | |
static std::shared_ptr< Type > | ready () |
Return a 'ready' bit type. | |
Additional Inherited Members | |
![]() | |
enum | ID { BIT, VECTOR, INTEGER, STRING, BOOLEAN, RECORD } |
The Type ID. Used for convenient type checking. More... | |
![]() | |
std::unordered_map< std::string, std::string > | meta |
KV storage for metadata of tools or specific backend implementations. | |
![]() | |
std::vector< std::shared_ptr< Field > > | fields_ |
The fields of this Record. | |
![]() | |
ID | id_ |
Type ID. | |
std::vector< std::shared_ptr< TypeMapper > > | mappers_ |
A list of mappers that can map this type to another type. | |