OpenASIP  2.0
MachineTester.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 MachineTester.hh
26  *
27  * Declaration of MachineTester class.
28  *
29  * @author Lasse Laasonen 2004 (lasse.laasonen-no.spam-tut.fi)
30  */
31 
32 #ifndef TTA_MACHINE_TESTER_HH
33 #define TTA_MACHINE_TESTER_HH
34 
35 #include <set>
36 #include <vector>
37 #include <map>
38 
39 #include "Exception.hh"
40 #include "Socket.hh"
41 
42 /**
43  * MachineTester is a class that implements all the API needed for
44  * diagnostics of machine model.
45  */
47 public:
49  virtual ~MachineTester();
50 
51  virtual bool canConnect(
52  const TTAMachine::Socket& socket,
53  const TTAMachine::Segment& segment);
54  virtual bool canConnect(
55  const TTAMachine::Socket& socket,
56  const TTAMachine::Port& port);
57  virtual bool canBridge(
58  const TTAMachine::Bus& source,
59  const TTAMachine::Bus& destination);
60  virtual bool canSetDirection(
61  const TTAMachine::Socket& socket,
63  static bool isValidComponentName(const std::string& name);
64 
65  bool connectionExists() const;
66  bool illegalRegistration() const;
67  bool loop() const;
69  bool wrongSocketDirection() const;
70  bool maxConnections() const;
71  bool unknownSocketDirection() const;
72  bool noConnections() const;
74  TTAMachine::Socket::Direction direction) const;
76  TTAMachine::Socket::Direction direction) const;
78 
79 private:
80  // copying prohibited
81  MachineTester(const MachineTester& tester);
82  // assingment prohibited
83  MachineTester& operator=(const MachineTester& tester);
84 
85  void clearState();
86  static bool areInSameChain(
87  const TTAMachine::Bus& bus1,
88  const TTAMachine::Bus& bus2);
90  const TTAMachine::Socket& socket,
92 
93  /// The machine on which the tests are carried out.
95  /// Indicates if the reason for the last test failure is that the tested
96  /// connection already exists.
98  /// Indicates if the reason for failure is that a port of register file
99  /// is already connected to a particular socket.
101  /// Indicates if the reason for last test failure was illegal
102  /// registration.
104  /// Indicates if the reason for failure when trying to bridge two busses
105  /// is that a loop in the bus chain would be created.
106  bool loop_;
107  /// If the reason for failure when trying to bridge two busses is that a
108  /// branch in the bus chain would be created, this is the branched bus.
110  /// Indicates if the reason for failure when trying to connect a socket
111  /// to a port was that the direction of the socket is incompatible with
112  /// the direction of other sockets connected to the port.
114  /// Indicates if the reason for failure when trying to connect a socket
115  /// to a port was that this connection would exceed the maximum number
116  /// of connections allowed for a port.
118  /// Indicates if tried to set the socket direction to Socket::UNKNOWN.
120  /// Indicates if the reason for failure when tried to set socket
121  /// direction was that the socket has no segment connections.
123  /// If the reason for failure when tried to set socket
124  /// direction to input was that the socket is connected to a port that
125  /// already has an input socket connected, this is the port.
127  /// If the reason for failure when tried to set socket
128  /// direction to output was that the socket is connected to a port that
129  /// already has an output socket connected, this is the port.
131  /// If the reason for failure when tried to set socket direction to input
132  /// was the socket is connected to a unit that cannot be connected to an
133  /// input socket, this is the port of the unit.
135 };
136 
137 #endif
MachineTester::canConnect
virtual bool canConnect(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment)
Definition: MachineTester.cc:86
MachineTester::noConnections_
bool noConnections_
Indicates if the reason for failure when tried to set socket direction was that the socket has no seg...
Definition: MachineTester.hh:122
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
Exception.hh
MachineTester::MachineTester
MachineTester(const TTAMachine::Machine &machine)
Definition: MachineTester.cc:57
TTAMachine::Segment
Definition: Segment.hh:54
MachineTester::unknownSocketDirection
bool unknownSocketDirection() const
Definition: MachineTester.cc:424
TTAMachine::Bus
Definition: Bus.hh:53
MachineTester::canBridge
virtual bool canBridge(const TTAMachine::Bus &source, const TTAMachine::Bus &destination)
Definition: MachineTester.cc:203
MachineTester::machine_
const TTAMachine::Machine * machine_
The machine on which the tests are carried out.
Definition: MachineTester.hh:94
MachineTester::illegalRegistration
bool illegalRegistration() const
Definition: MachineTester.cc:355
MachineTester::branchedBus_
const TTAMachine::Bus * branchedBus_
If the reason for failure when trying to bridge two busses is that a branch in the bus chain would be...
Definition: MachineTester.hh:109
TTAMachine::Socket::Direction
Direction
Definition: Socket.hh:58
MachineTester::noConnections
bool noConnections() const
Definition: MachineTester.cc:437
Socket.hh
MachineTester::sameDirOutputSocketConn_
TTAMachine::Port * sameDirOutputSocketConn_
If the reason for failure when tried to set socket direction to output was that the socket is connect...
Definition: MachineTester.hh:130
MachineTester::operator=
MachineTester & operator=(const MachineTester &tester)
MachineTester::wrongSocketDirection
bool wrongSocketDirection() const
Definition: MachineTester.cc:397
MachineTester::sameDirInputSocketConn_
TTAMachine::Port * sameDirInputSocketConn_
If the reason for failure when tried to set socket direction to input was that the socket is connecte...
Definition: MachineTester.hh:126
MachineTester::branchedBus
TTAMachine::Bus * branchedBus() const
Definition: MachineTester.cc:380
MachineTester::loop
bool loop() const
Definition: MachineTester.cc:367
TTAMachine::Port
Definition: Port.hh:54
MachineTester::registerFilePortAlreadyConnected
bool registerFilePortAlreadyConnected() const
Definition: MachineTester.cc:488
MachineTester::sameDirSocketConnection
TTAMachine::Port * sameDirSocketConnection(TTAMachine::Socket::Direction direction) const
Definition: MachineTester.cc:451
TTAMachine::Socket
Definition: Socket.hh:53
MachineTester::~MachineTester
virtual ~MachineTester()
Definition: MachineTester.cc:67
MachineTester::isValidComponentName
static bool isValidComponentName(const std::string &name)
Definition: MachineTester.cc:312
MachineTester::wrongSocketDirection_
bool wrongSocketDirection_
Indicates if the reason for failure when trying to connect a socket to a port was that the direction ...
Definition: MachineTester.hh:113
MachineTester::legalPortConnections
bool legalPortConnections(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
Definition: MachineTester.cc:556
MachineTester::areInSameChain
static bool areInSameChain(const TTAMachine::Bus &bus1, const TTAMachine::Bus &bus2)
Definition: MachineTester.cc:521
MachineTester::connectionExists
bool connectionExists() const
Definition: MachineTester.cc:342
MachineTester::clearState
void clearState()
Definition: MachineTester.cc:497
MachineTester::forbiddenInputSocketDir_
TTAMachine::Port * forbiddenInputSocketDir_
If the reason for failure when tried to set socket direction to input was the socket is connected to ...
Definition: MachineTester.hh:134
MachineTester::loop_
bool loop_
Indicates if the reason for failure when trying to bridge two busses is that a loop in the bus chain ...
Definition: MachineTester.hh:106
MachineTester::forbiddenSocketDirection
TTAMachine::Port * forbiddenSocketDirection(TTAMachine::Socket::Direction direction) const
Definition: MachineTester.cc:471
MachineTester::canSetDirection
virtual bool canSetDirection(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
Definition: MachineTester.cc:283
MachineTester::unknownDir_
bool unknownDir_
Indicates if tried to set the socket direction to Socket::UNKNOWN.
Definition: MachineTester.hh:119
MachineTester::rfPortAlreadyConnected_
bool rfPortAlreadyConnected_
Indicates if the reason for failure is that a port of register file is already connected to a particu...
Definition: MachineTester.hh:100
MachineTester::maxConnections
bool maxConnections() const
Definition: MachineTester.cc:410
MachineTester
Definition: MachineTester.hh:46
MachineTester::illegalRegistration_
bool illegalRegistration_
Indicates if the reason for last test failure was illegal registration.
Definition: MachineTester.hh:103
MachineTester::maxConnections_
bool maxConnections_
Indicates if the reason for failure when trying to connect a socket to a port was that this connectio...
Definition: MachineTester.hh:117
TTAMachine::Machine
Definition: Machine.hh:73
MachineTester::connectionExists_
bool connectionExists_
Indicates if the reason for the last test failure is that the tested connection already exists.
Definition: MachineTester.hh:97