OpenASIP  2.0
MachineValidator.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 MachineValidator.hh
26  *
27  * Declaration of MachineValidator class.
28  *
29  * @author Lasse Laasonen 2006 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_MACHINE_VALIDATOR_HH
34 #define TTA_MACHINE_VALIDATOR_HH
35 
36 #include <set>
37 #include <string>
38 
39 
40 namespace TTAMachine {
41  class Machine;
42  class FunctionUnit;
43 }
44 
46 
47 /**
48  * Validator of target architecture definitions (machines). It tests a given
49  * machine against various criteria (completeness, implementation-dependent
50  * restrictions to structure, synthesisability).
51  */
53 public:
54  /// Error codes for different errors.
55  enum ErrorCode {
56  /// GCU missing in machine.
58  /// Address space missing in GCU.
60  /// Pipeline uses an IO which is not bound.
62  /// JUMP and CALL uses different port in GCU.
64  /// PC port missing in GCU.
66  /// RA port missing in GCU.
68  /// RA and PC ports have unequal width.
70  /// Instruction memory address width differs from PC/RA port width.
72  /// FU has no operations with a trigger
74  /// FU is missing ports
76  };
77 
79  virtual ~MachineValidator();
80 
82  const std::set<ErrorCode>& errorsToCheck) const;
83 
84 private:
85  void checkGCUExists(MachineValidatorResults& results) const;
87  void checkOperandBindings(MachineValidatorResults& results) const;
89  MachineValidatorResults& results) const;
93  MachineValidatorResults& results) const;
94  void checkIMemAddrWidth(MachineValidatorResults& results) const;
95  void checkFUConnections(MachineValidatorResults& results) const;
96 
97  /// The machine to validate.
99 };
100 
101 #endif
MachineValidator::checkGCUHasAddressSpace
void checkGCUHasAddressSpace(MachineValidatorResults &results) const
Definition: MachineValidator.cc:134
MachineValidator::IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC
@ IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC
Instruction memory address width differs from PC/RA port width.
Definition: MachineValidator.hh:71
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
MachineValidator::GCU_MISSING
@ GCU_MISSING
GCU missing in machine.
Definition: MachineValidator.hh:57
MachineValidator::machine_
const TTAMachine::Machine & machine_
The machine to validate.
Definition: MachineValidator.hh:98
MachineValidator::USED_IO_NOT_BOUND
@ USED_IO_NOT_BOUND
Pipeline uses an IO which is not bound.
Definition: MachineValidator.hh:61
MachineValidator::MachineValidator
MachineValidator(const TTAMachine::Machine &machine)
Definition: MachineValidator.cc:62
MachineValidator::PC_PORT_MISSING
@ PC_PORT_MISSING
PC port missing in GCU.
Definition: MachineValidator.hh:65
MachineValidator::checkIMemAddrWidth
void checkIMemAddrWidth(MachineValidatorResults &results) const
Definition: MachineValidator.cc:309
MachineValidatorResults
Definition: MachineValidatorResults.hh:45
MachineValidator
Definition: MachineValidator.hh:52
MachineValidator::FU_PORT_MISSING
@ FU_PORT_MISSING
FU is missing ports.
Definition: MachineValidator.hh:75
MachineValidator::GCU_AS_MISSING
@ GCU_AS_MISSING
Address space missing in GCU.
Definition: MachineValidator.hh:59
MachineValidator::PC_AND_RA_PORTS_HAVE_UNEQUAL_WIDTH
@ PC_AND_RA_PORTS_HAVE_UNEQUAL_WIDTH
RA and PC ports have unequal width.
Definition: MachineValidator.hh:69
MachineValidator::checkRAPortHasSameWidthAsPCPort
void checkRAPortHasSameWidthAsPCPort(MachineValidatorResults &results) const
Definition: MachineValidator.cc:271
MachineValidator::DIFFERENT_PORT_FOR_JUMP_AND_CALL
@ DIFFERENT_PORT_FOR_JUMP_AND_CALL
JUMP and CALL uses different port in GCU.
Definition: MachineValidator.hh:63
MachineValidator::ErrorCode
ErrorCode
Error codes for different errors.
Definition: MachineValidator.hh:55
MachineValidator::checkReturnAddressPort
void checkReturnAddressPort(MachineValidatorResults &results) const
Definition: MachineValidator.cc:245
MachineValidator::checkGCUExists
void checkGCUExists(MachineValidatorResults &results) const
Definition: MachineValidator.cc:120
MachineValidator::RA_PORT_MISSING
@ RA_PORT_MISSING
RA port missing in GCU.
Definition: MachineValidator.hh:67
MachineValidator::validate
MachineValidatorResults * validate(const std::set< ErrorCode > &errorsToCheck) const
Definition: MachineValidator.cc:81
MachineValidator::checkProgramCounterPort
void checkProgramCounterPort(MachineValidatorResults &results) const
Definition: MachineValidator.cc:209
MachineValidator::~MachineValidator
virtual ~MachineValidator()
Definition: MachineValidator.cc:70
TTAMachine
Definition: Assembler.hh:48
MachineValidator::checkJumpAndCallOperandBindings
void checkJumpAndCallOperandBindings(MachineValidatorResults &results) const
Definition: MachineValidator.cc:179
MachineValidator::FU_NO_VALID_OPERATIONS
@ FU_NO_VALID_OPERATIONS
FU has no operations with a trigger.
Definition: MachineValidator.hh:73
MachineValidator::checkOperandBindings
void checkOperandBindings(MachineValidatorResults &results) const
Definition: MachineValidator.cc:155
TTAMachine::Machine
Definition: Machine.hh:73
MachineValidator::checkFUConnections
void checkFUConnections(MachineValidatorResults &results) const
Definition: MachineValidator.cc:362