OpenASIP 2.2
Loading...
Searching...
No Matches
OperationBehavior.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 OperationBehavior.hh
26 *
27 * Declaration of OperationBehavior class.
28 *
29 * @author Pekka Jääskeläinen 2004 (pekka.jaaskelainen-no.spam-tut.fi)
30 * @note This file is used in compiled simulation. Keep dependencies *clean*
31 * @note rating: red
32 * @note reviewed 19 August 2004 by pj, jn, ao, ac
33 */
34
35
36#ifndef TTA_OPERATION_BEHAVIOR_HH
37#define TTA_OPERATION_BEHAVIOR_HH
38
39#include <vector>
40#include "SimValue.hh"
41
43class Operation;
44
45/**
46 * Interface to access the behavior model of TTA operations.
47 *
48 * This abstract class that is inherited by the custom operation behavior
49 * classes. Instances of user defined OperationBehavior derived classes are
50 * loaded run-time from dynamic library modules (plugins).
51 *
52 */
54public:
55
56 /// Input operand type for areValid()
57 typedef std::vector<SimValue> InputOperandVector;
58
59 virtual bool simulateTrigger(
60 SimValue** io,
61 OperationContext& context) const = 0;
62 virtual bool areValid(
63 const InputOperandVector& inputs,
64 const OperationContext& context) const;
65
66 virtual void createState(OperationContext& context) const;
67 virtual void deleteState(OperationContext& context) const;
68
69 virtual const char* stateName() const;
70
71 virtual bool canBeSimulated() const;
72
73 virtual void writeOutput(const char* text) const;
74
76 OperationBehavior(const Operation& parent);
77 virtual ~OperationBehavior();
78
79protected:
81};
82
83///////////////////////////////////////////////////////////////////////////////
84// NullOperationBehavior
85///////////////////////////////////////////////////////////////////////////////
86
87/**
88 * Singleton class to represent an undefined operation behavior.
89 *
90 * All methods cause program abort with an error log message.
91 *
92 */
94public:
96
97 virtual bool simulateTrigger(
98 SimValue**,
99 OperationContext& context) const;
100 virtual bool lateResult(
101 SimValue**,
102 OperationContext& context) const;
103
104protected:
106
107private:
109
110};
111
112#endif
virtual bool lateResult(SimValue **, OperationContext &context) const
static NullOperationBehavior & instance()
virtual bool simulateTrigger(SimValue **, OperationContext &context) const
static NullOperationBehavior instance_
virtual void createState(OperationContext &context) const
virtual bool simulateTrigger(SimValue **io, OperationContext &context) const =0
std::vector< SimValue > InputOperandVector
Input operand type for areValid()
virtual void deleteState(OperationContext &context) const
virtual bool canBeSimulated() const
virtual void writeOutput(const char *text) const
virtual bool areValid(const InputOperandVector &inputs, const OperationContext &context) const
const Operation & parent_
virtual const char * stateName() const