Cerata
A library to generate structural hardware designs
cerata::MappingPair Struct Reference

A structure representing a mapping pair for a type mapping. More...

#include <flattype.h>

Public Types

using OptionalNode = std::optional< std::shared_ptr< Node > >
 Optional shared pointer to a node.
 
using index = int64_t
 Index type.
 
using offset = int64_t
 
using IOF = std::tuple< index, offset, FlatType >
 Tuple that stores all information required by a mapping pair on one side.
 

Public Member Functions

int64_t num_a () const
 Return the number of FlatTypes on the "a"-side.
 
int64_t num_b () const
 Return the number of FlatTypes on the "b"-side.
 
index index_a (int64_t i) const
 Return the index of the i-th FlatType on the "a"-side in the mapping matrix.
 
index index_b (int64_t i) const
 Return the index of the i-th FlatType on the "b"-side in the mapping matrix.
 
offset offset_a (int64_t i) const
 Return the offset of the i-th FlatType on the "a"-side in the mapping matrix.
 
offset offset_b (int64_t i) const
 Return the offset of the i-th FlatType on the "b"-side in the mapping matrix.
 
FlatType flat_type_a (int64_t i) const
 Return the i-th FlatType on the "a"-side in the mapping matrix.
 
FlatType flat_type_b (int64_t i) const
 Return the i-th FlatType on the "b"-side in the mapping matrix.
 
std::shared_ptr< Nodewidth_a (const OptionalNode &no_width_increment={}) const
 Return the total width of the types on side A. More...
 
std::shared_ptr< Nodewidth_b (const OptionalNode &no_width_increment={}) const
 Return the total width of the types on side B. More...
 
std::string ToString () const
 Generate a human-readable version of this MappingPair.
 

Public Attributes

std::vector< IOFa
 Flattype and its index in a mapping matrix on the "a"-side.
 
std::vector< IOFb
 Flattype and its index in a mapping matrix on the "b"-side.
 

Detailed Description

A structure representing a mapping pair for a type mapping.

The mapping pair typically contains one FlatType on one side (a or b), and one or multiple FlatTypes on the other side (a or b). If, for example, side a contains one FlatType and b contains two FlatTypes (b0 and b1), that means that if this is a mapping pair of a mapping between two types A and B, when some node X of type A and a node Y of type B connect to each other, then in hardware FlatType b0 and b1 are concatenated onto a.

Definition at line 276 of file flattype.h.

Member Typedef Documentation

◆ offset

using cerata::MappingPair::offset = int64_t

Offset type.

Definition at line 279 of file flattype.h.

Member Function Documentation

◆ width_a()

std::shared_ptr< Node > cerata::MappingPair::width_a ( const OptionalNode no_width_increment = {}) const

Return the total width of the types on side A.

Parameters
no_width_incrementIn case some flat type doesn't have a width, increment it with this parameter.
Returns
The total width on side A.

Definition at line 320 of file flattype.cc.

◆ width_b()

std::shared_ptr< Node > cerata::MappingPair::width_b ( const OptionalNode no_width_increment = {}) const

Return the total width of the types on side B.

Parameters
no_width_incrementIn case some flat type doesn't have a width, increment it with this parameter.
Returns
The total width on side B.

Definition at line 333 of file flattype.cc.


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