OpenASIP 2.2
Loading...
Searching...
No Matches
ExecutingOperation.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2010 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 ExecutingOperation.cc
26 *
27 * @author Pekka Jääskeläinen 2010 (pjaaskel-no.spam-cs.tut.fi)
28 */
29
30#include "ExecutingOperation.hh"
31#include "PortState.hh"
32
33/**
34 * Returns the value bound to the input or output operand
35 * with the given ID.
36 *
37 * @note operand is the OSAL ID, thus 1 is the first input and
38 * the outputs follow sequentially.
39 */
42 return iostorage_[operand - 1];
43}
44
45/**
46 * Sets the operation execution to be started.
47 *
48 * Should be called at the beginning of a single operation's simulation.
49 */
50void
52 for (std::size_t i = 0; i < pendingResults_.size(); ++i)
53 pendingResults_[i].reset();
54 free_ = false;
55 stage_ = 0;
56}
57
58/**
59 * Sets the operation execution to be stopped.
60 *
61 * Should be called at the end of a single operation's simulation. This
62 * sets the object to be reusable for other operation execution.
63 */
64void
68
69/**
70 * Should be called at the end of a simulation cycle.
71 */
72void
74 for (std::size_t i = 0; i < pendingResults_.size(); ++i)
76 ++stage_;
77}
78
79///////////////////////////////////////////////////////////////////////////////
80// PendingResult
81///////////////////////////////////////////////////////////////////////////////
82
83/**
84 * Signals a cycle advance.
85 *
86 * Makes the result visible to the output port in time.
87 */
88void
95
96void
98 cyclesToGo_ = resultLatency_;
99}
std::vector< PendingResult > pendingResults_
SimValue & io(int operand)
std::vector< SimValue > iostorage_
virtual void setValue(const SimValue &value)
SimValue * result_
The value that will be written to the target after the latency has passed.
PortState * target_
The target port to which the result will be written after the latency.
int cyclesToGo_
How many cycles to wait until the result will be written to the target.