OpenASIP  2.0
Public Member Functions | List of all members
CollisionMatrix Class Reference

#include <CollisionMatrix.hh>

Inheritance diagram for CollisionMatrix:
Inheritance graph
Collaboration diagram for CollisionMatrix:
Collaboration graph

Public Member Functions

 CollisionMatrix (FUReservationTableIndex &reservationTables, std::size_t index)
 
 CollisionMatrix (std::size_t width, std::size_t height, bool value)
 
virtual ~CollisionMatrix ()
 
virtual bool isCollision (std::size_t row, std::size_t column) const
 
- Public Member Functions inherited from BitMatrix
 BitMatrix (int width, int height, bool initialValue)
 
 BitMatrix (const BitMatrix &another)
 
virtual ~BitMatrix ()
 
bool bitAt (int column, int row) const
 
void setBit (int column, int row, bool value)
 
void setAllToZero ()
 
void setAllToOne ()
 
void shiftLeft ()
 
void orWith (const BitMatrix &another)
 
bool conflictsWith (const BitMatrix &another) const
 
int rowCount () const
 
int columnCount () const
 
std::string toString () const
 
std::string toDotString () const
 
bool operator== (const BitMatrix &other) const
 
bool operator< (const BitMatrix &rightHand) const
 

Detailed Description

Represents a collision matrix.

Definition at line 49 of file CollisionMatrix.hh.

Constructor & Destructor Documentation

◆ CollisionMatrix() [1/2]

CollisionMatrix::CollisionMatrix ( FUReservationTableIndex reservationTables,
std::size_t  index 
)

Builds a collision matrix out of a set of reservation tables and an index that points to a row in the index.

The first column is included, that is, it is possible to test whether an operation can be issued at the same cycle than other operation. This is useful for the scheduler.

Parameters
reservationTablesReservation tables of all operations in the FU.
indexIndex of reservation table we compute the matrix for.

Definition at line 62 of file CollisionMatrix.cc.

64  :
65  BitMatrix(
66  reservationTables.at(index).columnCount(),
67  reservationTables.size(), false) {
68 
69  ReservationTable& thisOperation = reservationTables.at(index);
70 
71  for (int row = 0; row < rowCount(); ++row) {
72  const ReservationTable& other = reservationTables.at(row);
73 
74  for (int column = 0; column < columnCount(); ++column) {
76  column, row, thisOperation.conflictsWith(other, column));
77  }
78  }
79 }

References FUReservationTableIndex::at(), BitMatrix::columnCount(), ReservationTable::conflictsWith(), BitMatrix::rowCount(), and BitMatrix::setBit().

Here is the call graph for this function:

◆ CollisionMatrix() [2/2]

CollisionMatrix::CollisionMatrix ( std::size_t  width,
std::size_t  height,
bool  value = false 
)

Constructor.

Builds a collision matrix with given dimensions and with each value the same.

Definition at line 87 of file CollisionMatrix.cc.

88  :
89  BitMatrix(width, height, value) {
90 }

◆ ~CollisionMatrix()

CollisionMatrix::~CollisionMatrix ( )
virtual

Destructor.

Definition at line 95 of file CollisionMatrix.cc.

95  {
96 }

Member Function Documentation

◆ isCollision()

bool CollisionMatrix::isCollision ( std::size_t  row,
std::size_t  column 
) const
virtual

Returns the value of the collision matrix at the given location.

Parameters
rowThe row number (operation).
columnThe column number (cycle).
Returns
The value.

Definition at line 106 of file CollisionMatrix.cc.

106  {
107  return BitMatrix::bitAt(column, row);
108 }

References BitMatrix::bitAt().

Referenced by FUFiniteStateAutomaton::resolveState().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
ReservationTable::conflictsWith
bool conflictsWith(const ReservationTable &anotherReservationTable, int cycle) const
FUReservationTableIndex::size
std::size_t size() const
Definition: FUReservationTableIndex.cc:80
FUReservationTableIndex::at
ReservationTable & at(std::size_t operation)
Definition: FUReservationTableIndex.cc:70
BitMatrix::rowCount
int rowCount() const
BitMatrix::BitMatrix
BitMatrix(int width, int height, bool initialValue)
Definition: BitMatrix.cc:46
BitMatrix::columnCount
int columnCount() const
BitMatrix::bitAt
bool bitAt(int column, int row) const
ReservationTable
Definition: ReservationTable.hh:49
BitMatrix::setBit
void setBit(int column, int row, bool value)