OpenASIP  2.0
ExecutionPipelineResourceTable.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 ExecutionPipelineResourceTable.hh
26  *
27  * Declaration of the ExecutionPipelineResourceTable class.
28  *
29  * @author Heikki Kultala 2009 (heikki.kultala-no-spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_EXECUTION_PIPELINE_RESOURCE_TABLE_HH
34 #define TTA_EXECUTION_PIPELINE_RESOURCE_TABLE_HH
35 
36 #include <string>
37 #include <map>
38 #include <vector>
39 
40 namespace TTAMachine {
41  class FunctionUnit;
42 }
43 
45 public:
46  inline unsigned int numberOfResources() const;
47  inline unsigned int pipelineSize() const;
48  inline unsigned int maximalLatency() const;
49 
50  inline bool operationPipeline(int op, int cycle, int res) const;
51 
52  inline int operationIndex(const std::string& opName) const;
53 
54  inline bool hasOperation(const std::string& opName) const;
55 
56  inline const std::map<int,int>& operationLatency(
57  unsigned int operationIndex) const;
58 
59 
60  inline const std::string& name() const;
61 
63  const TTAMachine::FunctionUnit& fu);
64 
65  static void finalize();
66 private:
68 
69  void setLatency(
70  const std::string& opName,
71  const int output,
72  const int latency);
73 
74  void setResourceUse(
75  const std::string& opName, const int cycle, const int resIndex);
76 
77  std::string name_;
78 
79  /// Type for resource vector, represents one cycle of use
80  typedef std::vector<bool> ResourceVector;
81 
82  /// Type for resource reservation table, resource vector x latency
83  typedef std::vector<ResourceVector> ResourceTable;
84 
85  typedef std::map<const TTAMachine::FunctionUnit*,
87 
88  /// Resource and ports vector width, depends on particular FU
90  /// Maximal latency of operation in FU
91  unsigned int maximalLatency_;
92  /// Operations supported, name - index to operation pipeline vector
93  std::map<std::string, int> operationSupported_;
94  // latencies of all operations supported by this FU.
95  std::vector<std::map<int,int> > operationLatencies_;
96  /// Pipelines for operations
97  std::vector<ResourceTable> operationPipelines_;
98 
99  /// Contains these tables for all FU's
101 };
102 
104 
105 #endif
ExecutionPipelineResourceTable::name
const std::string & name() const
ExecutionPipelineResourceTable::operationIndex
int operationIndex(const std::string &opName) const
ExecutionPipelineResourceTable::finalize
static void finalize()
Definition: ExecutionPipelineResourceTable.cc:185
ExecutionPipelineResourceTable::operationLatencies_
std::vector< std::map< int, int > > operationLatencies_
Definition: ExecutionPipelineResourceTable.hh:95
ExecutionPipelineResourceTable::setResourceUse
void setResourceUse(const std::string &opName, const int cycle, const int resIndex)
Definition: ExecutionPipelineResourceTable.cc:102
ExecutionPipelineResourceTable::ExecutionPipelineResourceTable
ExecutionPipelineResourceTable(const TTAMachine::FunctionUnit &fu)
Definition: ExecutionPipelineResourceTable.cc:50
ExecutionPipelineResourceTable::pipelineSize
unsigned int pipelineSize() const
ExecutionPipelineResourceTable::operationPipeline
bool operationPipeline(int op, int cycle, int res) const
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
ExecutionPipelineResourceTable::allResourceTables_
static ResourceTableMap allResourceTables_
Contains these tables for all FU's.
Definition: ExecutionPipelineResourceTable.hh:100
ExecutionPipelineResourceTable::name_
std::string name_
Definition: ExecutionPipelineResourceTable.hh:77
ExecutionPipelineResourceTable::maximalLatency_
unsigned int maximalLatency_
Maximal latency of operation in FU.
Definition: ExecutionPipelineResourceTable.hh:91
ExecutionPipelineResourceTable::ResourceVector
std::vector< bool > ResourceVector
Type for resource vector, represents one cycle of use.
Definition: ExecutionPipelineResourceTable.hh:80
ExecutionPipelineResourceTable::hasOperation
bool hasOperation(const std::string &opName) const
ExecutionPipelineResourceTable::ResourceTable
std::vector< ResourceVector > ResourceTable
Type for resource reservation table, resource vector x latency.
Definition: ExecutionPipelineResourceTable.hh:83
ExecutionPipelineResourceTable::numberOfResources_
int numberOfResources_
Resource and ports vector width, depends on particular FU.
Definition: ExecutionPipelineResourceTable.hh:89
ExecutionPipelineResourceTable::numberOfResources
unsigned int numberOfResources() const
ExecutionPipelineResourceTable::operationLatency
const std::map< int, int > & operationLatency(unsigned int operationIndex) const
ExecutionPipelineResourceTable::ResourceTableMap
std::map< const TTAMachine::FunctionUnit *, ExecutionPipelineResourceTable * > ResourceTableMap
Definition: ExecutionPipelineResourceTable.hh:86
ExecutionPipelineResourceTable::operationPipelines_
std::vector< ResourceTable > operationPipelines_
Pipelines for operations.
Definition: ExecutionPipelineResourceTable.hh:97
ExecutionPipelineResourceTable.icc
ExecutionPipelineResourceTable::maximalLatency
unsigned int maximalLatency() const
ExecutionPipelineResourceTable::setLatency
void setLatency(const std::string &opName, const int output, const int latency)
Definition: ExecutionPipelineResourceTable.cc:139
ExecutionPipelineResourceTable::resourceTable
static const ExecutionPipelineResourceTable & resourceTable(const TTAMachine::FunctionUnit &fu)
Definition: ExecutionPipelineResourceTable.cc:164
ExecutionPipelineResourceTable::operationSupported_
std::map< std::string, int > operationSupported_
Operations supported, name - index to operation pipeline vector.
Definition: ExecutionPipelineResourceTable.hh:93
ExecutionPipelineResourceTable
Definition: ExecutionPipelineResourceTable.hh:44
TTAMachine
Definition: Assembler.hh:48