OpenASIP  2.0
ResourceVector.hh
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 ResourceVector.hh
26  *
27  * Declaration of ResourceVector class.
28  *
29  * @author Pekka J��skel�inen 2006 (pekka.jaaskelainen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_RESOURCE_VECTOR_HH
34 #define TTA_RESOURCE_VECTOR_HH
35 
36 #include <vector>
37 #include <set>
38 #include <deque>
39 #include <string>
40 
41 #include "Exception.hh"
42 
43 namespace TTAMachine {
44  class ExecutionPipeline;
45 }
46 
47 namespace TTAMachine {
48 
49 /**
50  * Represents a resource vector used in building the states in case
51  * of an function unit FSA.
52  */
54 public:
55  /// Resources are stored in a set as strings. Normal pipeline resource
56  /// usages are prefixed with "res:", port usages with "port:".
57  typedef std::set<std::string> ResourceSet;
58 
61  virtual ~ResourceVector();
62 
63  const ResourceSet& resourcesUsedAtCycle(unsigned cycle) const;
64 
65  std::size_t width() const;
66 
67  std::string toString() const;
68 
69  virtual bool conflictsWith(const ResourceVector& other, unsigned cycle)
70  const;
71 
72  virtual void mergeWith(const ResourceVector& other, unsigned cycle);
73 
74  virtual void shiftLeft();
75 
76  virtual void clear();
77 
78  virtual bool operator==(const ResourceVector& rightHand) const;
79 
80 private:
81  /// Each resource usage is stored as a string.
82  typedef std::deque<ResourceSet> ResourceUsageIndex;
83  /// The storage for the resource usages.
85 };
86 }
87 #endif
TTAMachine::ResourceVector::clear
virtual void clear()
Definition: ResourceVector.cc:220
Exception.hh
TTAMachine::ResourceVector::width
std::size_t width() const
Definition: ResourceVector.cc:141
TTAMachine::ResourceVector
Definition: ResourceVector.hh:53
TTAMachine::ResourceVector::operator==
virtual bool operator==(const ResourceVector &rightHand) const
Definition: ResourceVector.cc:232
TTAMachine::ResourceVector::~ResourceVector
virtual ~ResourceVector()
Definition: ResourceVector.cc:93
TTAMachine::ResourceVector::ResourceSet
std::set< std::string > ResourceSet
Resources are stored in a set as strings. Normal pipeline resource usages are prefixed with "res:",...
Definition: ResourceVector.hh:57
TTAMachine::ResourceVector::ResourceVector
ResourceVector()
Definition: ResourceVector.hh:59
TTAMachine::ResourceVector::toString
std::string toString() const
Definition: ResourceVector.cc:116
TTAMachine::ResourceVector::mergeWith
virtual void mergeWith(const ResourceVector &other, unsigned cycle)
Definition: ResourceVector.cc:194
TTAMachine::ResourceVector::resourcesUsedAtCycle
const ResourceSet & resourcesUsedAtCycle(unsigned cycle) const
Definition: ResourceVector.cc:104
TTAMachine::ResourceVector::conflictsWith
virtual bool conflictsWith(const ResourceVector &other, unsigned cycle) const
Definition: ResourceVector.cc:154
TTAMachine::ResourceVector::shiftLeft
virtual void shiftLeft()
Definition: ResourceVector.cc:209
TTAMachine::ResourceVector::resources_
ResourceUsageIndex resources_
The storage for the resource usages.
Definition: ResourceVector.hh:84
TTAMachine::ExecutionPipeline
Definition: ExecutionPipeline.hh:55
TTAMachine::ResourceVector::ResourceUsageIndex
std::deque< ResourceSet > ResourceUsageIndex
Each resource usage is stored as a string.
Definition: ResourceVector.hh:82
TTAMachine
Definition: Assembler.hh:48