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

#include <MachineAnalysis.hh>

Collaboration diagram for MachineAnalysis:
Collaboration graph

Public Member Functions

 MachineAnalysis (const TTAMachine::Machine &machine)
 
float connectivity () const
 
float bypassability () const
 
float averageILP () const
 
float busILP () const
 
float fuILP () const
 
float rfILP () const
 
float bypassedRfILP () const
 
float guardability () const
 

Private Attributes

float connectivity_
 
float busILP_
 
float fuILP_
 
float rfILP_
 
float bypassedRfILP_
 
float bypassability_
 
float guardability_
 
float averageILP_
 

Detailed Description

Definition at line 40 of file MachineAnalysis.hh.

Constructor & Destructor Documentation

◆ MachineAnalysis()

MachineAnalysis::MachineAnalysis ( const TTAMachine::Machine machine)

Constructor.

Parameters
machineto analyse.

Definition at line 46 of file MachineAnalysis.cc.

46  {
47 
48  // do heurictics for FU's
49 
52 
53  // todo: better heuristics here, based on available operations etc.
54  fuILP_ = fuNav.count() * 0.55;
55 
56  // Connectivity heuristics
57 
58  int fuPortConnecteds = 0;
59  int fuPortUnconnecteds = 0;
60 
61  for (int i = 0; i < fuNav.count(); i++) {
62  TTAMachine::FunctionUnit& fu1 = *fuNav.item(i);
63  for (int j = 0; j < fu1.portCount(); j++ ) {
64  TTAMachine::Port& port1 = *fu1.port(j);
65  if (port1.inputSocket() != NULL) {
66  for (int k = 0; k < fuNav.count(); k++) {
67  TTAMachine::FunctionUnit& fu2 = *fuNav.item(k);
68  for (int l = 0; l < fu2.portCount(); l++ ) {
69  TTAMachine::Port& port2 = *fu2.port(l);
70  if (port2.outputSocket() != NULL) {
72  port2,port1)) {
73  fuPortConnecteds++;
74  } else {
75  fuPortUnconnecteds++;
76  }
77  }
78  }
79  }
80  }
81  }
82  }
83 
84  bypassability_ = fuPortConnecteds/
85  float(fuPortConnecteds+fuPortUnconnecteds);
86 
89  int rfCount = regNav.count();
90 
93 
94  int rfFuConnecteds = 0;
95  int rfFuUnconnecteds = 0;
96 
97  for (int i = 0; i < fuNav.count(); i++) {
98  TTAMachine::FunctionUnit& fu1 = *fuNav.item(i);
99  for (int j = 0; j < fu1.portCount(); j++ ) {
100  TTAMachine::Port& port = *fu1.port(j);
101  if (port.inputSocket() != NULL) {
102  for (int i = 0; i < rfCount; i++) {
103  TTAMachine::RegisterFile& rf = *regNav.item(i);
105  rfFuConnecteds++;
106  } else {
107  rfFuUnconnecteds++;
108  }
109  }
110  }
111 
112  if (port.outputSocket() != NULL) {
113  for (int i = 0; i < rfCount; i++) {
114  TTAMachine::RegisterFile& rf = *regNav.item(i);
116  rfFuConnecteds++;
117  } else {
118  rfFuUnconnecteds++;
119  }
120  }
121  }
122  }
123  }
124 
125  // do heuristics for RF's
126 
127  int rfWritePorts = 0;
128  int rfReadPorts = 0;
129  for (int i = 0; i < rfCount; i++) {
130  TTAMachine::RegisterFile& rf = *regNav.item(i);
131  for (int j = 0; j < rf.portCount(); j++) {
132  const TTAMachine::Port& port = *rf.port(j);
133  if (port.outputSocket() != NULL) {
134  rfReadPorts++;
135  }
136  if (port.inputSocket() != NULL) {
137  rfWritePorts++;
138  }
139  }
140  }
141 
142  // rfILP comes from all RF's with
143  float avgRfWrites = float(rfWritePorts)/pow(rfCount,0.5);
144  float avgRfReads = float(rfReadPorts)/pow(rfCount,0.5);
145  float bypassedRfReadILP = avgRfReads/(1.17-(0.56*bypassability_));
146  float bypassedRfWriteILP = avgRfWrites/(0.83-(0.415*bypassability_));
147  float rfReadILP = avgRfReads/1.17;
148  float rfWriteILP = avgRfWrites/0.83;
149 
150  // todo: fuzzier heuristic
151  rfILP_ = std::min(rfReadILP, rfWriteILP);
152  bypassedRfILP_ = std::min(bypassedRfReadILP, bypassedRfWriteILP);
153 
154  connectivity_ = rfFuConnecteds/
155  float(rfFuConnecteds+rfFuUnconnecteds);
156  float transfers = connectivity_* busNav.count();
157 
158  busILP_ = transfers / (2.5-(0.415*bypassability_));
159 
160  // take the final value by inverse of pythagoral of inverses
161  averageILP_ = pow((pow(busILP_,-2)+
162  pow(bypassedRfILP_,-2)+
163  pow(fuILP_,-2)), -0.5);
164 
165  // then calculate guardability.
166 
167  float guardedBuses = 0;
168  for (int i = 0; i < busNav.count(); i++) {
169  TTAMachine::Bus& bus = *busNav.item(i);
170  if (bus.guardCount() > 0) {
171  guardedBuses++;
172  }
173  }
174  guardability_ = busNav.count() / guardedBuses;
175 
176 #ifdef DEBUG_MACHINE_ANALYSIS
177  std::cout << "Machine analysis done.." << std::endl;
178  std::cout << "\tbypassability: " << bypassability_ << std::endl;
179  std::cout << "\tconnectivity: " << connectivity_ << std::endl;
180  std::cout << "\tguardability: " << guardability_ << std::endl;
181  std::cout << "\tRF ilp: " << rfILP_ << std::endl;
182  std::cout << "\t\tread ilp: " << rfReadILP << std::endl;
183  std::cout << "\t\twrite ilp: " << rfWriteILP << std::endl;
184  std::cout << "\tbypassd rf ilp: " << bypassedRfILP_ << std::endl;
185  std::cout << "\tbus ilp: " << busILP_ << std::endl;
186  std::cout << "\tfu ilp: " << fuILP_ << std::endl;
187  std::cout << "total ilp: " << averageILP_ << std::endl;
188 #endif
189 
190 }

References averageILP_, busILP_, TTAMachine::Machine::busNavigator(), bypassability_, bypassedRfILP_, connectivity_, TTAMachine::Machine::Navigator< ComponentType >::count(), fuILP_, TTAMachine::Machine::functionUnitNavigator(), guardability_, TTAMachine::Bus::guardCount(), TTAMachine::Port::inputSocket(), MachineConnectivityCheck::isConnected(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, TTAMachine::Port::outputSocket(), TTAMachine::BaseRegisterFile::port(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), TTAMachine::Machine::registerFileNavigator(), and rfILP_.

Here is the call graph for this function:

Member Function Documentation

◆ averageILP()

float MachineAnalysis::averageILP ( ) const
inline

Definition at line 46 of file MachineAnalysis.hh.

46 { return averageILP_; }

References averageILP_.

Referenced by SimpleIfConverter::SimpleIfConverter().

◆ busILP()

float MachineAnalysis::busILP ( ) const
inline

Definition at line 48 of file MachineAnalysis.hh.

48 { return busILP_; }

References busILP_.

Referenced by SimpleIfConverter::SimpleIfConverter().

◆ bypassability()

float MachineAnalysis::bypassability ( ) const
inline

Definition at line 45 of file MachineAnalysis.hh.

45 { return bypassability_; }

References bypassability_.

Referenced by DataDependenceGraph::setMachine().

◆ bypassedRfILP()

float MachineAnalysis::bypassedRfILP ( ) const
inline

Definition at line 51 of file MachineAnalysis.hh.

51 { return bypassedRfILP_; }

References bypassedRfILP_.

Referenced by SimpleIfConverter::SimpleIfConverter().

◆ connectivity()

float MachineAnalysis::connectivity ( ) const
inline

Definition at line 44 of file MachineAnalysis.hh.

44 { return connectivity_; }

References connectivity_.

Referenced by DataDependenceGraph::setMachine().

◆ fuILP()

float MachineAnalysis::fuILP ( ) const
inline

Definition at line 49 of file MachineAnalysis.hh.

49 { return fuILP_; }

References fuILP_.

Referenced by SimpleIfConverter::SimpleIfConverter().

◆ guardability()

float MachineAnalysis::guardability ( ) const
inline

Definition at line 52 of file MachineAnalysis.hh.

52 { return guardability_; }

References guardability_.

◆ rfILP()

float MachineAnalysis::rfILP ( ) const
inline

Definition at line 50 of file MachineAnalysis.hh.

50 { return rfILP_; }

References rfILP_.

Member Data Documentation

◆ averageILP_

float MachineAnalysis::averageILP_
private

Definition at line 62 of file MachineAnalysis.hh.

Referenced by averageILP(), and MachineAnalysis().

◆ busILP_

float MachineAnalysis::busILP_
private

Definition at line 55 of file MachineAnalysis.hh.

Referenced by busILP(), and MachineAnalysis().

◆ bypassability_

float MachineAnalysis::bypassability_
private

Definition at line 59 of file MachineAnalysis.hh.

Referenced by bypassability(), and MachineAnalysis().

◆ bypassedRfILP_

float MachineAnalysis::bypassedRfILP_
private

Definition at line 58 of file MachineAnalysis.hh.

Referenced by bypassedRfILP(), and MachineAnalysis().

◆ connectivity_

float MachineAnalysis::connectivity_
private

Definition at line 54 of file MachineAnalysis.hh.

Referenced by connectivity(), and MachineAnalysis().

◆ fuILP_

float MachineAnalysis::fuILP_
private

Definition at line 56 of file MachineAnalysis.hh.

Referenced by fuILP(), and MachineAnalysis().

◆ guardability_

float MachineAnalysis::guardability_
private

Definition at line 60 of file MachineAnalysis.hh.

Referenced by guardability(), and MachineAnalysis().

◆ rfILP_

float MachineAnalysis::rfILP_
private

Definition at line 57 of file MachineAnalysis.hh.

Referenced by MachineAnalysis(), and rfILP().


The documentation for this class was generated from the following files:
TTAMachine::Port::inputSocket
virtual Socket * inputSocket() const
Definition: Port.cc:261
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
MachineAnalysis::fuILP_
float fuILP_
Definition: MachineAnalysis.hh:56
TTAMachine::Bus
Definition: Bus.hh:53
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
TTAMachine::Machine::Navigator::count
int count() const
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
MachineAnalysis::bypassedRfILP_
float bypassedRfILP_
Definition: MachineAnalysis.hh:58
TTAMachine::Port
Definition: Port.hh:54
MachineAnalysis::rfILP_
float rfILP_
Definition: MachineAnalysis.hh:57
MachineConnectivityCheck::isConnected
static bool isConnected(const TTAMachine::Port &sourcePort, const TTAMachine::Port &destinationPort, const TTAMachine::Guard *guard=NULL)
Definition: MachineConnectivityCheck.cc:128
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
MachineAnalysis::averageILP_
float averageILP_
Definition: MachineAnalysis.hh:62
MachineAnalysis::connectivity_
float connectivity_
Definition: MachineAnalysis.hh:54
TTAMachine::Bus::guardCount
int guardCount() const
Definition: Bus.cc:441
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
MachineAnalysis::guardability_
float guardability_
Definition: MachineAnalysis.hh:60
TTAMachine::BaseRegisterFile::port
virtual RFPort * port(const std::string &name) const
Definition: BaseRegisterFile.cc:129
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
TTAMachine::Port::outputSocket
virtual Socket * outputSocket() const
Definition: Port.cc:281
MachineAnalysis::busILP_
float busILP_
Definition: MachineAnalysis.hh:55
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
MachineAnalysis::bypassability_
float bypassability_
Definition: MachineAnalysis.hh:59
TTAMachine::Machine::Navigator
Definition: Machine.hh:186