Cerata
A library to generate structural hardware designs
cerata::Stream Class Reference

A Stream type. More...

#include <stream.h>

+ Inheritance diagram for cerata::Stream:
+ Collaboration diagram for cerata::Stream:

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.
 
Fielddata ()
 Return the stream data field.
 
StreamSetElementType (std::shared_ptr< Type > type)
 Set the element type of this stream.
 
- Public Member Functions inherited from cerata::Record
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.
 
RecordAddField (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.
 
Fieldat (const std::string &name) const
 Return the field with a specific name.
 
Fieldat (size_t i) const
 Return the field at index i contained by this record.
 
Fieldoperator[] (size_t i) const
 Return the field at index i contained by this record.
 
Fieldoperator[] (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< TypeCopy (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.
 
- Public Member Functions inherited from cerata::Type
 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< TypeMapperGenerateMapper (Type *other)
 Generate a new mapper to a specific other type. Should be checked with CanGenerateMapper first, or throws.
 
virtual std::shared_ptr< TypeCopy () const
 Make a copy of the type without rebinding. More...
 
std::shared_ptr< Typeoperator() (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< Typeoperator() (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...
 
- Public Member Functions inherited from cerata::Named
 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< Typevalid ()
 Return a 'valid' bit type.
 
static std::shared_ptr< Typeready ()
 Return a 'ready' bit type.
 

Additional Inherited Members

- Public Types inherited from cerata::Type
enum  ID {
  BIT, VECTOR, INTEGER, STRING,
  BOOLEAN, RECORD
}
 The Type ID. Used for convenient type checking. More...
 
- Public Attributes inherited from cerata::Type
std::unordered_map< std::string, std::string > meta
 KV storage for metadata of tools or specific backend implementations.
 
- Protected Attributes inherited from cerata::Record
std::vector< std::shared_ptr< Field > > fields_
 The fields of this Record.
 
- Protected Attributes inherited from cerata::Type
ID id_
 Type ID.
 
std::vector< std::shared_ptr< TypeMapper > > mappers_
 A list of mappers that can map this type to another type.
 

Detailed Description

A Stream type.

Definition at line 26 of file stream.h.


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