OpenASIP 2.2
Loading...
Searching...
No Matches
FUResourceConflictDetector.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 FUResourceConflictDetector.cc
26 *
27 * Definition of FUResourceConflictDetector class.
28 *
29 * @author Pekka Jääskeläinen 2006 (pjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
34#include "StringTools.hh"
35#include "OperationIDIndex.hh"
36#include "TCEString.hh"
37#include "Exception.hh"
38
39/**
40 * Constructor.
41 */
46
47/**
48 * Destructor.
49 */
54
55/**
56 * Issues an operation and reports a conflict if detected.
57 *
58 * The default implementation always returns true, thus detects no conflicts.
59 *
60 * @param id The id of the operation to issue.
61 * @return False in case a conflict is detected, otherwise true.
62 */
63bool
67
68/**
69 * Simulates a cycle advance and reports a conflict if detected.
70 *
71 * The default implementation always returns true, thus detects no conflicts.
72 * This interface is provided for allowing the model to update its state at
73 * the point simulation advances to the next cycle.
74 *
75 * @return False in case a conflict is detected, otherwise true.
76 */
77bool
81
82/**
83 * Simulates a cycle advance and reports a conflict by throwing an exception.
84 */
85void
89
90
91/**
92 * Called after advanceClock() has been called to all clocked states.
93 */
94void
97
98/**
99 * Should return true in case the model needs to receive clock advance calls.
100 *
101 * @return By default always returns false.
102 */
103bool
105 return false;
106}
107
108/**
109 * Returns an operation id for the given operation.
110 *
111 * Operation IDs are used in the interface for optimizing the access. This
112 * method converts OSAL Operations to operation IDs.
113 *
114 * @param operation The OSAL Operation to find ID for.
115 * @return The operation ID.
116 * @exception KeyNotFound if the operation of given name couldn't be found
117 */
120{
121 OperationIDIndex::const_iterator i =
122 operationIndices_->find(StringTools::stringToLower(operationName));
123 if (i == operationIndices_->end())
124 throw KeyNotFound(
125 __FILE__, __LINE__, __func__, "Operation not found.");
126 return (*i).second;
127}
128
129/**
130 * Sets the state of the detector to its initial state.
131 *
132 * This means that the FU state is assumed to be what it is in powerup.
133 */
134void
#define __func__
virtual OperationID operationID(const TCEString &operationName) const
OperationIDIndex * operationIndices_
Map for finding indices for operations quickly.
virtual bool issueOperation(OperationID id)
int OperationID
Type for identifying operations in the conflict detector interface.
static std::string stringToLower(const std::string &source)