OpenASIP  2.0
Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
ImmediateAnalyzer Class Reference

#include <ImmediateAnalyzer.hh>

Collaboration diagram for ImmediateAnalyzer:
Collaboration graph

Public Member Functions

 ImmediateAnalyzer ()=default
 
virtual ~ImmediateAnalyzer ()=default
 

Static Public Member Functions

static ImmInfoanalyze (const TTAMachine::Machine &mach)
 

Static Private Member Functions

static void analyzeImmediateCapabilitiesForFU (const TTAMachine::FunctionUnit &fu, ImmInfo &result)
 
static void analyzeImmediateCapabilitiesForOperation (const TTAMachine::HWOperation &hwop, ImmInfo &result)
 

Detailed Description

Definition at line 50 of file ImmediateAnalyzer.hh.

Constructor & Destructor Documentation

◆ ImmediateAnalyzer()

ImmediateAnalyzer::ImmediateAnalyzer ( )
default

◆ ~ImmediateAnalyzer()

virtual ImmediateAnalyzer::~ImmediateAnalyzer ( )
virtualdefault

Member Function Documentation

◆ analyze()

ImmInfo * ImmediateAnalyzer::analyze ( const TTAMachine::Machine mach)
static

Collects short immediate capabilities of the machine.

Parameters
machThe machine.

Definition at line 60 of file ImmediateAnalyzer.cc.

60  {
61  std::unique_ptr<ImmInfo> result(new ImmInfo);
62 
63  for (const FunctionUnit* fu : mach.functionUnitNavigator()) {
65  }
66 
68  // ^ todo: fix this. operations of CU are not getting included in analysis.
69 
70  //todo: remove duplicates (entries with identical (key, value pairs)).
71 
72 
73  return result.release();
74 }

References TTAMachine::Machine::controlUnit(), and TTAMachine::Machine::functionUnitNavigator().

Referenced by TDGen::TDGen().

Here is the call graph for this function:

◆ analyzeImmediateCapabilitiesForFU()

void ImmediateAnalyzer::analyzeImmediateCapabilitiesForFU ( const TTAMachine::FunctionUnit fu,
ImmInfo result 
)
staticprivate

Collects short immediate capabilities for each operation in the FU.

Parameters
fuThe function unit.
resultThe short immediate analysis result object where the capabilities are inserted into.

Definition at line 85 of file ImmediateAnalyzer.cc.

86  {
87 
88  for (int i = 0; i < fu.operationCount(); i++) {
89  HWOperation& hwop = *fu.operation(i);
91  }
92 }

References TTAMachine::FunctionUnit::operation(), and TTAMachine::FunctionUnit::operationCount().

Here is the call graph for this function:

◆ analyzeImmediateCapabilitiesForOperation()

void ImmediateAnalyzer::analyzeImmediateCapabilitiesForOperation ( const TTAMachine::HWOperation hwop,
ImmInfo result 
)
staticprivate

Collects immediate transport capabilities for the operation.

Parameters
hwopThe operation.
resultThe short immediate analysis result object where the capabilities are inserted into.

Definition at line 103 of file ImmediateAnalyzer.cc.

104  {
105 
106  using std::make_pair;
107 
108  for (int i = 0; i < hwop.operandCount(); i++) {
109  assert(hwop.port(i+1) != nullptr);
110  const FUPort& boundPort = *hwop.port(i+1);
111  const Machine& mach = *boundPort.parentUnit()->machine();
112  std::set<const TTAMachine::Bus*> connectedBuses =
114  for (const Bus* bus : connectedBuses) {
115  if (bus->immediateWidth() < 1) {
116  continue;
117  }
118  result.insert(
119  make_pair(
120  make_pair(TCEString::toUpper(hwop.name()), i+1),
121  ImmInfoValue(bus->immediateWidth(), bus->signExtends())));
122  }
123 
124  for (const ImmediateUnit* iu : mach.immediateUnitNavigator()) {
125  if (MachineConnectivityCheck::isConnected(*iu, boundPort)) {
126  for (auto& it : mach.instructionTemplateNavigator()) {
127  int supportedWidth = it->supportedWidth(*iu);
128  if (supportedWidth < 1) {
129  continue;
130  }
131 
132  result.insert(
133  make_pair(
134  make_pair(TCEString::toUpper(hwop.name()), i+1),
135  ImmInfoValue(supportedWidth, iu->signExtends())));
136  }
137  }
138  }
139  }
140 }

References assert, MachineConnectivityCheck::connectedSourceBuses(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::instructionTemplateNavigator(), MachineConnectivityCheck::isConnected(), TTAMachine::Component::machine(), TTAMachine::HWOperation::name(), TTAMachine::HWOperation::operandCount(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::HWOperation::port(), and TCEString::toUpper().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::BaseFUPort::parentUnit
FunctionUnit * parentUnit() const
Definition: BaseFUPort.cc:96
ImmediateAnalyzer::analyzeImmediateCapabilitiesForOperation
static void analyzeImmediateCapabilitiesForOperation(const TTAMachine::HWOperation &hwop, ImmInfo &result)
Definition: ImmediateAnalyzer.cc:103
ImmInfoValue
Definition: ImmInfo.hh:58
TTAMachine::Bus
Definition: Bus.hh:53
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::HWOperation::port
virtual FUPort * port(int operand) const
Definition: HWOperation.cc:320
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
TTAMachine::Machine::immediateUnitNavigator
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition: Machine.cc:416
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
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
TTAMachine::HWOperation::operandCount
int operandCount() const
Definition: HWOperation.cc:306
TTAMachine::Component::machine
virtual Machine * machine() const
MachineConnectivityCheck::connectedSourceBuses
static std::set< const TTAMachine::Bus * > connectedSourceBuses(const TTAMachine::Port &port)
Definition: MachineConnectivityCheck.cc:769
ImmediateAnalyzer::analyzeImmediateCapabilitiesForFU
static void analyzeImmediateCapabilitiesForFU(const TTAMachine::FunctionUnit &fu, ImmInfo &result)
Definition: ImmediateAnalyzer.cc:85
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
TCEString::toUpper
static TCEString toUpper(const TCEString &str, const std::locale &loc=std::locale())
Definition: TCEString.cc:156
TTAMachine::Machine::instructionTemplateNavigator
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
Definition: Machine.cc:428
ImmInfo
Definition: ImmInfo.hh:82
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50