OpenASIP
2.0
src
applibs
Simulator
OpcodeSettingVirtualInputPortState.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 OpcodeSettingVirtualInputPortState.cc
26
*
27
* Definition of OpcodeSettingVirtualInputPortState class.
28
*
29
* @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30
* @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
31
* @note rating: red
32
*/
33
34
#include "
OpcodeSettingVirtualInputPortState.hh
"
35
#include "
TriggeringInputPortState.hh
"
36
#include "
Operation.hh
"
37
#include "
FUState.hh
"
38
#include "
SimValue.hh
"
39
#include "
Application.hh
"
40
41
using
std::string;
42
43
/**
44
* Constructor.
45
*
46
* @param Operation Operation of the port.
47
* @param parent Parent function unit.
48
* @param real The real port in which this port belongs to.
49
*/
50
OpcodeSettingVirtualInputPortState::OpcodeSettingVirtualInputPortState
(
51
Operation
& operation,
52
FUState
& parent,
53
InputPortState
& real) :
54
InputPortState
(parent, real.value().width()),
55
operation_(operation), executor_(NULL),
56
real_(real) {
57
}
58
59
/**
60
* Constructor.
61
*
62
* @param Operation Operation of the port.
63
* @param executor OperationExecutor to use to execute the operation when it's
64
* triggered.
65
* @param parent Parent function unit.
66
* @param real The real port in which this port belongs to.
67
*/
68
OpcodeSettingVirtualInputPortState::OpcodeSettingVirtualInputPortState
(
69
Operation
& operation,
70
OperationExecutor
& executor,
71
FUState
& parent,
72
InputPortState
& real) :
73
InputPortState
(parent, real.value().width()),
74
operation_(operation), executor_(&executor),
75
real_(real) {
76
}
77
78
79
/**
80
* Destructor.
81
*/
82
OpcodeSettingVirtualInputPortState::~OpcodeSettingVirtualInputPortState
() {
83
}
84
85
/**
86
* Sets the value of the port and sets operation to function unit.
87
*/
88
void
89
OpcodeSettingVirtualInputPortState::setValue
(
const
SimValue
& value) {
90
91
if
(
executor_
!= NULL) {
92
parent_
->
setOperation
(
operation_
, *
executor_
);
93
}
else
{
94
parent_
->
setOperation
(
operation_
);
95
}
96
parent_
->
setTriggered
();
97
real_
.
setValue
(
value
);
98
}
99
100
/**
101
* Returns the value of the parent port.
102
*
103
* @return The value of the parent port.
104
*/
105
const
SimValue
&
106
OpcodeSettingVirtualInputPortState::value
()
const
{
107
return
real_
.
value
();
108
}
109
110
/**
111
* Returns the real port.
112
*
113
* @return The real port.
114
*/
115
InputPortState
*
116
OpcodeSettingVirtualInputPortState::realPort
()
const
{
117
return
&
real_
;
118
}
OpcodeSettingVirtualInputPortState::realPort
InputPortState * realPort() const
Definition:
OpcodeSettingVirtualInputPortState.cc:116
OpcodeSettingVirtualInputPortState::~OpcodeSettingVirtualInputPortState
virtual ~OpcodeSettingVirtualInputPortState()
Definition:
OpcodeSettingVirtualInputPortState.cc:82
PortState::parent_
FUState * parent_
Parent of the port.
Definition:
PortState.hh:61
OpcodeSettingVirtualInputPortState::OpcodeSettingVirtualInputPortState
OpcodeSettingVirtualInputPortState(Operation &operation, OperationExecutor &executor, FUState &parent, InputPortState &real)
Definition:
OpcodeSettingVirtualInputPortState.cc:68
FUState.hh
SimValue
Definition:
SimValue.hh:96
FUState
Definition:
FUState.hh:58
RegisterState::value
virtual const SimValue & value() const
Definition:
RegisterState.cc:92
InputPortState
Definition:
InputPortState.hh:46
Application.hh
Operation.hh
FUState::setTriggered
void setTriggered()
OperationExecutor
Definition:
OperationExecutor.hh:49
Operation
Definition:
Operation.hh:59
OpcodeSettingVirtualInputPortState::operation_
Operation & operation_
Operation of the port.
Definition:
OpcodeSettingVirtualInputPortState.hh:79
OpcodeSettingVirtualInputPortState::real_
InputPortState & real_
Real input port.
Definition:
OpcodeSettingVirtualInputPortState.hh:85
OpcodeSettingVirtualInputPortState::setValue
virtual void setValue(const SimValue &value)
Definition:
OpcodeSettingVirtualInputPortState.cc:89
SimValue.hh
TriggeringInputPortState.hh
FUState::setOperation
void setOperation(Operation &operation)
OpcodeSettingVirtualInputPortState::executor_
OperationExecutor * executor_
Operation executor used to execute the operation in the target FU, this is an optimization to avoid s...
Definition:
OpcodeSettingVirtualInputPortState.hh:83
OpcodeSettingVirtualInputPortState::value
virtual const SimValue & value() const
Definition:
OpcodeSettingVirtualInputPortState.cc:106
OpcodeSettingVirtualInputPortState.hh
RegisterState::setValue
virtual void setValue(const SimValue &value)
Definition:
RegisterState.cc:80
Generated by
1.8.17