OpenASIP  2.0
BEMValidator.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 BEMValidator.hh
26  *
27  * Declaration of BEMValidator class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @author Otto Esko 2008 (otto.esko-no.spam-tut.fi)
31  * @note rating: red
32  */
33 
34 #ifndef TTA_BEM_VALIDATOR_HH
35 #define TTA_BEM_VALIDATOR_HH
36 
37 #include <vector>
38 #include <string>
39 
40 #include "Exception.hh"
41 
42 namespace TTAMachine {
43  class Machine;
44  class Bus;
45  class ImmediateSlot;
46  class ControlUnit;
47 }
48 
49 class BinaryEncoding;
50 class SocketEncoding;
51 class MoveSlot;
52 
53 /**
54  * Validates binary encoding maps against machines. Checks that the
55  * BEM contains all the required information.
56  */
57 class BEMValidator {
58 public:
60  const BinaryEncoding& bem,
62  ~BEMValidator();
63 
64  bool validate();
65  int errorCount() const;
66  std::string errorMessage(int index) const;
67  int warningCount() const;
68  std::string warningMessage(int index) const;
69 
70 private:
71  /// Vector type for string.
72  typedef std::vector<std::string> StringVector;
73 
74  void checkMoveSlot(const TTAMachine::Bus& bus);
75  void checkDestinationField(const TTAMachine::Bus& bus);
76  void checkSourceField(const TTAMachine::Bus& bus);
77  void checkGuardField(const TTAMachine::Bus& bus);
78  void checkSocketCodeTable(const SocketEncoding& socketEnc);
79  void checkImmediateSlot(const TTAMachine::ImmediateSlot& immSlot);
83 
84  bool needsSourceField(const MoveSlot& slot) const;
85  bool needsSocketCodeTable(const SocketEncoding& socketEnc) const;
86 
87  /// The binary encoding map.
89  /// The machine.
91 
92  /// Contains the error messages.
94  /// Contains the warning messages.
96 };
97 
98 #endif
BEMValidator::~BEMValidator
~BEMValidator()
Definition: BEMValidator.cc:82
BEMValidator::checkDestinationField
void checkDestinationField(const TTAMachine::Bus &bus)
Definition: BEMValidator.cc:317
BinaryEncoding
Definition: BinaryEncoding.hh:61
BEMValidator::checkImmediateControlField
void checkImmediateControlField()
Definition: BEMValidator.cc:596
BEMValidator::BEMValidator
BEMValidator(const BinaryEncoding &bem, const TTAMachine::Machine &machine)
Definition: BEMValidator.cc:72
BEMValidator::checkMoveSlot
void checkMoveSlot(const TTAMachine::Bus &bus)
Definition: BEMValidator.cc:204
MoveSlot
Definition: MoveSlot.hh:60
BEMValidator::StringVector
std::vector< std::string > StringVector
Vector type for string.
Definition: BEMValidator.hh:72
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
Exception.hh
BEMValidator::validate
bool validate()
Definition: BEMValidator.cc:95
TTAMachine::Bus
Definition: Bus.hh:53
BEMValidator::warningCount
int warningCount() const
Definition: BEMValidator.cc:173
BEMValidator::checkGuardField
void checkGuardField(const TTAMachine::Bus &bus)
Definition: BEMValidator.cc:385
BEMValidator::warningMessages_
StringVector warningMessages_
Contains the warning messages.
Definition: BEMValidator.hh:95
BEMValidator::needsSourceField
bool needsSourceField(const MoveSlot &slot) const
Definition: BEMValidator.cc:716
BEMValidator::machine_
const TTAMachine::Machine & machine_
The machine.
Definition: BEMValidator.hh:90
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
BEMValidator::needsSocketCodeTable
bool needsSocketCodeTable(const SocketEncoding &socketEnc) const
Definition: BEMValidator.cc:767
BEMValidator::checkImmediateSlot
void checkImmediateSlot(const TTAMachine::ImmediateSlot &immSlot)
Definition: BEMValidator.cc:568
BEMValidator::checkSocketCodeTable
void checkSocketCodeTable(const SocketEncoding &socketEnc)
Definition: BEMValidator.cc:468
BEMValidator::errorMessages_
StringVector errorMessages_
Contains the error messages.
Definition: BEMValidator.hh:93
BEMValidator::errorCount
int errorCount() const
Definition: BEMValidator.cc:145
BEMValidator::errorMessage
std::string errorMessage(int index) const
Definition: BEMValidator.cc:159
BEMValidator::bem_
const BinaryEncoding & bem_
The binary encoding map.
Definition: BEMValidator.hh:88
BEMValidator
Definition: BEMValidator.hh:57
TTAMachine
Definition: Assembler.hh:48
SocketEncoding
Definition: SocketEncoding.hh:51
TTAMachine::ImmediateSlot
Definition: ImmediateSlot.hh:44
BEMValidator::checkLImmDstRegisterFields
void checkLImmDstRegisterFields()
Definition: BEMValidator.cc:628
BEMValidator::checkImemMauWidth
void checkImemMauWidth(TTAMachine::ControlUnit &gcu)
Definition: BEMValidator.cc:691
BEMValidator::warningMessage
std::string warningMessage(int index) const
Definition: BEMValidator.cc:186
TTAMachine::Machine
Definition: Machine.hh:73
BEMValidator::checkSourceField
void checkSourceField(const TTAMachine::Bus &bus)
Definition: BEMValidator.cc:226