OpenASIP  2.0
FUReservationTableIndex.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 FUReservationTableIndex.cc
26  *
27  * Definition of FUReservationTableIndex class.
28  *
29  * @author Pekka Jääskeläinen 2007 (pekka.jaaskelainen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
34 #include "ReservationTable.hh"
35 #include "FunctionUnit.hh"
36 #include "SequenceTools.hh"
37 #include "HWOperation.hh"
38 
39 /**
40  * Builds reservation tables for all operations in the FU.
41  *
42  * Tables are stored in the order returned by FunctionUnit::operation(),
43  * the NOP matrix is at index FunctionUnit::operationCount().
44  *
45  * @param functionUnit The FU to build the matrices for.
46  */
48  const TTAMachine::FunctionUnit& functionUnit) {
49 
50  for (int i = 0; i < functionUnit.operationCount(); ++i) {
51  const TTAMachine::HWOperation& operation =
52  *functionUnit.operation(i);
53  tables_.push_back(new ReservationTable(operation));
54  }
55 }
56 
57 /**
58  * Destructor.
59  */
62 }
63 
64 /**
65  * Returns the reservation table at the given index.
66  *
67  * @param operation The index of the reservation table.
68  */
70 FUReservationTableIndex::at(std::size_t index) {
71  return *tables_.at(index);
72 }
73 
74 /**
75  * Returns the count of reservation tables in the index.
76  *
77  * @return The count of reservation tables in the index.
78  */
79 std::size_t
81  return tables_.size();
82 }
83 
FUReservationTableIndex::FUReservationTableIndex
FUReservationTableIndex(const TTAMachine::FunctionUnit &functionUnit)
Definition: FUReservationTableIndex.cc:47
TTAMachine::HWOperation
Definition: HWOperation.hh:52
FUReservationTableIndex::size
std::size_t size() const
Definition: FUReservationTableIndex.cc:80
ReservationTable.hh
SequenceTools.hh
FUReservationTableIndex::at
ReservationTable & at(std::size_t operation)
Definition: FUReservationTableIndex.cc:70
FUReservationTableIndex::tables_
std::vector< ReservationTable * > tables_
Stores all reservation tables.
Definition: FUReservationTableIndex.hh:56
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
HWOperation.hh
FUReservationTableIndex::~FUReservationTableIndex
virtual ~FUReservationTableIndex()
Definition: FUReservationTableIndex.cc:60
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
FUReservationTableIndex.hh
ReservationTable
Definition: ReservationTable.hh:49
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
FunctionUnit.hh