OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
FUCollisionMatrixIndex Class Reference

#include <FUCollisionMatrixIndex.hh>

Collaboration diagram for FUCollisionMatrixIndex:
Collaboration graph

Public Member Functions

 FUCollisionMatrixIndex (const TTAMachine::FunctionUnit &functionUnit)
 
virtual ~FUCollisionMatrixIndex ()
 
CollisionMatrixat (int index)
 
int size () const
 

Private Attributes

std::vector< CollisionMatrix * > matrices_
 Stores all collision matrices, including one for the pseudo NOP. More...
 

Detailed Description

Represents an index of collision matrices required for modeling collision behavior of operations in an FU.

Definition at line 47 of file FUCollisionMatrixIndex.hh.

Constructor & Destructor Documentation

◆ FUCollisionMatrixIndex()

FUCollisionMatrixIndex::FUCollisionMatrixIndex ( const TTAMachine::FunctionUnit functionUnit)

Builds collision matrices for all operations in the FU and an empty collision matrix for the pseudo no-operation.

Matrices are stored in the order returned by FunctionUnit::operation(), the NOP matrix is at index FunctionUnit::operationCount().

Parameters
functionUnitThe FU to build the matrices for.

Definition at line 48 of file FUCollisionMatrixIndex.cc.

49  {
50 
51  FUReservationTableIndex tables(functionUnit);
52  int width = 0;
53  int height = 0;
54  for (int i = 0; i < functionUnit.operationCount(); ++i) {
55 
56  CollisionMatrix* matrix = new CollisionMatrix(tables, i);
57 
58 #ifndef NDEBUG
59  if (width == 0 && height == 0) {
60  width = matrix->columnCount();
61  height = matrix->rowCount();
62  } else {
63  // all matrices should be of the same dimension, otherwise there's
64  // a bug somewhere
65  assert(matrix->columnCount() == width);
66  assert(matrix->rowCount() == height);
67  }
68 #endif
69  matrices_.push_back(matrix);
70  }
71 
72  // The NOP.
73  matrices_.push_back(new CollisionMatrix(width, height, false));
74 }

References assert, BitMatrix::columnCount(), matrices_, TTAMachine::FunctionUnit::operationCount(), and BitMatrix::rowCount().

Here is the call graph for this function:

◆ ~FUCollisionMatrixIndex()

FUCollisionMatrixIndex::~FUCollisionMatrixIndex ( )
virtual

Destructor.

Definition at line 79 of file FUCollisionMatrixIndex.cc.

References SequenceTools::deleteAllItems(), and matrices_.

Here is the call graph for this function:

Member Function Documentation

◆ at()

CollisionMatrix & FUCollisionMatrixIndex::at ( int  index)

Returns the collision matrix at the given index.

Parameters
operationThe index of the operat

Definition at line 89 of file FUCollisionMatrixIndex.cc.

89  {
90  return *matrices_.at(index);
91 }

References matrices_.

Referenced by FUFiniteStateAutomaton::FUFiniteStateAutomaton(), FUFiniteStateAutomaton::operationCollisionMatrix(), and FUFiniteStateAutomaton::resolveState().

◆ size()

int FUCollisionMatrixIndex::size ( ) const

Returns the count of collision matrices in the index.

Returns
Count of collision matrices.

Definition at line 99 of file FUCollisionMatrixIndex.cc.

99  {
100  return matrices_.size();
101 }

References matrices_.

Referenced by FUFiniteStateAutomaton::buildStateMachine().

Member Data Documentation

◆ matrices_

std::vector<CollisionMatrix*> FUCollisionMatrixIndex::matrices_
private

Stores all collision matrices, including one for the pseudo NOP.

Definition at line 56 of file FUCollisionMatrixIndex.hh.

Referenced by at(), FUCollisionMatrixIndex(), size(), and ~FUCollisionMatrixIndex().


The documentation for this class was generated from the following files:
FUCollisionMatrixIndex::matrices_
std::vector< CollisionMatrix * > matrices_
Stores all collision matrices, including one for the pseudo NOP.
Definition: FUCollisionMatrixIndex.hh:56
assert
#define assert(condition)
Definition: Application.hh:86
BitMatrix::rowCount
int rowCount() const
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
FUReservationTableIndex
Definition: FUReservationTableIndex.hh:47
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
BitMatrix::columnCount
int columnCount() const
CollisionMatrix
Definition: CollisionMatrix.hh:49