00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef TORC_ARCHITECTURE_SEGMENTS_HPP
00020 #define TORC_ARCHITECTURE_SEGMENTS_HPP
00021
00022 #include "torc/architecture/XilinxDatabaseTypes.hpp"
00023 #include "torc/architecture/DigestStream.hpp"
00024 #include "torc/architecture/Array.hpp"
00025 #include "torc/architecture/Tilewire.hpp"
00026
00027 namespace torc {
00028 namespace architecture {
00029
00030
00031 namespace architecture { class architecture_segments; }
00032 namespace architecture { class segments_regression_test_helper; }
00033 namespace architecture { class segments_unit_test_helper; }
00034
00035
00036
00037
00038
00039 class Segments {
00040
00041
00042 friend class DDB;
00043
00044 friend class torc::architecture::architecture::architecture_segments;
00045 friend class torc::architecture::architecture::segments_regression_test_helper;
00046 friend class torc::architecture::architecture::segments_unit_test_helper;
00047 protected:
00048
00049 typedef std::string string;
00050 typedef xilinx::TileCount TileCount;
00051 typedef xilinx::TileIndex TileIndex;
00052 typedef xilinx::WireIndex WireIndex;
00053 typedef xilinx::TileOffset TileOffset;
00054 typedef xilinx::CompactSegmentCount CompactSegmentCount;
00055 typedef xilinx::CompactSegmentIndex CompactSegmentIndex;
00056
00057 enum { eSegmentUndefined = 0xffffffff, eSegmentTrivial = 0 };
00058
00059
00060
00061
00062
00063 class CompactSegmentTilewire {
00064 WireIndex mWireIndex;
00065 TileOffset mTileOffset;
00066 public:
00067 inline WireIndex getWireIndex(void) const { return mWireIndex; }
00068 inline TileOffset getTileOffset(void) const { return mTileOffset; }
00069 CompactSegmentTilewire(void) : mWireIndex(), mTileOffset() {}
00070 CompactSegmentTilewire(WireIndex inWireIndex, TileOffset inTileOffset)
00071 : mWireIndex(inWireIndex), mTileOffset(inTileOffset) {}
00072 };
00073
00074
00075
00076 class SegmentReference {
00077 CompactSegmentIndex mCompactSegmentIndex;
00078 TileIndex mAnchorTileIndex;
00079 public:
00080 inline CompactSegmentIndex getCompactSegmentIndex(void) const
00081 { return mCompactSegmentIndex; }
00082 inline TileIndex getAnchorTileIndex(void) const { return mAnchorTileIndex; }
00083 SegmentReference(void) : mCompactSegmentIndex(), mAnchorTileIndex() {}
00084 SegmentReference(CompactSegmentIndex inCompactSegmentIndex, TileIndex inAnchorTileIndex)
00085 : mCompactSegmentIndex(inCompactSegmentIndex), mAnchorTileIndex(inAnchorTileIndex)
00086 {}
00087 void undefine(void) {
00088 mCompactSegmentIndex = CompactSegmentIndex(eSegmentUndefined);
00089 mAnchorTileIndex = TileIndex(eSegmentUndefined);
00090 }
00091 bool isDefined(void) const { return mCompactSegmentIndex != eSegmentUndefined; }
00092 bool isTrivial(void) const { return mCompactSegmentIndex == eSegmentTrivial; }
00093 static const SegmentReference& getTrivialSegment(void)
00094 { return sTrivialSegmentReference; }
00095 static const SegmentReference sTrivialSegmentReference;
00096 };
00097
00098
00099
00100
00101
00102 class IrregularArc {
00103 WireIndex mSourceWireIndex;
00104 WireIndex mSinkWireIndex;
00105 public:
00106 inline WireIndex getSourceWireIndex(void) const { return mSourceWireIndex; }
00107 inline WireIndex getSinkWireIndex(void) const { return mSinkWireIndex; }
00108 IrregularArc(void) : mSourceWireIndex(), mSinkWireIndex() {}
00109 IrregularArc(WireIndex inSourceWireIndex, WireIndex inSinkWireIndex)
00110 : mSourceWireIndex(inSourceWireIndex), mSinkWireIndex(inSinkWireIndex) {}
00111 };
00112
00113
00114 Array2D<CompactSegmentTilewire> mCompactSegments;
00115
00116 Array2D<SegmentReference> mTilewireSegments;
00117
00118 Array2D<IrregularArc> mIrregularArcs;
00119
00120 CompactSegmentCount mCompactSegmentCount;
00121
00122 uint32_t mIrregularArcCount;
00123
00124
00125
00126 uint32_t mTotalWireCount;
00127
00128
00129
00130 uint32_t mTotalSegmentCount;
00131
00132
00133 Segments(void);
00134
00135
00136 size_t readTilewireSegments(DigestStream& inStream);
00137
00138 size_t readSegments(DigestStream& inStream, bool inExtendedAnchorTileCount);
00139
00140 size_t readIrregularArcs(DigestStream& inStream);
00141
00142 const Segments::IrregularArc* getIrregularArc(TileIndex inTileIndex,
00143 WireIndex inSourceWireIndex, WireIndex inSinkWireIndex);
00144 public:
00145
00146
00147 uint32_t getTotalWireCount(void) const { return mTotalWireCount; }
00148
00149 uint32_t getTotalSegmentCount(void) const { return mTotalSegmentCount; }
00150
00151 uint32_t getCompactSegmentCount(void) const { return mCompactSegmentCount; }
00152
00153 uint32_t getIrregularArcCount(void) const { return mIrregularArcCount; }
00154
00155 const Segments::SegmentReference& getTilewireSegment(const Tilewire& inTilewire) const {
00156 return mTilewireSegments[inTilewire.getTileIndex()][inTilewire.getWireIndex()];
00157 }
00158 };
00159
00160 }
00161 }
00162
00163 #endif // TORC_ARCHITECTURE_SEGMENTS_HPP