00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef TORC_ARCHITECTURE_WIREINFO_HPP
00020 #define TORC_ARCHITECTURE_WIREINFO_HPP
00021
00022 #include "torc/architecture/XilinxDatabaseTypes.hpp"
00023 #include "torc/architecture/Array.hpp"
00024 #include <cstring>
00025 #include <cstdlib>
00026
00027 namespace torc {
00028 namespace architecture {
00029
00030
00031 class WireArray : public Array<const xilinx::WireIndex> {};
00032
00033
00034
00035
00036 class WireInfo {
00037
00038
00039 friend class Tiles;
00040 protected:
00041
00042
00043 typedef boost::uint16_t uint16_t;
00044
00045 typedef xilinx::WireFlags WireFlags;
00046
00047
00048 uint16_t mArcOffset;
00049
00050 WireFlags mFlags;
00051
00052 const char* mName;
00053
00054 WireArray mTiedSinks;
00055
00056 WireArray mTiedSources;
00057
00058 WireArray mSinks;
00059
00060 WireArray mSources;
00061
00062 WireArray mIrregularSinks;
00063
00064 WireArray mIrregularSources;
00065
00066 WireArray mRoutethroughSinks;
00067
00068 WireArray mRoutethroughSources;
00069
00070
00071 WireInfo(uint16_t inOffset, WireFlags inFlags, const char* inName) : mArcOffset(inOffset),
00072 mFlags(inFlags), mTiedSinks(), mTiedSources(), mSinks(), mSources(), mIrregularSinks(),
00073 mIrregularSources(), mRoutethroughSinks(), mRoutethroughSources() {
00074
00075 mName = strdup(inName);
00076 }
00077
00078
00079 WireInfo(const WireInfo& ) : mArcOffset(), mFlags(), mName(0), mTiedSinks(),
00080 mTiedSources(), mSinks(), mSources(), mIrregularSinks(), mIrregularSources(),
00081 mRoutethroughSinks(), mRoutethroughSources() {}
00082 public:
00083
00084
00085 enum EWireFlag {
00086 eWireFlagNone = 0, eWireFlagHidden = 1, eWireFlagInput = 2, eWireFlagOutput = 4,
00087 eWireFlagRemote = 8, eWireFlagGlobal = 16, eWireFlagRemoteNodeCapable = 64,
00088 eWireFlagRemoteArcCapable = 128
00089 };
00090
00091
00092 WireInfo(void) : mArcOffset(0), mFlags(eWireFlagNone), mName(0), mTiedSinks(),
00093 mTiedSources(), mSinks(), mSources(), mIrregularSinks(), mIrregularSources(),
00094 mRoutethroughSinks(), mRoutethroughSources() {}
00095
00096 ~WireInfo(void) {
00097
00098 if(mName != 0) { free(const_cast<char*>(mName)); mName = 0; }
00099 }
00100
00101
00102
00103
00104
00105 const uint16_t getArcOffset(void) const { return mArcOffset; }
00106
00107 const WireFlags getFlags(void) const { return mFlags; }
00108
00109 const char* getName(void) const { return mName; }
00110
00111 const WireArray& getTiedSinks(void) const { return mTiedSinks; }
00112
00113 const WireArray& getTiedSources(void) const { return mTiedSources; }
00114
00115 const WireArray& getSinks(void) const { return mSinks; }
00116
00117 const WireArray& getSources(void) const { return mSources; }
00118
00119 const WireArray& getIrregularSinks(void) const { return mIrregularSinks; }
00120
00121 const WireArray& getIrregularSources(void) const { return mIrregularSources; }
00122
00123 const WireArray& getRoutethroughSinks(void) const { return mRoutethroughSinks; }
00124
00125 const WireArray& getRoutethroughSources(void) const { return mRoutethroughSources; }
00126
00127
00128 bool isHidden(void) const { return isHidden(mFlags); }
00129
00130 bool isInput(void) const { return isInput(mFlags); }
00131
00132 bool isOutput(void) const { return isOutput(mFlags); }
00133
00134 bool isRemote(void) const { return isRemote(mFlags); }
00135
00136 bool isGlobal(void) const { return isGlobal(mFlags); }
00137
00138 bool isRemoteNodeCapable(void) const { return isRemoteNodeCapable(mFlags); }
00139
00140 bool isRemoteArcCapable(void) const { return isRemoteArcCapable(mFlags); }
00141
00142
00143 static bool isHidden(WireFlags inWireFlags)
00144 { return (inWireFlags & eWireFlagHidden) != 0; }
00145
00146 static bool isInput(WireFlags inWireFlags)
00147 { return (inWireFlags & eWireFlagInput) != 0; }
00148
00149 static bool isOutput(WireFlags inWireFlags)
00150 { return (inWireFlags & eWireFlagOutput) != 0; }
00151
00152 static bool isRemote(WireFlags inWireFlags)
00153 { return (inWireFlags & eWireFlagRemote) != 0; }
00154
00155 static bool isGlobal(WireFlags inWireFlags)
00156 { return (inWireFlags & eWireFlagGlobal) != 0; }
00157
00158 static bool isRemoteNodeCapable(WireFlags inWireFlags)
00159 { return (inWireFlags & eWireFlagRemoteNodeCapable) != 0; }
00160
00161 static bool isRemoteArcCapable(WireFlags inWireFlags)
00162 { return (inWireFlags & eWireFlagRemoteArcCapable) != 0; }
00163 };
00164
00165 }
00166 }
00167
00168 #endif // TORC_ARCHITECTURE_WIREINFO_HPP