torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WireInfo.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Header for the WireInfo class.
18 
19 #ifndef TORC_ARCHITECTURE_WIREINFO_HPP
20 #define TORC_ARCHITECTURE_WIREINFO_HPP
21 
24 #include <cstring>
25 #include <cstdlib>
26 
27 namespace torc {
28 namespace architecture {
29 
30  /// \brief Array of wire indexes.
31  class WireArray : public Array<const xilinx::WireIndex> {};
32 
33  /// \brief Encapsulation of a wire within a tile type.
34  /// \details The wire information includes the wire name, attribute flags, and arrays of all
35  /// tied, regular, and irregular sources and sinks.
36  class WireInfo {
37  // friends
38  /// \brief The Tiles class has access to our protected members.
39  friend class Tiles;
40  protected:
41  // types
42  /// \brief Imported type name.
43  typedef boost::uint16_t uint16_t;
44  /// \brief Imported type name.
46  // members
47  /// \brief This wire's offset into the arc usage bitset.
49  /// \brief The attribute flags for this wire.
51  /// \brief The name for this wire.
52  const char* mName;
53  /// \brief The tied sink array for this wire.
55  /// \brief The tied source array for this wire.
57  /// \brief The sink array for this wire.
59  /// \brief The source array for this wire.
61  /// \brief The irregular sink array for this wire.
63  /// \brief The irregular source array for this wire.
65  /// \brief The routethrough sink array for this wire.
67  /// \brief The routethrough source array for this wire.
69  // constructors
70  /// \brief Protected constructor.
71  WireInfo(uint16_t inOffset, WireFlags inFlags, const char* inName) : mArcOffset(inOffset),
74  // make a private copy of the wire name
75  mName = strdup(inName);
76  }
77  // constructors
78  /// \brief Disabled copy constructor.
79  WireInfo(const WireInfo& /*rhs*/) : mArcOffset(), mFlags(), mName(0), mTiedSinks(),
82  public:
83  // enumerations
84  /// \brief Enumeration of wire attribute flags.
85  enum EWireFlag {
89  };
90  // constructors
91  /// \brief Null constructor.
95  /// \brief Non-virtual destructor.
96  ~WireInfo(void) {
97  // release the wire name if allocated
98  if(mName != 0) { free(const_cast<char*>(mName)); mName = 0; }
99  }
100  // accessors
101  /// \brief Returns this wire's offset into the arc usage bitset.
102  /// \details Every wire in a tile type has a wire index, as well as zero or more arcs.
103  /// The offset for this wire is the total number of arcs for all wires seen so far
104  /// (i.e. wires of lower index).
105  const uint16_t getArcOffset(void) const { return mArcOffset; }
106  /// \brief Returns the attribute flags for this wire.
107  const WireFlags getFlags(void) const { return mFlags; }
108  /// \brief Returns the name for this wire.
109  const char* getName(void) const { return mName; }
110  /// \brief Returns the tied sink array for this wire.
111  const WireArray& getTiedSinks(void) const { return mTiedSinks; }
112  /// \brief Returns the tied source array for this wire.
113  const WireArray& getTiedSources(void) const { return mTiedSources; }
114  /// \brief Returns the sink array for this wire.
115  const WireArray& getSinks(void) const { return mSinks; }
116  /// \brief Returns the source array for this wire.
117  const WireArray& getSources(void) const { return mSources; }
118  /// \brief Returns the irregular sink array for this wire.
119  const WireArray& getIrregularSinks(void) const { return mIrregularSinks; }
120  /// \brief Returns the irregular source array for this wire.
121  const WireArray& getIrregularSources(void) const { return mIrregularSources; }
122  /// \brief Returns the routethrough sink array for this wire.
123  const WireArray& getRoutethroughSinks(void) const { return mRoutethroughSinks; }
124  /// \brief Returns the routethrough source array for this wire.
126  // tests
127  /// \brief Returns true if the wire is hidden in traces.
128  bool isHidden(void) const { return isHidden(mFlags); }
129  /// \brief Returns true if the wire is a logic input.
130  bool isInput(void) const { return isInput(mFlags); }
131  /// \brief Returns true if the wire is a logic output.
132  bool isOutput(void) const { return isOutput(mFlags); }
133  /// \brief Returns true if the wire is a remote wire.
134  bool isRemote(void) const { return isRemote(mFlags); }
135  /// \brief Returns true if the wire is a global wire (a what!?).
136  bool isGlobal(void) const { return isGlobal(mFlags); }
137  /// \brief Returns true if the wire may be referenced by a remote wire.
138  bool isRemoteNodeCapable(void) const { return isRemoteNodeCapable(mFlags); }
139  /// \brief Returns true if the wire may be referenced by a remote arc.
140  bool isRemoteArcCapable(void) const { return isRemoteArcCapable(mFlags); }
141  /// \brief Returns true if the wire has any sinks.
142  bool hasSinks(void) const { return mTiedSinks.getSize() || mSinks.getSize()
144  /// \brief Returns true if the wire has any sources.
145  bool hasSources(void) const { return mTiedSources.getSize() || mSources.getSize()
147  // static
148  /// \brief Returns true if the wire is hidden in traces.
149  static bool isHidden(WireFlags inWireFlags)
150  { return (inWireFlags & eWireFlagHidden) != 0; }
151  /// \brief Returns true if the wire is a logic input.
152  static bool isInput(WireFlags inWireFlags)
153  { return (inWireFlags & eWireFlagInput) != 0; }
154  /// \brief Returns true if the wire is a logic output.
155  static bool isOutput(WireFlags inWireFlags)
156  { return (inWireFlags & eWireFlagOutput) != 0; }
157  /// \brief Returns true if the wire is a remote wire.
158  static bool isRemote(WireFlags inWireFlags)
159  { return (inWireFlags & eWireFlagRemote) != 0; }
160  /// \brief Returns true if the wire is a global wire (a what!?).
161  static bool isGlobal(WireFlags inWireFlags)
162  { return (inWireFlags & eWireFlagGlobal) != 0; }
163  /// \brief Returns true if the wire may be referenced by a remote wire.
164  static bool isRemoteNodeCapable(WireFlags inWireFlags)
165  { return (inWireFlags & eWireFlagRemoteNodeCapable) != 0; }
166  /// \brief Returns true if the wire may be referenced by a remote arc.
167  static bool isRemoteArcCapable(WireFlags inWireFlags)
168  { return (inWireFlags & eWireFlagRemoteArcCapable) != 0; }
169  };
170 
171 } // namespace architecture
172 } // namespace torc
173 
174 #endif // TORC_ARCHITECTURE_WIREINFO_HPP
WireArray mTiedSinks
The tied sink array for this wire.
Definition: WireInfo.hpp:54
WireArray mRoutethroughSinks
The routethrough sink array for this wire.
Definition: WireInfo.hpp:66
static bool isInput(WireFlags inWireFlags)
Returns true if the wire is a logic input.
Definition: WireInfo.hpp:152
bool isOutput(void) const
Returns true if the wire is a logic output.
Definition: WireInfo.hpp:132
static bool isRemote(WireFlags inWireFlags)
Returns true if the wire is a remote wire.
Definition: WireInfo.hpp:158
WireArray mSinks
The sink array for this wire.
Definition: WireInfo.hpp:58
bool isGlobal(void) const
Returns true if the wire is a global wire (a what!?).
Definition: WireInfo.hpp:136
WireArray mIrregularSinks
The irregular sink array for this wire.
Definition: WireInfo.hpp:62
Array of wire indexes.
Definition: WireInfo.hpp:31
Encapsulation of wire attribute flags in an unsigned 16-bit integer.
const uint16_t getArcOffset(void) const
Returns this wire's offset into the arc usage bitset.
Definition: WireInfo.hpp:105
bool isInput(void) const
Returns true if the wire is a logic input.
Definition: WireInfo.hpp:130
const WireArray & getIrregularSinks(void) const
Returns the irregular sink array for this wire.
Definition: WireInfo.hpp:119
WireArray mIrregularSources
The irregular source array for this wire.
Definition: WireInfo.hpp:64
WireArray mSources
The source array for this wire.
Definition: WireInfo.hpp:60
const WireArray & getSources(void) const
Returns the source array for this wire.
Definition: WireInfo.hpp:117
bool isHidden(void) const
Returns true if the wire is hidden in traces.
Definition: WireInfo.hpp:128
~WireInfo(void)
Non-virtual destructor.
Definition: WireInfo.hpp:96
const WireArray & getRoutethroughSources(void) const
Returns the routethrough source array for this wire.
Definition: WireInfo.hpp:125
WireInfo(uint16_t inOffset, WireFlags inFlags, const char *inName)
Protected constructor.
Definition: WireInfo.hpp:71
const WireArray & getTiedSources(void) const
Returns the tied source array for this wire.
Definition: WireInfo.hpp:113
bool hasSinks(void) const
Returns true if the wire has any sinks.
Definition: WireInfo.hpp:142
const WireArray & getIrregularSources(void) const
Returns the irregular source array for this wire.
Definition: WireInfo.hpp:121
bool hasSources(void) const
Returns true if the wire has any sources.
Definition: WireInfo.hpp:145
bool isRemoteArcCapable(void) const
Returns true if the wire may be referenced by a remote arc.
Definition: WireInfo.hpp:140
static bool isOutput(WireFlags inWireFlags)
Returns true if the wire is a logic output.
Definition: WireInfo.hpp:155
uint16_t mArcOffset
This wire's offset into the arc usage bitset.
Definition: WireInfo.hpp:48
WireFlags mFlags
The attribute flags for this wire.
Definition: WireInfo.hpp:50
Tile map, tile type, and wire information for the family and device.
Definition: Tiles.hpp:36
WireArray mTiedSources
The tied source array for this wire.
Definition: WireInfo.hpp:56
static bool isHidden(WireFlags inWireFlags)
Returns true if the wire is hidden in traces.
Definition: WireInfo.hpp:149
const WireArray & getSinks(void) const
Returns the sink array for this wire.
Definition: WireInfo.hpp:115
WireInfo(void)
Null constructor.
Definition: WireInfo.hpp:92
static bool isGlobal(WireFlags inWireFlags)
Returns true if the wire is a global wire (a what!?).
Definition: WireInfo.hpp:161
const WireArray & getRoutethroughSinks(void) const
Returns the routethrough sink array for this wire.
Definition: WireInfo.hpp:123
const char * mName
The name for this wire.
Definition: WireInfo.hpp:52
Header for the Array class.
WireInfo(const WireInfo &)
Disabled copy constructor.
Definition: WireInfo.hpp:79
xilinx::WireFlags WireFlags
Imported type name.
Definition: WireInfo.hpp:45
EWireFlag
Enumeration of wire attribute flags.
Definition: WireInfo.hpp:85
const WireArray & getTiedSinks(void) const
Returns the tied sink array for this wire.
Definition: WireInfo.hpp:111
static bool isRemoteArcCapable(WireFlags inWireFlags)
Returns true if the wire may be referenced by a remote arc.
Definition: WireInfo.hpp:167
static bool isRemoteNodeCapable(WireFlags inWireFlags)
Returns true if the wire may be referenced by a remote wire.
Definition: WireInfo.hpp:164
Encapsulation of a wire within a tile type.
Definition: WireInfo.hpp:36
const char * getName(void) const
Returns the name for this wire.
Definition: WireInfo.hpp:109
boost::uint16_t uint16_t
Imported type name.
Definition: WireInfo.hpp:43
bool isRemote(void) const
Returns true if the wire is a remote wire.
Definition: WireInfo.hpp:134
const WireFlags getFlags(void) const
Returns the attribute flags for this wire.
Definition: WireInfo.hpp:107
WireArray mRoutethroughSources
The routethrough source array for this wire.
Definition: WireInfo.hpp:68
bool isRemoteNodeCapable(void) const
Returns true if the wire may be referenced by a remote wire.
Definition: WireInfo.hpp:138
Encapsulation of a static array.
Definition: Array.hpp:39
uint32_t getSize(void) const
Returns the array size.
Definition: Array.hpp:104
Device database types for Xilinx architectures.