2 Copyright (c) 2002-2009 Tampere University.
4 This file is part of TTA-Based Codesign Environment (TCE).
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:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
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.
25 * @file ExecutableInstruction.icc
27 * Inline method definitions of ExecutableInstruction class.
29 * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
33 #include "ExecutableInstruction.hh"
34 #include "ExecutableMove.hh"
35 #include "LongImmUpdateAction.hh"
36 #include "SequenceTools.hh"
39 * Executes the instruction.
41 * First all long immediate update actions are executed.
42 * Next, guards are evaluated to decide which moves will be squashed and
43 * which not. Finally, data transports of the unsquashed moves are
47 ExecutableInstruction::execute() {
49 for (std::size_t i = 0; i < updateActions_.size(); ++i) {
50 updateActions_[i]->execute();
52 // have to evaluate the guards before either a long immediate
53 // or a register transport overwrites it
54 for (std::size_t i = 0; i < moves_.size(); ++i) {
55 moves_[i]->evaluateGuard();
57 for (std::size_t i = 0; i < moves_.size(); ++i) {
58 moves_[i]->executeRead();
60 for (std::size_t i = 0; i < moves_.size(); ++i) {
61 moves_[i]->executeWrite();
67 * Returns true in case the move with the given index was squashed the last
68 * time the instruction was executed.
70 * Being squashed means that the move is guarded and the guard expression
73 * @param moveIndex Index of the move to query.
74 * @return True in case move was squashed.
77 ExecutableInstruction::moveSquashed(std::size_t moveIndex) const {
78 return moves_[moveIndex]->squashed();
82 * Returns true in case this instruction is considered a program
83 * exit point: the simulation should stop *after* executing this instruction.
86 ExecutableInstruction::isExitPoint() const {
91 * Sets the instruction's exit point status.
96 ExecutableInstruction::setExitPoint(bool b) {