Cerata
A library to generate structural hardware designs
|
A structure to dynamically define type mappings between flattened types. More...
#include <flattype.h>
Public Member Functions | |
TypeMapper (Type *a, Type *b) | |
TypeMapper constructor. Constructs an empty type mapping. | |
TypeMapper & | Add (int64_t a, int64_t b) |
Add a mapping between two FlatTypes to the mapper. | |
MappingMatrix< int64_t > | map_matrix () |
Return the mapping matrix of this TypeMapper. | |
void | SetMappingMatrix (MappingMatrix< int64_t > map_matrix) |
Set the mapping matrix of this TypeMapper. | |
std::vector< FlatType > | flat_a () const |
Return the list of flattened types on the "a"-side. | |
std::vector< FlatType > | flat_b () const |
Return the list of flattened types on the "b"-side. | |
Type * | a () const |
Return the type on the "a"-side. | |
Type * | b () const |
Return the type on the "b"-side. | |
bool | CanConvert (const Type *a, const Type *b) const |
Return true if this TypeMapper can map type a to type b. | |
std::shared_ptr< TypeMapper > | Inverse () const |
Return a new TypeMapper that is the inverse of this TypeMapper. | |
std::vector< MappingPair > | GetUniqueMappingPairs () |
Get a list of unique mapping pairs. | |
std::string | ToString () const |
Return a human-readable string of this TypeMapper. | |
![]() | |
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< TypeMapper > | Make (Type *a) |
Construct a new TypeMapper from some type to itself, and return a smart pointer to it. | |
static std::shared_ptr< TypeMapper > | MakeImplicit (Type *a, Type *b) |
Construct a new TypeMapper from some type to another type, and automatically determine the type mapping. | |
static std::shared_ptr< TypeMapper > | Make (Type *a, Type *b) |
Construct a new, empty TypeMapper between two types. | |
static std::shared_ptr< TypeMapper > | Make (const std::shared_ptr< Type > &a, const std::shared_ptr< Type > &b) |
Construct a new, empty TypeMapper between two types. | |
Public Attributes | |
std::unordered_map< std::string, std::string > | meta |
KV storage for metadata of tools or specific backend implementations. | |
Protected Attributes | |
std::vector< FlatType > | fa_ |
The list of flattened types on the "a"-side. | |
std::vector< FlatType > | fb_ |
The list of flattened types on the "b"-side. | |
Type * | a_ |
Type of the "a"-side. | |
Type * | b_ |
Type of the "b"-side. | |
MappingMatrix< int64_t > | matrix_ |
The mapping matrix. | |
A structure to dynamically define type mappings between flattened types.
Useful for ordered concatenation of N synthesizable types onto M synthesizable types in any way.
Definition at line 326 of file flattype.h.