OpenASIP 2.2
Loading...
Searching...
No Matches
BEMGenerator.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 BEMGenerator.hh
26 *
27 * Declaration of BEMGenerator class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_BEM_GENERATOR_HH
34#define TTA_BEM_GENERATOR_HH
35
36#include <map>
37#include <vector>
38
39#include "Socket.hh"
40
41class BinaryEncoding;
42class MoveSlot;
45class SourceField;
46class GuardField;
47class SocketCodeTable;
48
49namespace TTAMachine {
50 class Machine;
51 class Socket;
52 class Bus;
53 class Bridge;
54 class BaseRegisterFile;
55 class OperationTriggeredFormat;
56}
57
58/**
59 * Generates a binary encoding map for the given machine.
60 */
62public:
64 virtual ~BEMGenerator();
65
67
68private:
69 /// Map type for storing Socket - SocketCodeTable pairs.
70 typedef std::map<const TTAMachine::Socket*, SocketCodeTable*> SCTableMap;
71 /// Typedef for encoding (first = encoding, second = extra bits).
72 typedef std::pair<unsigned int, unsigned int> Encoding;
73
76 void addTopLevelFields(BinaryEncoding& bem) const;
77 void addSubfields(MoveSlot& slot) const;
78 void addEncodings(ImmediateControlField& field) const;
79 void addEncodings(DestinationField& field) const;
80 void addEncodings(SourceField& field) const;
81 void addEncodings(GuardField& field) const;
82
84 BinaryEncoding& bem, unsigned& amountOfRCustomOps,
85 unsigned& amountOfR3RCustomOps) const;
86
87 void addPortCodes(
88 SocketCodeTable& table,
89 const TTAMachine::Socket& socket) const;
92 const TTAMachine::Socket& socket) const;
95 SocketCodeTable* table);
96 std::multiset<int> socketCodeWidthsForBus(
97 const TTAMachine::Bus& bus,
98 TTAMachine::Socket::Direction socketDir) const;
99 unsigned int maxLongImmSlotWidth(const MoveSlot& slot) const;
100
101 static int socketCount(
102 const TTAMachine::Bus& bus,
105 int index,
106 const TTAMachine::Bus& bus,
109 static bool haveEqualConnections(
110 const TTAMachine::Socket& socket1,
111 const TTAMachine::Socket& socket2);
112 static int sourceBridgeCount(const TTAMachine::Bus& bus);
114 int index,
115 const TTAMachine::Bus& bus);
116 static bool hasUnconditionalGuard(const TTAMachine::Bus& bus);
117 static int requiredIndexWidth(
118 const TTAMachine::BaseRegisterFile& regFile);
119 static void calculateEncodings(
120 const std::multiset<int>& oppositeFieldWidths,
121 bool leftAlignment,
122 std::multiset<Encoding>& encodings);
123 static void addExtraBits(
124 std::multiset<Encoding>& encodings,
125 int bitCount);
126
127
128 /// The machine for which the BEM is generated.
130 /// A map which tells which socket code table belongs to a socket.
132};
133
134#endif
TTAMachine::Machine * machine
the architecture definition of the estimated processor
BinaryEncoding * generate()
const TTAMachine::Machine * machine_
The machine for which the BEM is generated.
void addSubfields(MoveSlot &slot) const
void addRiscvFormat(TTAMachine::OperationTriggeredFormat *format, BinaryEncoding &bem, unsigned &amountOfRCustomOps, unsigned &amountOfR3RCustomOps) const
static bool needsSocketCodeTable(const TTAMachine::Socket &socket)
static int socketCount(const TTAMachine::Bus &bus, TTAMachine::Socket::Direction direction)
std::multiset< int > socketCodeWidthsForBus(const TTAMachine::Bus &bus, TTAMachine::Socket::Direction socketDir) const
static void addExtraBits(std::multiset< Encoding > &encodings, int bitCount)
static TTAMachine::Socket & socket(int index, const TTAMachine::Bus &bus, TTAMachine::Socket::Direction direction)
void addPortCodes(SocketCodeTable &table, const TTAMachine::Socket &socket) const
SCTableMap scTableMap_
A map which tells which socket code table belongs to a socket.
static int requiredIndexWidth(const TTAMachine::BaseRegisterFile &regFile)
static bool haveEqualConnections(const TTAMachine::Socket &socket1, const TTAMachine::Socket &socket2)
virtual ~BEMGenerator()
static void calculateEncodings(const std::multiset< int > &oppositeFieldWidths, bool leftAlignment, std::multiset< Encoding > &encodings)
void addSocketCodeTables(BinaryEncoding &bem)
void addEncodings(ImmediateControlField &field) const
void addTopLevelFields(BinaryEncoding &bem) const
static int sourceBridgeCount(const TTAMachine::Bus &bus)
static TTAMachine::Bridge & sourceBridge(int index, const TTAMachine::Bus &bus)
std::pair< unsigned int, unsigned int > Encoding
Typedef for encoding (first = encoding, second = extra bits).
std::map< const TTAMachine::Socket *, SocketCodeTable * > SCTableMap
Map type for storing Socket - SocketCodeTable pairs.
SocketCodeTable * socketCodeTable(const TTAMachine::Socket &socket) const
SocketCodeTable * suitableSocketCodeTable(const TTAMachine::Socket &socket) const
static bool hasUnconditionalGuard(const TTAMachine::Bus &bus)
void assignSocketCodeTable(const TTAMachine::Socket *socket, SocketCodeTable *table)
unsigned int maxLongImmSlotWidth(const MoveSlot &slot) const
void addLongImmDstRegisterFields(BinaryEncoding &bem) const