OpenASIP  2.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TTAProgram::TPEFResourceUpdater Class Reference

#include <ProgramWriter.hh>

Collaboration diagram for TTAProgram::TPEFResourceUpdater:
Collaboration graph

Public Member Functions

 TPEFResourceUpdater (TTAMachine::Machine &mach, TPEF::ResourceSection &resources)
 
void clearCache ()
 
TPEF::ResourceElementbus (const TTAMachine::Bus &bus)
 
TPEF::ResourceElementfunctionUnitPort (const TTAMachine::Port &port)
 
TPEF::ResourceElementoperand (const TTAMachine::HWOperation &oper, int operandIndex)
 
TPEF::ResourceElementfunctionUnit (const TTAMachine::FunctionUnit &fu)
 
TPEF::ResourceElementregisterFile (const TTAMachine::RegisterFile &rf)
 
TPEF::ResourceElementimmediateUnit (const TTAMachine::ImmediateUnit &immUnit)
 

Private Types

typedef std::pair< const TTAMachine::MachinePart *, int > CacheKey
 
typedef std::map< CacheKey, TPEF::ResourceElement * > ResourceCache
 Mapping from parts of the target processor model to TPEF machine resource entries. More...
 

Private Member Functions

void initCache ()
 

Private Attributes

TTAMachine::Machinemach_
 The model of the target processor architecture. More...
 
TPEF::ResourceSectionresources_
 The TPEF input section that contains all machine resource entries. More...
 
ResourceCache cache_
 Aggregate of all mappings between machine resource entries and target processor parts (machine parts). More...
 
HalfWord lastBusId_
 Last TPEF bus id that was generated. More...
 
HalfWord lastUnitPortId_
 Last TPEF unit port id that was generated. More...
 
HalfWord lastFunctionUnitId_
 Last TPEF function unit id that was generated. More...
 
HalfWord lastRegisterFileId_
 Last TPEF register file id that was generated. More...
 
HalfWord lastImmediateUnitId_
 Last TPEF immediate unit id that was generated. More...
 

Detailed Description

Returns requested Machine parts as a TPEF resources.

Also adds new resources to resource section if resource is not already there.

NOTE: If resource section is modified externally, cache should be cleared.

Definition at line 81 of file ProgramWriter.hh.

Member Typedef Documentation

◆ CacheKey

Definition at line 109 of file ProgramWriter.hh.

◆ ResourceCache

Mapping from parts of the target processor model to TPEF machine resource entries.

Definition at line 112 of file ProgramWriter.hh.

Constructor & Destructor Documentation

◆ TPEFResourceUpdater()

TTAProgram::TPEFResourceUpdater::TPEFResourceUpdater ( TTAMachine::Machine mach,
TPEF::ResourceSection resources 
)

Definition at line 151 of file ProgramWriter.cc.

152  :
153  mach_(mach), resources_(resources),
157 
158  initCache();
159 }

References initCache().

Here is the call graph for this function:

Member Function Documentation

◆ bus()

ResourceElement & TTAProgram::TPEFResourceUpdater::bus ( const TTAMachine::Bus bus)

Finds and creates ResourceElement for the bus given in parameter.

If resource id not already created to TPEF method creates it and adds CacheKey for it.

Parameters
busBus whose tpef resource is looked for.
Returns
ResourceElement for the bus given in parameter.

Definition at line 317 of file ProgramWriter.cc.

317  {
318 
319  CacheKey key = CacheKey(&bus, 0);
320  if (!MapTools::containsKey(cache_, key)) {
321  ResourceElement *newRes = new ResourceElement();
322 
323  newRes->setType(ResourceElement::MRT_BUS);
324 
325  // check if bus belongs to universal machine, set universal bus ID
326  // if it does
327  UniversalMachine *uMach =
328  dynamic_cast<UniversalMachine*>(bus.machine());
329 
330  if (uMach == NULL) {
331  newRes->setId(lastBusId_++);
332 
333  } else {
334  // find universal bus
335  if (&bus == &uMach->universalBus()) {
336  newRes->setId(ResourceElement::UNIVERSAL_BUS);
337 
338  } else {
339  boost::format unexpectedBusMsg(
340  "Unexpected bus '%1%' in universal machine in addition "
341  "to the unique universal bus '%2%'.");
342 
343  abortWithError(unexpectedBusMsg.str());
344  }
345  }
346 
347  StringSection *strings =
348  dynamic_cast<StringSection*>(resources_.link());
349 
350  newRes->setName(strings->string2Chunk(bus.name()));
351 #if 0
352  std::cerr << "added MRT_BUS resource type: " << newRes->type()
353  << "\tid:" << newRes->id() << "\tname: "
354  << strings->chunk2String(newRes->name()) << std::endl;
355 #endif
356  resources_.addElement(newRes);
357  cache_[key] = newRes;
358  }
359 
360  return *cache_[key];
361 }

References abortWithError, TPEF::Section::addElement(), cache_, TPEF::StringSection::chunk2String(), MapTools::containsKey(), TPEF::ResourceElement::id(), lastBusId_, TPEF::Section::link(), TPEF::ResourceElement::name(), resources_, TPEF::ResourceElement::setId(), TPEF::ResourceElement::setName(), TPEF::ResourceElement::setType(), TPEF::StringSection::string2Chunk(), TPEF::ResourceElement::type(), and UniversalMachine::universalBus().

Referenced by TTAProgram::ProgramWriter::createCodeSection(), and initCache().

Here is the call graph for this function:

◆ clearCache()

void TTAProgram::TPEFResourceUpdater::clearCache ( )

Clears the temporary variables and reinits the cache.

Definition at line 296 of file ProgramWriter.cc.

296  {
297  cache_.clear();
298  lastBusId_ = 1;
299  lastUnitPortId_ = 1;
303  initCache();
304 }

References cache_, initCache(), lastBusId_, lastFunctionUnitId_, lastImmediateUnitId_, lastRegisterFileId_, and lastUnitPortId_.

Here is the call graph for this function:

◆ functionUnit()

ResourceElement & TTAProgram::TPEFResourceUpdater::functionUnit ( const TTAMachine::FunctionUnit fu)

Finds and creates ResourceElement for a fu given in parameter.

If resource id not already created to TPEF method creates it and adds CacheKey for it.

Parameters
fuFunction unit whose TPEF resource is looked for.
Returns
ResourceElement for the function unit given in parameter.

Definition at line 512 of file ProgramWriter.cc.

512  {
513 
514  CacheKey key = CacheKey(&fu, 0);
515 
516  if (!MapTools::containsKey(cache_, key)) {
517  ResourceElement *newRes = new ResourceElement();
518 
519  newRes->setType(ResourceElement::MRT_UNIT);
520 
521  // check if universal and set universal id
522  // if reference to universal machine
523  UniversalMachine *uMach =
524  dynamic_cast<UniversalMachine*>(fu.machine());
525 
526  if (uMach == NULL) {
527  newRes->setId(lastFunctionUnitId_++);
528  resources_.addElement(newRes);
529 
530  } else {
531  // find universal function unit or gcu...
532  if (&fu == &uMach->universalFunctionUnit() ||
533  &fu == uMach->controlUnit()) {
534 
535  CacheKey uFUKey = CacheKey(
536  &uMach->universalFunctionUnit(), 0);
537  CacheKey uGCUKey = CacheKey(uMach->controlUnit(), 0);
538 
539  // check if resource element is already created
540  if (MapTools::containsKey(cache_, uFUKey)) {
541  delete newRes;
542  newRes = cache_[uFUKey];
543 
544  } else if (MapTools::containsKey(cache_, uGCUKey)) {
545  delete newRes;
546  newRes = cache_[uGCUKey];
547 
548  } else {
549  newRes->setId(ResourceElement::UNIVERSAL_FU);
550  resources_.addElement(newRes);
551  }
552 
553  } else {
555  "Unknown universal machine reference to function unit: " +
556  fu.name());
557  }
558  }
559 
560  StringSection *strings =
561  dynamic_cast<StringSection*>(resources_.link());
562 
563  newRes->setName(strings->string2Chunk(fu.name()));
564 #if 0
565  std::cerr << "added MRT_UNIT resource type: " << newRes->type()
566  << "\tid:" << newRes->id() << "\tname: "
567  << strings->chunk2String(newRes->name()) << std::endl;
568 #endif
569 
570  cache_[key] = newRes;
571  }
572  return *cache_[key];
573 }

References abortWithError, TPEF::Section::addElement(), cache_, TPEF::StringSection::chunk2String(), MapTools::containsKey(), TTAMachine::Machine::controlUnit(), TPEF::ResourceElement::id(), lastFunctionUnitId_, TPEF::Section::link(), TTAMachine::Component::machine(), TPEF::ResourceElement::name(), TTAMachine::Component::name(), resources_, TPEF::ResourceElement::setId(), TPEF::ResourceElement::setName(), TPEF::ResourceElement::setType(), TPEF::StringSection::string2Chunk(), TPEF::ResourceElement::type(), and UniversalMachine::universalFunctionUnit().

Referenced by TTAProgram::ProgramWriter::createCodeSection(), and TTAProgram::ProgramWriter::terminalResource().

Here is the call graph for this function:

◆ functionUnitPort()

ResourceElement & TTAProgram::TPEFResourceUpdater::functionUnitPort ( const TTAMachine::Port port)

Finds and creates ResourceElement for a fu port given in parameter.

If resource id not already created to TPEF method creates it and adds CacheKey for it.

Parameters
portPort whose tpef resource is looked for.
Returns
ResourceElement for the machine part given in parameter.

Definition at line 373 of file ProgramWriter.cc.

373  {
374 
375  CacheKey key = CacheKey(&port, 0);
376  if (!MapTools::containsKey(cache_, key)) {
377  ResourceElement *newRes = new ResourceElement();
378 
379  if (dynamic_cast<const TTAMachine::FUPort*>(&port) != NULL) {
380  newRes->setType(ResourceElement::MRT_PORT);
381 
382  } else if (dynamic_cast<const TTAMachine::SpecialRegisterPort*>(
383  &port) != NULL) {
384 
385  newRes->setType(ResourceElement::MRT_SR);
386 
387  } else {
389  "Port must be either FUPort or SpecialRegisterPort!");
390  }
391 
392  newRes->setId((lastUnitPortId_++));
393 
394  StringSection *strings =
395  dynamic_cast<StringSection*>(resources_.link());
396 
397  // check if universal and set return-address register name if needed
398  UniversalMachine *uMach =
399  dynamic_cast<UniversalMachine*>(port.parentUnit()->machine());
400 
401  if (uMach != NULL) {
403  if (uMach->controlUnit()->returnAddressPort() == &port) {
404 
405  newRes->setName(
406  strings->string2Chunk(
407  ResourceElement::RETURN_ADDRESS_NAME));
408  } else {
409 
410  const SpecialRegisterPort* srp =
411  dynamic_cast<const SpecialRegisterPort*>(&port);
412 
413  if (srp == NULL) {
414  boost::format unexpectedPortMsg(
415  "Port '%1%' in universal global control unit. "
416  "Normal RF and FU ports are not allowed there.");
417  unexpectedPortMsg % port.name();
418  abortWithError(unexpectedPortMsg.str());
419 
420  } else {
421  // Might be allowed in the future if the system can
422  // be extended to support open-ended sets of special
423  // register ports in GCU.
424  boost::format unexpectedSRPortMsg(
425  "The special register port '%1%' is not one of "
426  "the ports currently supported by the global "
427  "control unit.");
428  unexpectedSRPortMsg % port.name();
429  abortWithError(unexpectedSRPortMsg.str());
430  }
431  }
432  } else {
433  newRes->setName(strings->string2Chunk(port.name()));
434  }
435 
436 #if 0
437  std::cerr << "added MRT_SR resource type: " << newRes->type()
438  << "\tid:" << newRes->id() << "\tname: "
439  << strings->chunk2String(newRes->name()) << std::endl;
440 #endif
441  resources_.addElement(newRes);
442 
443  // TODO: check that port is really found from universal or normal
444  // machine
445  cache_[CacheKey(&port, 0)] = newRes;
446 
447  }
448 
449  return *cache_[key];
450 }

References abortWithError, TPEF::Section::addElement(), assert, cache_, TPEF::StringSection::chunk2String(), MapTools::containsKey(), TTAMachine::Machine::controlUnit(), TTAMachine::ControlUnit::hasReturnAddressPort(), TPEF::ResourceElement::id(), lastUnitPortId_, TPEF::Section::link(), TTAMachine::Component::machine(), TTAMachine::Port::name(), TPEF::ResourceElement::name(), TTAMachine::Port::parentUnit(), resources_, TTAMachine::ControlUnit::returnAddressPort(), TPEF::ResourceElement::setId(), TPEF::ResourceElement::setName(), TPEF::ResourceElement::setType(), TPEF::StringSection::string2Chunk(), and TPEF::ResourceElement::type().

Referenced by TTAProgram::ProgramWriter::createCodeSection(), and TTAProgram::ProgramWriter::terminalResource().

Here is the call graph for this function:

◆ immediateUnit()

ResourceElement & TTAProgram::TPEFResourceUpdater::immediateUnit ( const TTAMachine::ImmediateUnit immUnit)

Find and return the TPEF machine resource entry that corresponds to a given immediate unit of the target processor.

If no machine resource entry exists for the given unit, it is created, cached into the resource updater and added to the TPEF machine resource section.

Parameters
immUnitAn immediate unit of the target processor.
Returns
The machine resource entry corresponding to given unit.

Definition at line 646 of file ProgramWriter.cc.

646  {
647 
648  CacheKey key = CacheKey(&immUnit, 0);
649  if (!MapTools::containsKey(cache_, key)) {
650  ResourceElement* newRes = new ResourceElement();
651 
652  newRes->setType(ResourceElement::MRT_IMM);
653  newRes->setId(lastImmediateUnitId_++);
654 
655  StringSection* strings =
656  dynamic_cast<StringSection*>(resources_.link());
657 
658  newRes->setName(strings->string2Chunk(immUnit.name()));
659 
660 #if 0
661  std::cerr << "added MRT_IMM resource type: " << newRes->type()
662  << "\tid:" << newRes->id() << "\tname: "
663  << strings->chunk2String(newRes->name()) << std::endl;
664 #endif
665 
666  resources_.addElement(newRes);
667  cache_[key] = newRes;
668  }
669  return *cache_[key];
670 }

References TPEF::Section::addElement(), cache_, TPEF::StringSection::chunk2String(), MapTools::containsKey(), TPEF::ResourceElement::id(), lastImmediateUnitId_, TPEF::Section::link(), TPEF::ResourceElement::name(), TTAMachine::Component::name(), resources_, TPEF::ResourceElement::setId(), TPEF::ResourceElement::setName(), TPEF::ResourceElement::setType(), TPEF::StringSection::string2Chunk(), and TPEF::ResourceElement::type().

Referenced by TTAProgram::ProgramWriter::terminalResource().

Here is the call graph for this function:

◆ initCache()

void TTAProgram::TPEFResourceUpdater::initCache ( )
private

Initialises resource updater cache, for finding TPEF resources by machine resources.

This also checks already created TPEF resources to prevent multiple creation of the same ResourceElement.

Definition at line 169 of file ProgramWriter.cc.

169  {
170 
171  for (Word i = 0; i < resources_.elementCount(); i++) {
172  ResourceElement* currRes =
173  dynamic_cast<ResourceElement*>(resources_.element(i));
174 
175  StringSection* strings =
176  dynamic_cast<StringSection*>(resources_.link());
177 
178  std::string resourceName = strings->chunk2String(currRes->name());
179 
180  switch(currRes->type()) {
181 
182  case ResourceElement::MRT_NULL: {
183  abortWithError("There should not be NULL resources.");
184  } break;
185 
186  case ResourceElement::MRT_BUS: {
187  Machine::BusNavigator navi = mach_.busNavigator();
188  assert(navi.hasItem(resourceName));
189  Bus *bus = navi.item(resourceName);
190 
191  cache_[CacheKey(bus, 0)] = currRes;
192  } break;
193 
194  case ResourceElement::MRT_UNIT: {
195  Machine::FunctionUnitNavigator navi =
197  assert(navi.hasItem(resourceName));
198 
199  if (lastFunctionUnitId_ < currRes->id()) {
200  lastFunctionUnitId_ = currRes->id()+1;
201  }
202 
203  FunctionUnit *fu = navi.item(resourceName);
204 
205  cache_[CacheKey(fu, 0)] = currRes;
206  } break;
207 
208  case ResourceElement::MRT_RF: {
209  Machine::RegisterFileNavigator navi =
211  assert(navi.hasItem(resourceName));
212 
213  if (lastRegisterFileId_ < currRes->id()) {
214  lastRegisterFileId_ = currRes->id()+1;
215  }
216 
217  RegisterFile *rf = navi.item(resourceName);
218 
219  cache_[CacheKey(rf, 0)] = currRes;
220  } break;
221 
222  case ResourceElement::MRT_OP: {
223  std::string::size_type dotPos = resourceName.find('.');
224  assert(dotPos != std::string::npos);
225 
226  std::string operName = resourceName.substr(0, dotPos);
227 
228  int operandIndex = Conversion::toInt(
229  resourceName.substr(
230  dotPos+1, resourceName.length() - dotPos - 1));
231 
232  Machine::FunctionUnitNavigator navi =
234 
235  if (lastUnitPortId_ < currRes->id()) {
236  lastUnitPortId_ = currRes->id()+1;
237  }
238 
239  // if function unit has operation by that name, get HWOperation...
240  for (int i = 0; i < navi.count(); i++) {
241  FunctionUnit *fu = navi.item(i);
242  if (fu->hasOperation(operName)) {
243  cache_[CacheKey(fu->operation(operName), operandIndex)] =
244  currRes;
245  }
246  }
247 
248  } break;
249 
250  case ResourceElement::MRT_IMM: {
251  Machine::ImmediateUnitNavigator navi =
253  assert(navi.hasItem(resourceName));
254 
255  if (lastImmediateUnitId_ < currRes->id()) {
256  lastImmediateUnitId_ = currRes->id()+1;
257  }
258 
259  ImmediateUnit* immUnit = navi.item(resourceName);
260 
261  cache_[CacheKey(immUnit, 0)] = currRes;
262 
263  } break;
264 
265  case ResourceElement::MRT_PORT:
266  case ResourceElement::MRT_SR: {
267  Machine::FunctionUnitNavigator navi =
269 
270  if (lastUnitPortId_ < currRes->id()) {
271  lastUnitPortId_ = currRes->id()+1;
272  }
273 
274  // if function unit has port by that name, get port
275  for (int i = 0; i < navi.count(); i++) {
276  FunctionUnit *fu = navi.item(i);
277 
278  if (fu->hasPort(resourceName)) {
279  cache_[CacheKey(fu->port(resourceName), 0)] = currRes;
280  }
281  }
282  } break;
283 
284  default:
285  abortWithError("Unknown resource type.");
286  }
287 
288  }
289 }

References abortWithError, assert, bus(), TTAMachine::Machine::busNavigator(), cache_, TPEF::StringSection::chunk2String(), TPEF::Section::element(), TPEF::Section::elementCount(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::Unit::hasPort(), TPEF::ResourceElement::id(), TTAMachine::Machine::immediateUnitNavigator(), lastFunctionUnitId_, lastImmediateUnitId_, lastRegisterFileId_, lastUnitPortId_, TPEF::Section::link(), mach_, TPEF::ResourceElement::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::port(), TTAMachine::Machine::registerFileNavigator(), resources_, Conversion::toInt(), and TPEF::ResourceElement::type().

Referenced by clearCache(), and TPEFResourceUpdater().

Here is the call graph for this function:

◆ operand()

ResourceElement & TTAProgram::TPEFResourceUpdater::operand ( const TTAMachine::HWOperation oper,
int  operandIndex 
)

Finds and creates ResourceElement for a fu operand given in parameter.

If resource id not already created to TPEF method creates it and adds CacheKey for it.

Parameters
operOperation whose TPEF resource is looked for.
operandIndexIndex of the operand of operation.
Returns
ResourceElement for the operand given in parameter.

Definition at line 464 of file ProgramWriter.cc.

464  {
465 
466  CacheKey key = CacheKey(&oper, operandIndex);
467  if (!MapTools::containsKey(cache_, key)) {
468 
469  ResourceElement *newRes = new ResourceElement();
470 
471  newRes->setType(ResourceElement::MRT_OP);
472  newRes->setId(lastUnitPortId_++);
473 
474  StringSection *strings =
475  dynamic_cast<StringSection*>(resources_.link());
476 
477  newRes->setName(
478  strings->string2Chunk(
479  oper.name() + "." + Conversion::toString(operandIndex)));
480 #if 0
481  std::cerr << "Added MRT_OP resource type: " << newRes->type()
482  << "\tid:" << newRes->id() << "\tname: "
483  << strings->chunk2String(newRes->name()) << std::endl;
484 #endif
485  resources_.addElement(newRes);
486 
487  FunctionUnit *parentUnit = oper.parentUnit();
488 
489  if (parentUnit->hasOperation(oper.name())) {
490  cache_[CacheKey(parentUnit->operation(oper.name()),
491  operandIndex)] = newRes;
492  } else {
494  "Parent unit: " + parentUnit->name() +
495  " didn't contain requested operation:" + oper.name());
496  }
497  }
498  return *cache_[key];
499 }

References abortWithError, TPEF::Section::addElement(), cache_, TPEF::StringSection::chunk2String(), MapTools::containsKey(), TTAMachine::FunctionUnit::hasOperation(), TPEF::ResourceElement::id(), lastUnitPortId_, TPEF::Section::link(), TTAMachine::HWOperation::name(), TPEF::ResourceElement::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::parentUnit(), resources_, TPEF::ResourceElement::setId(), TPEF::ResourceElement::setName(), TPEF::ResourceElement::setType(), TPEF::StringSection::string2Chunk(), Conversion::toString(), and TPEF::ResourceElement::type().

Referenced by TTAProgram::ProgramWriter::createCodeSection(), and TTAProgram::ProgramWriter::terminalResource().

Here is the call graph for this function:

◆ registerFile()

ResourceElement & TTAProgram::TPEFResourceUpdater::registerFile ( const TTAMachine::RegisterFile rf)

Finds and creates ResourceElement for a rf given in parameter.

If resource id not already created to TPEF method creates it and adds CacheKey for it.

Parameters
rfRegister file whose TPEF resource is looked for.
Returns
ResourceElement for the register file given in parameter.

Definition at line 586 of file ProgramWriter.cc.

586  {
587 
588  CacheKey key = CacheKey(&rf, 0);
589  if (!MapTools::containsKey(cache_, key)) {
590  ResourceElement *newRes = new ResourceElement();
591 
592  newRes->setType(ResourceElement::MRT_RF);
593 
594  // check if universal RF
595  UniversalMachine *uMach =
596  dynamic_cast<UniversalMachine*>(rf.machine());
597 
598  if (uMach == NULL) {
599  newRes->setId(lastRegisterFileId_++);
600 
601  } else {
602 
603  // find universal register file
604  if (&rf == &uMach->booleanRegisterFile()) {
605  newRes->setId(ResourceElement::BOOL_RF);
606  } else if (&rf == &uMach->integerRegisterFile()) {
607  newRes->setId(ResourceElement::INT_RF);
608  } else if (&rf == &uMach->doubleRegisterFile()) {
609  newRes->setId(ResourceElement::FP_RF);
610  } else {
612  "Reference to unknown universal register file.");
613  }
614  }
615 
616  StringSection *strings =
617  dynamic_cast<StringSection*>(resources_.link());
618 
619  newRes->setName(strings->string2Chunk(rf.name()));
620 
621 #if 0
622  std::cerr << "added MRT_RF resource type: " << newRes->type()
623  << "\tid:" << newRes->id() << "\tname: "
624  << strings->chunk2String(newRes->name()) << std::endl;
625 #endif
626 
627  resources_.addElement(newRes);
628  cache_[key] = newRes;
629  }
630  return *cache_[key];
631 }

References abortWithError, TPEF::Section::addElement(), UniversalMachine::booleanRegisterFile(), cache_, TPEF::StringSection::chunk2String(), MapTools::containsKey(), UniversalMachine::doubleRegisterFile(), TPEF::ResourceElement::id(), UniversalMachine::integerRegisterFile(), lastRegisterFileId_, TPEF::Section::link(), TTAMachine::Component::machine(), TPEF::ResourceElement::name(), TTAMachine::Component::name(), resources_, TPEF::ResourceElement::setId(), TPEF::ResourceElement::setName(), TPEF::ResourceElement::setType(), TPEF::StringSection::string2Chunk(), and TPEF::ResourceElement::type().

Referenced by TTAProgram::ProgramWriter::createCodeSection(), and TTAProgram::ProgramWriter::terminalResource().

Here is the call graph for this function:

Member Data Documentation

◆ cache_

ResourceCache TTAProgram::TPEFResourceUpdater::cache_
private

Aggregate of all mappings between machine resource entries and target processor parts (machine parts).

Definition at line 116 of file ProgramWriter.hh.

Referenced by bus(), clearCache(), functionUnit(), functionUnitPort(), immediateUnit(), initCache(), operand(), and registerFile().

◆ lastBusId_

HalfWord TTAProgram::TPEFResourceUpdater::lastBusId_
private

Last TPEF bus id that was generated.

Definition at line 119 of file ProgramWriter.hh.

Referenced by bus(), and clearCache().

◆ lastFunctionUnitId_

HalfWord TTAProgram::TPEFResourceUpdater::lastFunctionUnitId_
private

Last TPEF function unit id that was generated.

Definition at line 123 of file ProgramWriter.hh.

Referenced by clearCache(), functionUnit(), and initCache().

◆ lastImmediateUnitId_

HalfWord TTAProgram::TPEFResourceUpdater::lastImmediateUnitId_
private

Last TPEF immediate unit id that was generated.

Definition at line 127 of file ProgramWriter.hh.

Referenced by clearCache(), immediateUnit(), and initCache().

◆ lastRegisterFileId_

HalfWord TTAProgram::TPEFResourceUpdater::lastRegisterFileId_
private

Last TPEF register file id that was generated.

Definition at line 125 of file ProgramWriter.hh.

Referenced by clearCache(), initCache(), and registerFile().

◆ lastUnitPortId_

HalfWord TTAProgram::TPEFResourceUpdater::lastUnitPortId_
private

Last TPEF unit port id that was generated.

Definition at line 121 of file ProgramWriter.hh.

Referenced by clearCache(), functionUnitPort(), initCache(), and operand().

◆ mach_

TTAMachine::Machine& TTAProgram::TPEFResourceUpdater::mach_
private

The model of the target processor architecture.

Definition at line 103 of file ProgramWriter.hh.

Referenced by initCache().

◆ resources_

TPEF::ResourceSection& TTAProgram::TPEFResourceUpdater::resources_
private

The TPEF input section that contains all machine resource entries.

Definition at line 105 of file ProgramWriter.hh.

Referenced by bus(), functionUnit(), functionUnitPort(), immediateUnit(), initCache(), operand(), and registerFile().


The documentation for this class was generated from the following files:
UniversalMachine::integerRegisterFile
UnboundedRegisterFile & integerRegisterFile() const
Definition: UniversalMachine.cc:234
UniversalMachine::booleanRegisterFile
TTAMachine::RegisterFile & booleanRegisterFile() const
Definition: UniversalMachine.cc:221
TTAProgram::TPEFResourceUpdater::mach_
TTAMachine::Machine & mach_
The model of the target processor architecture.
Definition: ProgramWriter.hh:103
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAProgram::TPEFResourceUpdater::lastRegisterFileId_
HalfWord lastRegisterFileId_
Last TPEF register file id that was generated.
Definition: ProgramWriter.hh:125
TPEF::ResourceElement::id
HalfWord id() const
TTAProgram::TPEFResourceUpdater::CacheKey
std::pair< const TTAMachine::MachinePart *, int > CacheKey
Definition: ProgramWriter.hh:109
UniversalMachine::universalBus
TTAMachine::Bus & universalBus() const
Definition: UniversalMachine.cc:306
TTAMachine::Bus
Definition: Bus.hh:53
TPEF::ResourceElement::type
ResourceType type() const
TPEF::ResourceElement
Definition: ResourceElement.hh:47
UniversalMachine::doubleRegisterFile
UnboundedRegisterFile & doubleRegisterFile() const
Definition: UniversalMachine.cc:251
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
TPEF::StringSection::chunk2String
std::string chunk2String(const Chunk *chunk) const
Definition: StringSection.cc:72
TTAProgram::TPEFResourceUpdater::cache_
ResourceCache cache_
Aggregate of all mappings between machine resource entries and target processor parts (machine parts)...
Definition: ProgramWriter.hh:116
Conversion::toString
static std::string toString(const T &source)
TPEF::ResourceElement::setType
void setType(ResourceType aType)
TPEF::StringSection
Definition: StringSection.hh:48
TTAProgram::TPEFResourceUpdater::lastFunctionUnitId_
HalfWord lastFunctionUnitId_
Last TPEF function unit id that was generated.
Definition: ProgramWriter.hh:123
TPEF::ResourceElement::name
Chunk * name() const
TPEF::Section::link
Section * link() const
TPEF::Section::element
SectionElement * element(Word index) const
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TPEF::Section::addElement
virtual void addElement(SectionElement *element)
Definition: Section.cc:133
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAProgram::TPEFResourceUpdater::resources_
TPEF::ResourceSection & resources_
The TPEF input section that contains all machine resource entries.
Definition: ProgramWriter.hh:105
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
TTAMachine::SpecialRegisterPort
Definition: SpecialRegisterPort.hh:48
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
TTAMachine::Machine::immediateUnitNavigator
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition: Machine.cc:416
TTAProgram::TPEFResourceUpdater::lastImmediateUnitId_
HalfWord lastImmediateUnitId_
Last TPEF immediate unit id that was generated.
Definition: ProgramWriter.hh:127
UniversalMachine
Definition: UniversalMachine.hh:56
TPEF::StringSection::string2Chunk
Chunk * string2Chunk(const std::string &str)
Definition: StringSection.cc:103
TTAProgram::TPEFResourceUpdater::bus
TPEF::ResourceElement & bus(const TTAMachine::Bus &bus)
Definition: ProgramWriter.cc:317
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
TTAMachine::Unit::hasPort
virtual bool hasPort(const std::string &name) const
Definition: Unit.cc:96
TTAMachine::FunctionUnit::hasOperation
virtual bool hasOperation(const std::string &name) const
Definition: FunctionUnit.cc:330
TTAProgram::TPEFResourceUpdater::initCache
void initCache()
Definition: ProgramWriter.cc:169
UniversalMachine::universalFunctionUnit
UniversalFunctionUnit & universalFunctionUnit() const
Definition: UniversalMachine.cc:205
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
TTAMachine::Component::machine
virtual Machine * machine() const
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
TTAMachine::HWOperation::parentUnit
FunctionUnit * parentUnit() const
Definition: HWOperation.cc:190
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
TTAProgram::TPEFResourceUpdater::lastBusId_
HalfWord lastBusId_
Last TPEF bus id that was generated.
Definition: ProgramWriter.hh:119
TPEF::ResourceElement::setId
void setId(HalfWord aId)
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
Conversion::toInt
static int toInt(const T &source)
TTAMachine::ControlUnit::returnAddressPort
SpecialRegisterPort * returnAddressPort() const
Definition: ControlUnit.cc:307
TTAProgram::TPEFResourceUpdater::lastUnitPortId_
HalfWord lastUnitPortId_
Last TPEF unit port id that was generated.
Definition: ProgramWriter.hh:121
TPEF::ResourceElement::setName
void setName(ReferenceManager::SafePointer *aName)
TTAMachine::ControlUnit::hasReturnAddressPort
bool hasReturnAddressPort() const
Definition: ControlUnit.cc:295
TPEF::Section::elementCount
Word elementCount() const
TTAMachine::Port::parentUnit
Unit * parentUnit() const
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50