OpenASIP  2.0
BEMTester.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 BEMTester.hh
26  *
27  * Declaration of BEMTester class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_BEM_TESTER_HH
34 #define TTA_BEM_TESTER_HH
35 
36 #include <tuple>
37 
38 #include "BinaryEncoding.hh"
39 
40 class SlotField;
41 class MoveSlot;
42 class SocketEncoding;
43 class GuardField;
44 class SourceField;
45 class DestinationField;
46 class SocketCodeTable;
47 class PortCode;
48 
49 /**
50  * BEMTester is a helper class which provides useful validity checking methods
51  * for the BEM module itself and for other clients.
52  */
53 class BEMTester {
54 public:
55  static bool canAddComponentEncoding(
56  SlotField& field,
57  unsigned int encoding,
58  unsigned int extraBits);
60  MoveSlot& slot,
61  unsigned int encoding,
62  unsigned int extraBits,
63  int offset = 0);
64  static bool canAddPortEncoding(
65  SocketCodeTable& table,
66  unsigned int encoding,
67  unsigned int extraBits);
68 
69 private:
70  static int commonBitCount(
71  unsigned int enc1,
72  unsigned int extraBits1,
73  unsigned int enc2,
74  unsigned int extraBits2,
75  int alignment);
76  static int calculateAlignment(
77  unsigned int enc1,
78  unsigned int enc2,
79  const SlotField& field);
80  static bool fieldsOverlap(
81  const InstructionField& with,
82  unsigned int toFieldWidth,
83  int toFieldPos);
84  static bool fieldsOverlap(
85  unsigned width1, int pos1,
86  unsigned width2, int pos2);
87  static bool conflictsWithGuardEncoding(
88  const GuardField& field,
89  unsigned int encoding, unsigned int width, int offset);
90  static bool conflictsWithSourceEncodings(
91  const SourceField& field,
92  unsigned int encoding, unsigned int width, int offset);
94  const DestinationField& field,
95  unsigned int encoding, unsigned int width, int offset);
97  const SocketCodeTable& scTable,
98  unsigned int encoding, unsigned int width, int offset);
99  static std::tuple<unsigned, unsigned, int> splitEncoding(
100  unsigned encoding, unsigned encodingWidth,
101  unsigned targetWidth, int offsetToTarget);
102  static std::tuple<unsigned, unsigned, int> splitEncodingTo(
103  const SocketEncoding& socketEncoding,
104  unsigned encoding, unsigned encodingWidth, int offsetToTarget);
105 };
106 
107 #endif
PortCode
Definition: PortCode.hh:45
DestinationField
Definition: DestinationField.hh:44
MoveSlot
Definition: MoveSlot.hh:60
GuardField
Definition: GuardField.hh:55
BEMTester
Definition: BEMTester.hh:53
BEMTester::fieldsOverlap
static bool fieldsOverlap(const InstructionField &with, unsigned int toFieldWidth, int toFieldPos)
Definition: BEMTester.cc:382
InstructionField
Definition: InstructionField.hh:43
SocketCodeTable
Definition: SocketCodeTable.hh:68
BEMTester::conflictsWithGuardEncoding
static bool conflictsWithGuardEncoding(const GuardField &field, unsigned int encoding, unsigned int width, int offset)
Definition: BEMTester.cc:430
BinaryEncoding.hh
BEMTester::commonBitCount
static int commonBitCount(unsigned int enc1, unsigned int extraBits1, unsigned int enc2, unsigned int extraBits2, int alignment)
Definition: BEMTester.cc:309
BEMTester::calculateAlignment
static int calculateAlignment(unsigned int enc1, unsigned int enc2, const SlotField &field)
Definition: BEMTester.cc:352
BEMTester::conflictsWithDestinationEncodings
static bool conflictsWithDestinationEncodings(const DestinationField &field, unsigned int encoding, unsigned int width, int offset)
Definition: BEMTester.cc:560
BEMTester::canAddPortEncoding
static bool canAddPortEncoding(SocketCodeTable &table, unsigned int encoding, unsigned int extraBits)
Definition: BEMTester.cc:247
BEMTester::splitEncoding
static std::tuple< unsigned, unsigned, int > splitEncoding(unsigned encoding, unsigned encodingWidth, unsigned targetWidth, int offsetToTarget)
Definition: BEMTester.cc:677
SlotField
Definition: SlotField.hh:58
BEMTester::splitEncodingTo
static std::tuple< unsigned, unsigned, int > splitEncodingTo(const SocketEncoding &socketEncoding, unsigned encoding, unsigned encodingWidth, int offsetToTarget)
Definition: BEMTester.cc:713
BEMTester::conflictsWithSourceEncodings
static bool conflictsWithSourceEncodings(const SourceField &field, unsigned int encoding, unsigned int width, int offset)
Definition: BEMTester.cc:488
BEMTester::canAddComponentEncoding
static bool canAddComponentEncoding(SlotField &field, unsigned int encoding, unsigned int extraBits)
Definition: BEMTester.cc:73
SocketEncoding
Definition: SocketEncoding.hh:51
BEMTester::conflictsWithSocketTableEncodings
static bool conflictsWithSocketTableEncodings(const SocketCodeTable &scTable, unsigned int encoding, unsigned int width, int offset)
Definition: BEMTester.cc:618
BEMTester::canAddComponentPriorityEncoding
static bool canAddComponentPriorityEncoding(MoveSlot &slot, unsigned int encoding, unsigned int extraBits, int offset=0)
Definition: BEMTester.cc:180
SourceField
Definition: SourceField.hh:48