OpenASIP  2.0
ConflictDetectionCodeGenerator.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 ConflictDetectionCodeGenerator.hh
26  *
27  * Declaration of ConflictDetectionCodeGenerator class.
28  *
29  * @author Viljami Korhonen 2008 (viljami.korhonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef CONFLICT_DETECTION_CODE_GENERATOR_HH
34 #define CONFLICT_DETECTION_CODE_GENERATOR_HH
35 
36 #include "BaseType.hh"
37 
38 #include <string>
39 #include <map>
40 
41 namespace TTAMachine {
42  class Machine;
43  class FunctionUnit;
44  class FUPort;
45  class Port;
46  class Unit;
47  class HWOperation;
48  class Guard;
49  class RegisterFile;
50  class ControlUnit;
51 }
52 
53 namespace TTAProgram {
54  class Instruction;
55  class Terminal;
56  class Move;
57 }
58 
60 
61 /**
62  * A class that generates C/C++ code for FU conflict detection cases
63  *
64  * Used for the compiled simulation
65  *
66  */
68 public:
72  bool conflictDetectionEnabled = false);
74 
75  std::string includes();
76  std::string symbolDeclaration(const TTAMachine::FunctionUnit& fu);
77  std::string extraInitialization();
78  std::string notifyOfConflicts();
79  std::string updateSymbolDeclarations();
80  std::string advanceClockCode();
81  std::string detectConflicts(const TTAMachine::HWOperation& op);
82 
83  bool conflictDetectionEnabled() const;
84 
85 private:
86  /// Copying not allowed.
88  /// Assignment not allowed.
90 
91  /// The machine
93 
94  /// True, if the conflict detection is enabled
96 
97  /// The FU resource conflict detector used, empty string if disabled.
98  std::string conflictDetectorType_;
99  /// The method in the resource conflict detector used to detect conflicts,
100  /// empty string if disabled.
102  /// The method to be called on the conflict detector on cycle advance.
104  /// A method to be called on the conflict detector for initialization,
105  /// empty if none.
107 
108  /// 1=fu.name(), 2=conflict detector object name
109  typedef std::map<std::string, std::string> ConflictDetectorObjectNameMap;
110  /// The resource conflict detector object name for each FU if any.
112 
113  /// Symbol generator
115 };
116 
117 #endif
TTAProgram
Definition: Estimator.hh:65
ConflictDetectionCodeGenerator::conflictDetectorExtraInitMethod_
std::string conflictDetectorExtraInitMethod_
A method to be called on the conflict detector for initialization, empty if none.
Definition: ConflictDetectionCodeGenerator.hh:106
BaseType.hh
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
TTAMachine::HWOperation
Definition: HWOperation.hh:52
ConflictDetectionCodeGenerator::detectConflicts
std::string detectConflicts(const TTAMachine::HWOperation &op)
Definition: ConflictDetectionCodeGenerator.cc:257
ConflictDetectionCodeGenerator::conflictDetectors_
ConflictDetectorObjectNameMap conflictDetectors_
The resource conflict detector object name for each FU if any.
Definition: ConflictDetectionCodeGenerator.hh:111
ConflictDetectionCodeGenerator::symbolGen_
const CompiledSimSymbolGenerator & symbolGen_
Symbol generator.
Definition: ConflictDetectionCodeGenerator.hh:114
ConflictDetectionCodeGenerator::conflictDetectionEnabled
bool conflictDetectionEnabled() const
Definition: ConflictDetectionCodeGenerator.cc:288
ConflictDetectionCodeGenerator::conflictDetectorAdvanceCycle_
std::string conflictDetectorAdvanceCycle_
The method to be called on the conflict detector on cycle advance.
Definition: ConflictDetectionCodeGenerator.hh:103
ConflictDetectionCodeGenerator::includes
std::string includes()
Definition: ConflictDetectionCodeGenerator.cc:139
ConflictDetectionCodeGenerator::machine_
const TTAMachine::Machine & machine_
The machine.
Definition: ConflictDetectionCodeGenerator.hh:92
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
ConflictDetectionCodeGenerator
Definition: ConflictDetectionCodeGenerator.hh:67
ConflictDetectionCodeGenerator::~ConflictDetectionCodeGenerator
virtual ~ConflictDetectionCodeGenerator()
Definition: ConflictDetectionCodeGenerator.cc:131
ConflictDetectionCodeGenerator::operator=
ConflictDetectionCodeGenerator & operator=(const ConflictDetectionCodeGenerator &)
Assignment not allowed.
ConflictDetectionCodeGenerator::ConflictDetectionCodeGenerator
ConflictDetectionCodeGenerator(const TTAMachine::Machine &machine, const CompiledSimSymbolGenerator &, bool conflictDetectionEnabled=false)
Definition: ConflictDetectionCodeGenerator.cc:57
ConflictDetectionCodeGenerator::notifyOfConflicts
std::string notifyOfConflicts()
Definition: ConflictDetectionCodeGenerator.cc:192
CompiledSimSymbolGenerator
Definition: CompiledSimSymbolGenerator.hh:66
ConflictDetectionCodeGenerator::ConflictDetectorObjectNameMap
std::map< std::string, std::string > ConflictDetectorObjectNameMap
1=fu.name(), 2=conflict detector object name
Definition: ConflictDetectionCodeGenerator.hh:109
ConflictDetectionCodeGenerator::conflictDetectorType_
std::string conflictDetectorType_
The FU resource conflict detector used, empty string if disabled.
Definition: ConflictDetectionCodeGenerator.hh:98
ConflictDetectionCodeGenerator::updateSymbolDeclarations
std::string updateSymbolDeclarations()
Definition: ConflictDetectionCodeGenerator.cc:213
ConflictDetectionCodeGenerator::symbolDeclaration
std::string symbolDeclaration(const TTAMachine::FunctionUnit &fu)
Definition: ConflictDetectionCodeGenerator.cc:156
TTAMachine
Definition: Assembler.hh:48
ConflictDetectionCodeGenerator::conflictDetectorMethod_
std::string conflictDetectorMethod_
The method in the resource conflict detector used to detect conflicts, empty string if disabled.
Definition: ConflictDetectionCodeGenerator.hh:101
ConflictDetectionCodeGenerator::advanceClockCode
std::string advanceClockCode()
Definition: ConflictDetectionCodeGenerator.cc:234
ConflictDetectionCodeGenerator::extraInitialization
std::string extraInitialization()
Definition: ConflictDetectionCodeGenerator.cc:174
TTAMachine::Machine
Definition: Machine.hh:73
ConflictDetectionCodeGenerator::conflictDetectionEnabled_
bool conflictDetectionEnabled_
True, if the conflict detection is enabled.
Definition: ConflictDetectionCodeGenerator.hh:95