OpenASIP  2.0
MachineInfo.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2015 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 MachineInfo.hh
26  *
27  * Declaration of MachineInfo class.
28  *
29  * @author Mikael Lepistö 2008 (mikael.lepisto-no.spam-tut.fi)
30  * @author Pekka Jääskeläinen 2014-2015
31  * @note rating: red
32  */
33 
34 #ifndef TTA_MACHINE_INFO_HH
35 #define TTA_MACHINE_INFO_HH
36 
37 #include "InstructionTemplate.hh"
38 #include "CIStringSet.hh"
39 
40 #include <set>
41 #include <vector>
42 #include <climits>
43 
44 namespace TTAMachine {
45  class AddressSpace;
46  class Machine;
47  class HWOperation;
48  class FUPort;
49  class Port;
50  class InstructionTemplate;
51  class ControlUnit;
52  class FunctionUnit;
53 }
54 
55 class Operand;
56 class Operation;
57 
58 class MachineInfo {
59 public:
61  typedef std::vector<const TTAMachine::FUPort*> ConstPortList;
62 
63  static int maxLatency(const TTAMachine::Machine& mach, TCEString& opName);
64  static OperationSet getOpset(
65  const TTAMachine::Machine& mach);
66  static OperationSet getOpset(
67  const TTAMachine::ControlUnit& gcu);
69  const TTAMachine::Machine& mach,
70  const std::string& operation);
71  static const TTAMachine::FUPort* getBoundPort(
72  const TTAMachine::FunctionUnit& fu,
73  const std::string& opName, int operandIndex);
74  static bool supportsOperation(
75  const TTAMachine::Machine& mach, TCEString operation);
77  const TTAMachine::Machine& mach);
78  static int longestGuardLatency(
79  const TTAMachine::Machine& mach);
80  static Operand& operandFromPort(
81  const TTAMachine::HWOperation& hwOp,
82  const TTAMachine::FUPort& port);
83  static int maxMemoryAlignment(
84  const TTAMachine::Machine &mach);
85  static bool templatesUsesSlot(
86  const TTAMachine::Machine& mach,
87  const std::string& slotName);
88  static std::set<TTAMachine::InstructionTemplate*> templatesUsingSlot(
89  const TTAMachine::Machine& mach,
90  const std::string& slotName);
91  static bool canEncodeImmediateInteger(
92  const TTAMachine::Machine& mach, int64_t imm,
93  unsigned destWidth=UINT_MAX);
94  static bool canEncodeImmediateInteger(
96  int64_t imm, unsigned destWidth=UINT_MAX);
97  static int triggerIndex(
98  const TTAMachine::Machine& machine, const Operation& op);
99  static int triggerIndex(
100  const TTAMachine::FunctionUnit& fu, const Operation& op);
101  static bool canEncodeImmediateInteger(
102  const TTAMachine::Bus& bus, int64_t imm, unsigned destWidth=UINT_MAX);
103  static unsigned findWidestOperand(
104  const TTAMachine::Machine& machine, bool vector) ;
105  static unsigned numberOfRegisters(
106  const TTAMachine::Machine& machine, unsigned width);
109  static bool supportsPortGuardedJump(
110  const TTAMachine::Machine& machine, bool inverted, const TCEString& opName);
111 
112  static std::vector<const TTAMachine::FunctionUnit*> findLockUnits(
114  static Operation& osalOperation(const TTAMachine::HWOperation& hwOp);
115 
116 private:
117  MachineInfo();
118  template<typename PortType>
119  static PortType& portFromOperand(
120  const TTAMachine::HWOperation& hwOp,
121  const TTAMachine::FUPort& port);
122 
123  static const TCEString LOCK_READ_;
124  static const TCEString TRY_LOCK_ADDR_;
125  static const TCEString UNLOCK_ADDR_;
126 };
127 
128 
129 
130 #endif
Operand
Definition: Operand.hh:52
MachineInfo::templatesUsingSlot
static std::set< TTAMachine::InstructionTemplate * > templatesUsingSlot(const TTAMachine::Machine &mach, const std::string &slotName)
Definition: MachineInfo.cc:365
MachineInfo::maxMemoryAlignment
static int maxMemoryAlignment(const TTAMachine::Machine &mach)
Definition: MachineInfo.cc:261
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
MachineInfo
Definition: MachineInfo.hh:58
MachineInfo::supportsOperation
static bool supportsOperation(const TTAMachine::Machine &mach, TCEString operation)
Definition: MachineInfo.cc:382
MachineInfo::TRY_LOCK_ADDR_
static const TCEString TRY_LOCK_ADDR_
Definition: MachineInfo.hh:124
MachineInfo::MachineInfo
MachineInfo()
TTAMachine::Bus
Definition: Bus.hh:53
MachineInfo::osalOperation
static Operation & osalOperation(const TTAMachine::HWOperation &hwOp)
Definition: MachineInfo.cc:794
MachineInfo::findLockUnits
static std::vector< const TTAMachine::FunctionUnit * > findLockUnits(const TTAMachine::Machine &machine)
Definition: MachineInfo.cc:759
MachineInfo::maxLatency
static int maxLatency(const TTAMachine::Machine &mach, TCEString &opName)
Definition: MachineInfo.cc:806
MachineInfo::defaultDataAddressSpace
static TTAMachine::AddressSpace * defaultDataAddressSpace(const TTAMachine::Machine &mach)
Definition: MachineInfo.cc:176
TTAMachine::InstructionTemplate
Definition: InstructionTemplate.hh:49
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::FUPort
Definition: FUPort.hh:46
CIStringSet.hh
MachineInfo::supportsPortGuardedJump
static bool supportsPortGuardedJump(const TTAMachine::Machine &machine, bool inverted, const TCEString &opName)
Definition: MachineInfo.cc:703
MachineInfo::LOCK_READ_
static const TCEString LOCK_READ_
Definition: MachineInfo.hh:123
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
InstructionTemplate.hh
MachineInfo::getBoundPort
static const TTAMachine::FUPort * getBoundPort(const TTAMachine::FunctionUnit &fu, const std::string &opName, int operandIndex)
Definition: MachineInfo.cc:156
TCETools::CIStringSet
std::set< TCEString, CaseInsensitiveCmp > CIStringSet
Definition: CIStringSet.hh:49
MachineInfo::getOpset
static OperationSet getOpset(const TTAMachine::Machine &mach)
Definition: MachineInfo.cc:65
MachineInfo::findWidestOperand
static unsigned findWidestOperand(const TTAMachine::Machine &machine, bool vector)
Definition: MachineInfo.cc:566
MachineInfo::longestGuardLatency
static int longestGuardLatency(const TTAMachine::Machine &mach)
Definition: MachineInfo.cc:202
MachineInfo::numberOfRegisters
static unsigned numberOfRegisters(const TTAMachine::Machine &machine, unsigned width)
Definition: MachineInfo.cc:594
Operation
Definition: Operation.hh:59
MachineInfo::UNLOCK_ADDR_
static const TCEString UNLOCK_ADDR_
Definition: MachineInfo.hh:125
MachineInfo::operandFromPort
static Operand & operandFromPort(const TTAMachine::HWOperation &hwOp, const TTAMachine::FUPort &port)
Definition: MachineInfo.cc:241
MachineInfo::OperationSet
TCETools::CIStringSet OperationSet
Definition: MachineInfo.hh:60
TCEString
Definition: TCEString.hh:53
MachineInfo::portFromOperand
static PortType & portFromOperand(const TTAMachine::HWOperation &hwOp, const TTAMachine::FUPort &port)
MachineInfo::supportsPortGuardedJumps
static bool supportsPortGuardedJumps(const TTAMachine::Machine &machine)
Definition: MachineInfo.cc:663
MachineInfo::getPortBindingsOfOperation
static ConstPortList getPortBindingsOfOperation(const TTAMachine::Machine &mach, const std::string &operation)
Definition: MachineInfo.cc:117
TTAMachine
Definition: Assembler.hh:48
MachineInfo::ConstPortList
std::vector< const TTAMachine::FUPort * > ConstPortList
Definition: MachineInfo.hh:61
MachineInfo::triggerIndex
static int triggerIndex(const TTAMachine::Machine &machine, const Operation &op)
Definition: MachineInfo.cc:530
MachineInfo::supportsBoolRegisterGuardedJumps
static bool supportsBoolRegisterGuardedJumps(const TTAMachine::Machine &machine)
Definition: MachineInfo.cc:616
MachineInfo::canEncodeImmediateInteger
static bool canEncodeImmediateInteger(const TTAMachine::Machine &mach, int64_t imm, unsigned destWidth=UINT_MAX)
Definition: MachineInfo.cc:444
TTAMachine::Machine
Definition: Machine.hh:73
MachineInfo::templatesUsesSlot
static bool templatesUsesSlot(const TTAMachine::Machine &mach, const std::string &slotName)
Definition: MachineInfo.cc:339