OpenASIP  2.0
FunctionUnit.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file FunctionUnit.cc
26  *
27  * Implementation of class FunctionUnit.
28  *
29  * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30  */
31 
32 #include "FunctionUnit.hh"
33 #include "HWOperation.hh"
34 #include "ExecutionPipeline.hh"
35 #include "Machine.hh"
36 #include "FUPort.hh"
37 #include "Guard.hh"
38 #include "AddressSpace.hh"
39 #include "ControlUnit.hh"
40 #include "PipelineElement.hh"
41 #include "MOMTextGenerator.hh"
42 #include "Application.hh"
43 #include "ContainerTools.hh"
44 #include "StringTools.hh"
45 #include "ResourceVector.hh"
46 #include "ResourceVectorSet.hh"
47 #include "CIStringSet.hh"
48 #include "ObjectState.hh"
49 
50 using std::string;
51 using boost::format;
52 
53 namespace TTAMachine {
54 
55 // initialization of static data members
56 const string FunctionUnit::OSNAME_FU = "fu";
57 const string FunctionUnit::OSKEY_AS = "as";
58 const string FunctionUnit::OSKEY_ORDER_NUMBER = "order_no";
59 
60 /**
61  * Constructor.
62  *
63  * @param name Name of the function unit.
64  * @exception InvalidName If the given name is not a valid component name.
65  */
66 FunctionUnit::FunctionUnit(const string& name)
67  : Unit(name), addressSpace_(NULL), orderNumber_(0) {}
68 
69 /**
70  * Constructor.
71  *
72  * Loads the state of the function unit from the given ObjectState instance.
73  * Does not load references to other components.
74  *
75  * @param state The ObjectState instance to load the state from.
76  * @exception ObjectStateLoadingException If the given ObjectState instance
77  * is invalid.
78  */
80  : Unit(state), addressSpace_(NULL), orderNumber_(0) {
82 }
83 
84 /**
85  * Destructor.
86  *
87  * Deletes all the operations.
88  */
90  unsetMachine();
92 }
93 
94 
95 /**
96  * Copies the instance.
97  *
98  * Current FunctionUnit state is copied to a new FunctionUnit object.
99  *
100  * @return Copy of the instance.
101  */
104 
105  return new FunctionUnit(saveState());
106 }
107 
108 
109 /**
110  * Sets the name of the function unit.
111  *
112  * @param name Name of the function unit.
113  * @exception ComponentAlreadyExists If a function unit with the given name
114  * is already in the same machine.
115  * @exception InvalidName If the given name is not a valid component name.
116  */
117 void
118 FunctionUnit::setName(const string& name) {
119  if (name == this->name()) {
120  return;
121  }
122 
123  if (machine() != NULL) {
124  if (machine()->functionUnitNavigator().hasItem(name) ||
125  (machine()->controlUnit() != NULL &&
126  machine()->controlUnit()->name() == name)) {
127  string procName = "FunctionUnit::setName";
128  throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
129  } else {
131  }
132  } else {
134  }
135 }
136 
137 /**
138  * Returns the requested port.
139  *
140  * @param name Name of the port.
141  * @return The requested port.
142  * @exception InstanceNotFound If there is no port by the given name.
143  */
144 BaseFUPort*
145 FunctionUnit::port(const std::string& name) const {
146  if (!hasPort(name)) {
147  string procName = "FunctionUnit::port";
148  throw InstanceNotFound(__FILE__, __LINE__, procName);
149  }
150 
151  Port* port = Unit::port(name);
152  BaseFUPort* fuPort = dynamic_cast<BaseFUPort*>(port);
153  assert(fuPort != NULL);
154  return fuPort;
155 }
156 
157 /**
158  * Returns port by the given index.
159  *
160  * The index must be between 0 and the return value of numberOfPorts() - 1.
161  *
162  * @param index Index.
163  * @return The port found by the given index.
164  * @exception OutOfRange If the given index is out of range.
165  */
166 BaseFUPort*
167 FunctionUnit::port(int index) const {
168  // the out of range test is already done in Unit::Port,
169  // no need to do it here also.
170  return static_cast<BaseFUPort*>(Unit::port(index));
171 }
172 
173 /**
174  * Returns the number of port used for inputs and outputs of operations.
175  *
176  * Control unit may contain also ports for special registers. Those ports
177  * are ignored by this method.
178  *
179  * @return The number of operation ports.
180  */
181 int
183 
184  int portCount = this->portCount();
185  int opCount = 0;
186 
187  for (int i = 0; i < portCount; i++) {
188  Port* port = Unit::port(i);
189  if (dynamic_cast<FUPort*>(port) != NULL) {
190  opCount++;
191  }
192  }
193  return opCount;
194 }
195 
196 
197 /**
198  * Tells whether the function unit has an operation port with the given name.
199  *
200  * @param name Name of the port.
201  * @return True if the function unit has the operation port, otherwise false.
202  */
203 bool
204 FunctionUnit::hasOperationPort(const std::string& name) const {
205  if (!hasPort(name)) {
206  return false;
207  } else {
208  Port* port = this->port(name);
209  return dynamic_cast<FUPort*>(port) != NULL;
210  }
211 }
212 
213 
214 /**
215  * Returns an operation port by the given name.
216  *
217  * Operation port is a port which can be read or written by an operation.
218  *
219  * @param name Name of the port.
220  * @return The requested port.
221  * @exception InstanceNotFound If the requested port does not exist.
222  */
223 FUPort*
224 FunctionUnit::operationPort(const std::string& name) const {
225  Port* port = Unit::port(name);
226  FUPort* fuPort = dynamic_cast<FUPort*>(port);
227  if (fuPort == NULL) {
228  const string procName = "FunctionUnit::operationPort";
229  throw InstanceNotFound(__FILE__, __LINE__, procName);
230  }
231  return fuPort;
232 }
233 
234 /**
235  * Returns an operation port by the given index.
236  *
237  * Operation port is a port which can be read or written by an operation.
238  *
239  * @param index The index.
240  * @return The port found by the given index.
241  * @exception OutOfRange If the given index is less than 0 or greater or
242  * equal to the number of operation ports.
243  */
244 FUPort*
245 FunctionUnit::operationPort(int index) const {
246  int portCount = this->portCount();
247  int current(-1);
248 
249  for (int i = 0; i < portCount; i++) {
250  Port* port = Unit::port(i);
251  if (dynamic_cast<FUPort*>(port) != NULL) {
252  current++;
253  if (current == index) {
254  return dynamic_cast<FUPort*>(port);
255  }
256  }
257  }
258 
259  const string procName = "FunctionUnit::operandPort";
260  throw OutOfRange(__FILE__, __LINE__, procName);
261 }
262 
263 /**
264  * Returns triggering port if found. Otherwise returns NULL.
265  */
266 BaseFUPort*
268  int portc = portCount();
269  for (int i = 0; i < portc; i++) {
270  if (port(i)->isTriggering()) {
271  return port(i);
272  }
273  }
274  return NULL;
275 }
276 
277 /**
278  * Adds an operation into the function unit. This method is called from
279  * HWOperation constructor. Do not use this method.
280  *
281  * @param operation Operation which is added.
282  * @exception ComponentAlreadyExists If there is already an operation by the
283  * same name as the given operation.
284  */
285 void
287  // run time check that this method is called from HWOperation constructor
288  // only.
289  assert(operation.parentUnit() == NULL);
290 
292  operations_.push_back(&operation);
293  } else {
294  string procName = "FunctionUnit::addOperation";
295  throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
296  }
297 }
298 
299 /**
300  * Deletes an operation from the function unit.
301  *
302  * Destructor of the operation is called.
303  *
304  * @param operation Operation to be deleted.
305  * @exception InstanceNotFound If the given operation doesn't belong to this
306  * function unit.
307  */
308 void
310  if (operation.parentUnit() == NULL) {
312  &operation);
313  assert(removed);
314  } else {
316  string procName = "FunctionUnit::deleteOperation";
317  throw InstanceNotFound(__FILE__, __LINE__, procName);
318  }
319  delete &operation;
320  }
321 }
322 
323 /**
324  * Returns true if the requested operation exists in the function unit.
325  *
326  * @param operation Name of the operation.
327  * @return True if the requested operation exists in the function unit.
328  */
329 bool
330 FunctionUnit::hasOperation(const std::string& name) const {
332 }
333 
334 /**
335  * Returns true if the requested operation exists in the function unit.
336  *
337  * @param operation Name of the operation which MUST be in lowercase.
338  * @return True if the requested operation exists in the function unit.
339  */
340 bool
341 FunctionUnit::hasOperationLowercase(const std::string& name) const {
342  OperationTable::const_iterator iter = operations_.begin();
343  while (iter != operations_.end()) {
344  if ((*iter)->name() == name) {
345  return true;
346  }
347  iter++;
348  }
349  return false;
350 }
351 
352 /**
353  * Returns operation by the given name.
354  *
355  * The requested operation must exist, otherwise assertion fails.
356  *
357  * @param name Name of the operation.
358  * @return Operation by the given name.
359  * @exception InstanceNotFound If an operation is not found by the given
360  * name.
361  */
363 FunctionUnit::operation(const string& name) const {
365 }
366 
367 /**
368  * Returns operation by the given name.
369  *
370  * The requested operation must exist, otherwise assertion fails.
371  *
372  * @param name Name of the operation.
373  * @return Operation by the given name which MUST be in lowercase.
374  * @exception InstanceNotFound If an operation is not found by the given
375  * name.
376  */
378 FunctionUnit::operationLowercase(const string& name) const {
379  OperationTable::const_iterator iter = operations_.begin();
380  while (iter != operations_.end()) {
381  if ((*iter)->name() == name) {
382  return *iter;
383  }
384  iter++;
385  }
386 
387  string procName = "FunctionUnit::operation";
388  throw InstanceNotFound(
389  __FILE__, __LINE__, procName,"Operation not found:" + name );
390 }
391 
392 /**
393  * Returns operation by the given index.
394  *
395  * The value of given index must be between 0 and the return value of
396  * operationCount() - 1.
397  *
398  * @param index Index.
399  * @return Operation by the given index.
400  * @exception OutOfRange If the given index is less than zero or greater or
401  * equal to the number of operations in the function
402  * unit.
403  */
405 FunctionUnit::operation(int index) const {
406  if (index < 0 || index >= operationCount()) {
407  string procName = "FunctionUnit::operation";
408  throw OutOfRange(__FILE__, __LINE__, procName);
409  }
410  return operations_[index];
411 }
412 
413 /**
414  * Returns the number of operations in the function unit.
415  *
416  * @return The number of operations in the function unit.
417  */
418 int
420  return operations_.size();
421 }
422 
423 
424 /**
425  * Adds FUs operations to the set given as a parameter.
426  */
427 void
429  OperationTable::const_iterator iter = operations_.begin();
430  while (iter != operations_.end()) {
431  opNames.insert((*iter)->name());
432  ++iter;
433  }
434 }
435 
436 
437 /**
438  * Returns the maximum latency among the operations of the function unit.
439  *
440  * @return The maximum latency.
441  */
442 int
444  int max(0);
445  for (int i = 0; i < operationCount(); i++) {
446  if (operation(i)->latency() > max) {
447  max = operation(i)->latency();
448  }
449  }
450  return max;
451 }
452 
453 
454 /**
455  * Adds a pipeline element to the function unit.
456  *
457  * Pipeline elements are added automatically if some operation uses it.
458  * Clients must not add pipeline elements explicitly. PipelineElement adds
459  * itself automatically to the parent function when it is created.
460  *
461  * @param name Name of the pipeline element.
462  * @exception ComponentAlreadyExists If there is already a pipeline element
463  * by the given name.
464  */
465 void
467  // sanity check to verify that this is called from PipelineElement's
468  // constructor
469  assert(element.parentUnit() == NULL);
470 
471  string name = element.name();
472  if (hasPipelineElement(name)) {
473  string procName = "FunctionUnit::addPipelineElement";
474  throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
475  } else {
476  pipelineElements_.push_back(&element);
477  }
478 }
479 
480 /**
481  * Deletes the given pipeline element from function unit.
482  *
483  * The pipeline element is automatically deleted if it is not used by any
484  * of the operations. Clients must not use this method!
485  *
486  * @param element The pipeline element to delete.
487  */
488 void
490 
491  // sanity check to verify that this is called from PipelineElement's
492  // destructor.
493  assert(element.parentUnit() == NULL);
494 
496  pipelineElements_, &element);
497  assert(removed);
498 }
499 
500 
501 /**
502  * Returns the number of pipeline elements in the function unit.
503  *
504  * @return The number of pipeline elements.
505  */
506 int
508  return pipelineElements_.size();
509 }
510 
511 
512 /**
513  * Returns a pipeline element by the given index.
514  *
515  * The index must be greater or equal to 0 and less than the number of
516  * pipeline elements in the function unit.
517  *
518  * @param index The index.
519  * @return A pipeline element by the given index.
520  * @exception OutOfRange If the given index is out of range.
521  */
524  if (index < 0 || index >= pipelineElementCount()) {
525  string procName = "FunctionUnit::pipelineElement";
526  throw OutOfRange(__FILE__, __LINE__, procName);
527  }
528 
529  return pipelineElements_[index];
530 }
531 
532 /**
533  * Returns true if the function unit has a pipeline element by the given
534  * name.
535  *
536  * @return True if the function unit has a pipeline element by the given
537  * name.
538  */
539 bool
540 FunctionUnit::hasPipelineElement(const std::string& name) const {
541  PipelineElementTable::const_iterator iter = pipelineElements_.begin();
542  while (iter != pipelineElements_.end()) {
543  if ((*iter)->name() == name) {
544  return true;
545  }
546  iter++;
547  }
548  return false;
549 }
550 
551 
552 /**
553  * Returns the pipeline element which has the given name.
554  *
555  * @param name Name of the pipeline element.
556  * @return The pipeline element which has the given name, or NULL
557  * If there is no pipeline element by the given
558  * name.
559  */
561 FunctionUnit::pipelineElement(const std::string& name) const {
562 
563  PipelineElementTable::const_iterator iter = pipelineElements_.begin();
564  while (iter != pipelineElements_.end()) {
565  if ((*iter)->name() == name) {
566  return *iter;
567  }
568  iter++;
569  }
570  return NULL;
571 }
572 
573 
574 /**
575  * Returns the address space used by the function unit.
576  *
577  * @return The address space used by the function unit.
578  */
581  return addressSpace_;
582 }
583 
584 
585 /**
586  * Adds an address space which can be accessed by the function unit.
587  *
588  * @param as Address space which can be accessed.
589  * @exception IllegalRegistration If the given address space and the function
590  * unit are not registrered to the same
591  * machine.
592  */
593 void
595  if (as != NULL) {
596  ensureRegistration(*as);
597  }
598 
599  addressSpace_ = as;
600 }
601 
602 /**
603  * Returns true if the address space is set.
604  *
605  * @return True if the address space is set.
606  */
607 bool
609 
610  if (addressSpace_ == NULL) {
611  return false;
612  }
613  return true;
614 }
615 
616 
617 /**
618  * Deletes a pipeline element by the given name if it is not used by any
619  * operation.
620  */
621 void
622 FunctionUnit::cleanup(const std::string& resource) {
623 
624  if (!hasPipelineElement(resource)) {
625  return;
626  }
627 
628  for (int i = 0; i < operationCount(); i++) {
629  HWOperation* operation = this->operation(i);
631  for (int cycle = 0; cycle < pLine->latency(); cycle++) {
632  if (pLine->isResourceUsed(resource, cycle)) {
633  return;
634  }
635  }
636  }
637 
638 
639  PipelineElement* toDelete = pipelineElement(resource);
640  delete toDelete;
641 }
642 
643 
644 /**
645  * Removes registration of the function unit from its current machine.
646  */
647 void
649 
650  if (machine() == NULL) {
651  return;
652  }
653 
654  cleanupGuards();
655  Machine* mach = machine();
657  mach->removeFunctionUnit(*this);
658 }
659 
660 
661 /**
662  * Removes function unit part of a derived class from machine.
663  */
664 void
666  addressSpace_ = NULL;
668 }
669 
670 
671 /**
672  * Saves the contents to an ObjectState tree.
673  *
674  * @return The newly created ObjectState tree.
675  */
678 
679  ObjectState* fuState = Unit::saveState();
680  fuState->setName(OSNAME_FU);
682  // set address space
683  if (addressSpace_ != NULL) {
684  fuState->setAttribute(OSKEY_AS, addressSpace_->name());
685  }
686 
687  // add operations
688  for (int i = 0; i < operationCount(); i++) {
689  HWOperation* operation = this->operation(i);
690  fuState->addChild(operation->saveState());
691  }
692 
693  return fuState;
694 }
695 
696 
697 /**
698  * Loads its state from the given ObjectState instance.
699  *
700  * @param state The ObjectState instance.
701  * @exception ObjectStateLoadingException If the given ObjectState instance
702  * is invalid or if connections to
703  * other machine parts cannot be made.
704  */
705 void
707  const string procName = "FunctionUnit::loadState";
708 
709  Unit::loadState(state);
711 
712  try {
713  // set address space
714  if (state->hasAttribute(OSKEY_AS)) {
715  MOMTextGenerator textGenerator;
718  string asName = state->stringAttribute(OSKEY_AS);
719  if (!isRegistered() || !asNav.hasItem(asName)) {
720  format errorMsg = textGenerator.text(MOMTextGenerator::
721  TXT_FU_REF_LOAD_ERR_AS);
722  errorMsg % asName % name();
724  __FILE__, __LINE__, procName, errorMsg.str());
725  } else {
726  setAddressSpace(asNav.item(asName));
727  }
728  }
729 
730  } catch (const Exception& e) {
732  __FILE__, __LINE__, procName, e.errorMessage());
733  }
734 }
735 
736 /**
737  * Compares two FunctionUnit architectures.
738  *
739  * Names are not compared. Port width comparison can be omitted.
740  *
741  * @param fu Function unit to compare with.
742  * @param checkPortWidths Boolean for if port widths are matched or not.
743  * Defaul is true.
744  * @return True if the architectures match otherwise false.
745  */
746 bool
748  const FunctionUnit* fu, const bool checkPortWidths) const {
749  if (operationCount() != fu->operationCount()) {
750  return false;
751  }
752  int fuPortCount = fu->operationPortCount();
753  if (operationPortCount() != fuPortCount) {
754  return false;
755  }
756  int fuPipelineElementCount = fu->pipelineElementCount();
757  if (pipelineElementCount() != fuPipelineElementCount) {
758  return false;
759  }
760  if (addressSpace() != NULL && fu->addressSpace() != NULL) {
761  if (addressSpace()->name() != fu->addressSpace()->name()) {
762  return false;
763  }
764  } else if ((addressSpace() == NULL && fu->addressSpace() != NULL) ||
765  (addressSpace() != NULL && fu->addressSpace() == NULL)) {
766  return false;
767  }
768  for (int i = 0; i < fuPipelineElementCount; i++) {
769  string element = pipelineElement(i)->name();
770  if (fu->hasPipelineElement(element)) {
771  return false;
772  }
773  }
774  for (int i = 0; i < fuPortCount; i++) {
775  if (checkPortWidths) {
777  return false;
778  }
779  } else {
780  if (operationPort(i)->isTriggering() !=
781  fu->operationPort(i)->isTriggering()) {
782  return false;
783  }
784  if (operationPort(i)->isOpcodeSetting() !=
785  fu->operationPort(i)->isOpcodeSetting()) {
786  return false;
787  }
788  }
789  }
790  if (!(ResourceVectorSet(*this) == ResourceVectorSet(*fu))) {
791  return false;
792  }
793  return true;
794 }
795 
796 
797 /**
798  * Checks if all the operations in the FU have the same latency and there are
799  * no shared resources.
800  *
801  * @return True if the FU needs conflict detection
802  */
803 bool
805 
806  if (operationCount() == 0) {
807  return false;
808  }
809 
810  // same latency for all operations?
811  const int latency = operation(0)->latency();
812  for (int i = 1; i < operationCount(); ++i) {
813  if (latency != operation(i)->latency()) {
814  return true;
815  }
816  }
817 
818  if (pipelineElementCount() == 0) {
819  return false;
820  }
821 
822  return true;
823 }
824 
825 
826 /**
827  * Cleans up the guards that refer to a port of this function unit.
828  */
829 void
831 
832  Machine* mach = machine();
833  if (mach == NULL) {
834  return;
835  }
836 
837  Machine::BusNavigator navi = mach->busNavigator();
838  for (int busIndex = 0; busIndex < navi.count(); busIndex++) {
839  Bus* bus = navi.item(busIndex);
840  int guardIndex = 0;
841  while (guardIndex < bus->guardCount()) {
842  Guard* guard = bus->guard(guardIndex);
843  PortGuard* portGuard =
844  dynamic_cast<PortGuard*>(guard);
845  if (portGuard != NULL) {
846  BaseFUPort* port = portGuard->port();
847  FunctionUnit* referenced = port->parentUnit();
848  if (referenced == this) {
849 
850  // guard is removed from bus automatically
851  delete portGuard;
852  } else {
853  guardIndex++;
854  }
855  } else {
856  guardIndex++;
857  }
858  }
859  }
860 }
861 
862 
863 /**
864  * Loads the state of the function unit without references to other
865  * components.
866  *
867  * @param fuState The ObjectState instance from which the state is loaded.
868  * @exception ObjectStateLoadingException If an error occurs while loading
869  * the state.
870  */
871 void
874  addressSpace_ = NULL;
875 
878  }
879 
880  try {
881  // load operations
882  for (int i = 0; i < fuState->childCount(); i++) {
883  ObjectState* child = fuState->child(i);
884  if (child->name() == HWOperation::OSNAME_OPERATION) {
885  new HWOperation(child, *this);
886  }
887  }
888  } catch (const Exception& e) {
889  const string procName = "FunctionUnit::loadStateWithoutReferences";
891  __FILE__, __LINE__, procName, e.errorMessage());
892  }
893 }
894 
895 /**
896  * Deletes all the operations of the function unit.
897  */
898 void
900  while (operations_.size() > 0) {
901  delete operations_[0];
902  }
903 }
904 
905 /**
906  * Returns the order number of the FU.
907  *
908  * In certain architectures (Cell SPU) the "relative order" of the function
909  * units matters when it comes to accessing same register by multiple operations
910  * in the same cycle.
911  * This method returns number indicating possition of the FU in the ADF file.
912  * Alows putting the FU into the order in the instruction.
913  */
914 int
916  return orderNumber_;
917 }
918 
919 /**
920  * Sets order number of the FU.
921  *
922  * In certain architectures (Cell SPU) the "relative order" of the function
923  * units matters when it comes to accessing same register by multiple operations
924  * in the same cycle.
925  * This method sets number indicating possition of the FU in the ADF file.
926  */
927 void
929  orderNumber_ = number;
930 }
931 }
TTAMachine::Machine::removeFunctionUnit
virtual void removeFunctionUnit(FunctionUnit &unit)
Definition: Machine.cc:530
TTAMachine::Guard
Definition: Guard.hh:55
TTAMachine::HWOperation::OSNAME_OPERATION
static const std::string OSNAME_OPERATION
ObjectState name for HWOperation.
Definition: HWOperation.hh:82
ObjectState::hasAttribute
bool hasAttribute(const std::string &name) const
Definition: ObjectState.cc:205
TTAMachine::Component::setName
virtual void setName(const std::string &name)
Definition: MachinePart.cc:142
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
TTAMachine::FunctionUnit::OSNAME_FU
static const std::string OSNAME_FU
ObjectState name for function unit.
Definition: FunctionUnit.hh:117
TTAMachine::PortGuard::port
FUPort * port() const
TTAMachine::Component::isRegistered
virtual bool isRegistered() const
Definition: MachinePart.cc:177
TTAMachine::FunctionUnit::hasAddressSpace
virtual bool hasAddressSpace() const
Definition: FunctionUnit.cc:608
TTAMachine::FunctionUnit::FunctionUnit
FunctionUnit(const std::string &name)
Definition: FunctionUnit.cc:66
TTAMachine::FUPort::isOpcodeSetting
virtual bool isOpcodeSetting() const
Definition: FUPort.cc:195
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::FunctionUnit::OSKEY_ORDER_NUMBER
static const std::string OSKEY_ORDER_NUMBER
ObjectState attribute key for FU order number name.
Definition: FunctionUnit.hh:121
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
ExecutionPipeline.hh
ObjectStateLoadingException
Definition: Exception.hh:551
TTAMachine::BaseFUPort::parentUnit
FunctionUnit * parentUnit() const
Definition: BaseFUPort.cc:96
TTAMachine::FunctionUnit::cleanup
virtual void cleanup(const std::string &resource)
Definition: FunctionUnit.cc:622
TTAMachine::Component::ensureRegistration
virtual void ensureRegistration(const Component &component) const
Definition: MachinePart.cc:163
TTAMachine::FunctionUnit::triggerPort
virtual BaseFUPort * triggerPort() const
Definition: FunctionUnit.cc:267
OutOfRange
Definition: Exception.hh:320
TTAMachine::Bus
Definition: Bus.hh:53
TTAMachine::BaseFUPort
Definition: BaseFUPort.hh:44
TTAMachine::FunctionUnit::addPipelineElement
virtual void addPipelineElement(PipelineElement &element)
Definition: FunctionUnit.cc:466
TTAMachine::FunctionUnit::loadStateWithoutReferences
void loadStateWithoutReferences(const ObjectState *fuState)
Definition: FunctionUnit.cc:872
TTAMachine::HWOperation::saveState
virtual ObjectState * saveState() const
Definition: HWOperation.cc:424
ResourceVectorSet.hh
TTAMachine::FunctionUnit::operationLowercase
virtual HWOperation * operationLowercase(const std::string &name) const
Definition: FunctionUnit.cc:378
AddressSpace.hh
TTAMachine::FunctionUnit::unsetMachine
virtual void unsetMachine()
Definition: FunctionUnit.cc:648
TTAMachine::ResourceVectorSet
Definition: ResourceVectorSet.hh:47
TTAMachine::Unit::loadState
virtual void loadState(const ObjectState *state)
Definition: Unit.cc:309
ObjectState
Definition: ObjectState.hh:59
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
TTAMachine::FunctionUnit::~FunctionUnit
virtual ~FunctionUnit()
Definition: FunctionUnit.cc:89
TTAMachine::FunctionUnit::addressSpace
virtual AddressSpace * addressSpace() const
Definition: FunctionUnit.cc:580
TTAMachine::PipelineElement::name
const std::string & name() const
TTAMachine::Machine::Navigator::count
int count() const
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
ObjectState::setName
void setName(const std::string &name)
TTAMachine::FUPort::isTriggering
virtual bool isTriggering() const
Definition: FUPort.cc:182
TTAMachine::FunctionUnit::maxLatency
virtual int maxLatency() const
Definition: FunctionUnit.cc:443
TTAMachine::FunctionUnit::deleteAllOperations
void deleteAllOperations()
Definition: FunctionUnit.cc:899
StringTools.hh
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAMachine::Unit::saveState
virtual ObjectState * saveState() const
Definition: Unit.cc:285
TTAMachine::FunctionUnit::cleanupGuards
void cleanupGuards() const
Definition: FunctionUnit.cc:830
HWOperation.hh
TTAMachine::Unit
Definition: Unit.hh:51
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
CIStringSet.hh
TTAMachine::FunctionUnit::pipelineElement
virtual PipelineElement * pipelineElement(int index) const
Definition: FunctionUnit.cc:523
ContainerTools::removeValueIfExists
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)
TTAMachine::Port
Definition: Port.hh:54
TTAMachine::Machine::Navigator::hasItem
bool hasItem(const std::string &name) const
Application.hh
TTAMachine::Unit::port
virtual Port * port(const std::string &name) const
Definition: Unit.cc:116
ObjectState.hh
TCETools::CIStringSet
std::set< TCEString, CaseInsensitiveCmp > CIStringSet
Definition: CIStringSet.hh:49
ResourceVector.hh
Guard.hh
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
TTAMachine::Unit::hasPort
virtual bool hasPort(const std::string &name) const
Definition: Unit.cc:96
ObjectState::childCount
int childCount() const
TTAMachine::FunctionUnit::hasOperation
virtual bool hasOperation(const std::string &name) const
Definition: FunctionUnit.cc:330
Machine.hh
Exception
Definition: Exception.hh:54
TTAMachine::FunctionUnit::setAddressSpace
virtual void setAddressSpace(AddressSpace *as)
Definition: FunctionUnit.cc:594
TTAMachine::Machine::addressSpaceNavigator
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition: Machine.cc:392
TTAMachine::FunctionUnit::operationPortCount
virtual int operationPortCount() const
Definition: FunctionUnit.cc:182
TTAMachine::FunctionUnit::saveState
virtual ObjectState * saveState() const
Definition: FunctionUnit.cc:677
ObjectState::name
std::string name() const
TTAMachine::Bus::guard
Guard * guard(int index) const
Definition: Bus.cc:456
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
TTAMachine::FunctionUnit::operations_
OperationTable operations_
Contains all the operations of the function unit.
Definition: FunctionUnit.hh:139
TTAMachine::FunctionUnit::pipelineElementCount
virtual int pipelineElementCount() const
Definition: FunctionUnit.cc:507
TTAMachine::FunctionUnit::orderNumber
virtual int orderNumber() const
Definition: FunctionUnit.cc:915
TTAMachine::FunctionUnit::hasOperationPort
virtual bool hasOperationPort(const std::string &name) const
Definition: FunctionUnit.cc:204
TTAMachine::PipelineElement::parentUnit
FunctionUnit * parentUnit() const
TTAMachine::PipelineElement
Definition: PipelineElement.hh:46
TTAMachine::FunctionUnit::pipelineElements_
PipelineElementTable pipelineElements_
Contains all the pipeline elements of the function unit.
Definition: FunctionUnit.hh:142
TTAMachine::FunctionUnit::addOperation
virtual void addOperation(HWOperation &operation)
Definition: FunctionUnit.cc:286
TTAMachine::FunctionUnit::hasOperationLowercase
virtual bool hasOperationLowercase(const std::string &name) const
Definition: FunctionUnit.cc:341
TTAMachine::Component::machine
virtual Machine * machine() const
MOMTextGenerator
Definition: MOMTextGenerator.hh:40
FUPort.hh
TTAMachine::HWOperation::parentUnit
FunctionUnit * parentUnit() const
Definition: HWOperation.cc:190
ControlUnit.hh
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
PipelineElement.hh
ComponentAlreadyExists
Definition: Exception.hh:510
TTAMachine::FunctionUnit::needsConflictDetection
bool needsConflictDetection() const
Definition: FunctionUnit.cc:804
MOMTextGenerator.hh
TTAMachine::FunctionUnit::loadState
virtual void loadState(const ObjectState *state)
Definition: FunctionUnit.cc:706
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
TTAMachine::HWOperation::pipeline
ExecutionPipeline * pipeline() const
Definition: HWOperation.cc:201
TTAMachine::ExecutionPipeline
Definition: ExecutionPipeline.hh:55
TTAMachine::FunctionUnit::deletePipelineElement
virtual void deletePipelineElement(PipelineElement &element)
Definition: FunctionUnit.cc:489
TTAMachine::FunctionUnit::unsetMachineDerived
void unsetMachineDerived()
Definition: FunctionUnit.cc:665
ContainerTools::containsValue
static bool containsValue(const ContainerType &aContainer, const ElementType &aKey)
TTAMachine::FunctionUnit::addressSpace_
AddressSpace * addressSpace_
Address space used by the function unit.
Definition: FunctionUnit.hh:145
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
TTAMachine::PortGuard
Definition: Guard.hh:99
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
TTAMachine::HWOperation::latency
int latency() const
Definition: HWOperation.cc:216
TTAMachine::FunctionUnit::operationPort
virtual FUPort * operationPort(const std::string &name) const
Definition: FunctionUnit.cc:224
TTAMachine
Definition: Assembler.hh:48
TTAMachine::FunctionUnit::orderNumber_
int orderNumber_
Number indicating possition of the FU in the ADF file. Alows putting the FU into the order in the ins...
Definition: FunctionUnit.hh:149
TTAMachine::ExecutionPipeline::latency
int latency() const
Definition: ExecutionPipeline.cc:482
TTAMachine::FunctionUnit::hasPipelineElement
virtual bool hasPipelineElement(const std::string &name) const
Definition: FunctionUnit.cc:540
TTAMachine::FunctionUnit::setOrderNumber
virtual void setOrderNumber(int)
Definition: FunctionUnit.cc:928
TTAMachine::FunctionUnit::copy
virtual FunctionUnit * copy() const
Definition: FunctionUnit.cc:103
TTAMachine::FunctionUnit::setName
virtual void setName(const std::string &name)
Definition: FunctionUnit.cc:118
TTAMachine::Unit::unsetMachine
virtual void unsetMachine()
Definition: Unit.cc:262
TTAMachine::FunctionUnit::deleteOperation
virtual void deleteOperation(HWOperation &operation)
Definition: FunctionUnit.cc:309
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
TTAMachine::FunctionUnit::OSKEY_AS
static const std::string OSKEY_AS
ObjectState attribute key for name of the address space.
Definition: FunctionUnit.hh:119
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
TTAMachine::FunctionUnit::isArchitectureEqual
virtual bool isArchitectureEqual(const FunctionUnit *fu, const bool checkPortWidths=true) const
Definition: FunctionUnit.cc:747
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
InstanceNotFound
Definition: Exception.hh:304
TTAMachine::ExecutionPipeline::isResourceUsed
bool isResourceUsed(const std::string &name, int cycle) const
Definition: ExecutionPipeline.cc:300
TTAMachine::Machine
Definition: Machine.hh:73
FunctionUnit.hh
ContainerTools.hh
TTAMachine::FunctionUnit::operationNames
virtual void operationNames(TCETools::CIStringSet &opNames) const
Definition: FunctionUnit.cc:428