OpenASIP  2.0
BusState.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 BusState.cc
26  *
27  * Definition of BusState 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 "BusState.hh"
35 #include "Application.hh"
36 #include "SimValue.hh"
37 #include "BaseType.hh"
38 
39 using std::string;
40 
41 //////////////////////////////////////////////////////////////////////////////
42 // BusState
43 //////////////////////////////////////////////////////////////////////////////
44 
45 /**
46  * Constructor.
47  *
48  * @param width Bit width of the bus.
49  */
50 BusState::BusState(int width) :
51  RegisterState(width), squashed_(false) {
52 }
53 
54 /**
55  * Destructor.
56  */
58 }
59 
60 /**
61  * Sets the value of the bus.
62  *
63  * Does not extend the value.
64  *
65  * @param value New value.
66  */
67 void
70 }
71 
72 /**
73  * Sets whether the last executed move scheduled to this bus was squashed.
74  *
75  * @param isSquashed True in case this bus was squashed.
76  */
77 void
78 BusState::setSquashed(bool isSquashed) {
80 }
81 
82 /**
83  * Returns true if the last executed move scheduled to this bus was squashed.
84  *
85  * @param isSquashed True in case this bus was squashed.
86  */
87 bool
89  return squashed_;
90 }
91 
92 /**
93  * Returns width of the modeled bus.
94  */
95 int
96 BusState::width() const {
97  return value().width();
98 }
99 
100 //////////////////////////////////////////////////////////////////////////////
101 // NullBusState
102 //////////////////////////////////////////////////////////////////////////////
103 
105 
106 /**
107  * Returns the instance of NullBusState.
108  *
109  * @return The instance of NullBusState.
110  */
113  if (instance_ == NULL) {
114  instance_ = new NullBusState();
115  }
116  return *instance_;
117 }
118 
119 /**
120  * Constructor.
121  */
123 }
124 
125 /**
126  * Destructor.
127  */
129 }
130 
131 /**
132  * Aborts the program with error message.
133  */
134 void
136  Application::abortWithError("setValue()");
137 }
138 
139 /**
140  * Aborts the program with error message.
141  *
142  * @return Never returns.
143  */
144 const SimValue&
146  Application::abortWithError("value()");
147  return NullSimValue::instance();
148 }
NullBusState
Definition: BusState.hh:85
BaseType.hh
BusState::width
int width() const
Definition: BusState.cc:96
BusState::setSquashed
void setSquashed(bool isSquashed)
Definition: BusState.cc:78
NullSimValue::instance
static SimValue & instance()
Definition: SimValue.cc:1642
BusState
Definition: BusState.hh:48
BusState::isSquashed
bool isSquashed() const
Definition: BusState.cc:88
BusState::setValue
virtual void setValue(const SimValue &value)
Definition: BusState.cc:68
NullBusState::~NullBusState
virtual ~NullBusState()
Definition: BusState.cc:128
SimValue
Definition: SimValue.hh:96
RegisterState::value
virtual const SimValue & value() const
Definition: RegisterState.cc:92
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
NullBusState::instance_
static NullBusState * instance_
Unique instance of NullBusState.
Definition: BusState.hh:102
BusState.hh
Application.hh
BusState::squashed_
bool squashed_
True in case this bus was squashed the last time a move was executed in this bus.
Definition: BusState.hh:75
NullBusState::NullBusState
NullBusState()
Definition: BusState.cc:122
NullBusState::instance
static NullBusState & instance()
Definition: BusState.cc:112
SimValue::width
int width() const
Definition: SimValue.cc:103
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
SimValue.hh
NullBusState::setValue
virtual void setValue(const SimValue &value)
Definition: BusState.cc:135
NullBusState::value
virtual const SimValue & value() const
Definition: BusState.cc:145
RegisterState
Definition: RegisterState.hh:50
BusState::~BusState
virtual ~BusState()
Definition: BusState.cc:57
BusState::BusState
BusState(int width)
Definition: BusState.cc:50
RegisterState::setValue
virtual void setValue(const SimValue &value)
Definition: RegisterState.cc:80