OpenASIP 2.2
Loading...
Searching...
No Matches
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 */
47public:
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
79private:
80 // copying prohibited
82 // assingment prohibited
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
TTAMachine::Machine * machine
the architecture definition of the estimated processor
TTAMachine::Port * sameDirSocketConnection(TTAMachine::Socket::Direction direction) const
MachineTester & operator=(const MachineTester &tester)
TTAMachine::Port * sameDirOutputSocketConn_
If the reason for failure when tried to set socket direction to output was that the socket is connect...
const TTAMachine::Machine * machine_
The machine on which the tests are carried out.
bool wrongSocketDirection_
Indicates if the reason for failure when trying to connect a socket to a port was that the direction ...
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...
bool legalPortConnections(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
bool illegalRegistration_
Indicates if the reason for last test failure was illegal registration.
virtual ~MachineTester()
bool illegalRegistration() const
bool wrongSocketDirection() const
bool maxConnections() const
TTAMachine::Bus * branchedBus() const
virtual bool canConnect(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment)
bool noConnections() const
TTAMachine::Port * forbiddenSocketDirection(TTAMachine::Socket::Direction direction) const
virtual bool canBridge(const TTAMachine::Bus &source, const TTAMachine::Bus &destination)
MachineTester(const MachineTester &tester)
bool maxConnections_
Indicates if the reason for failure when trying to connect a socket to a port was that this connectio...
bool noConnections_
Indicates if the reason for failure when tried to set socket direction was that the socket has no seg...
static bool isValidComponentName(const std::string &name)
bool registerFilePortAlreadyConnected() const
bool connectionExists() const
TTAMachine::Port * sameDirInputSocketConn_
If the reason for failure when tried to set socket direction to input was that the socket is connecte...
bool unknownSocketDirection() const
bool loop() const
TTAMachine::Port * forbiddenInputSocketDir_
If the reason for failure when tried to set socket direction to input was the socket is connected to ...
virtual bool canSetDirection(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
bool loop_
Indicates if the reason for failure when trying to bridge two busses is that a loop in the bus chain ...
bool connectionExists_
Indicates if the reason for the last test failure is that the tested connection already exists.
bool unknownDir_
Indicates if tried to set the socket direction to Socket::UNKNOWN.
bool rfPortAlreadyConnected_
Indicates if the reason for failure is that a port of register file is already connected to a particu...
static bool areInSameChain(const TTAMachine::Bus &bus1, const TTAMachine::Bus &bus2)