19 #include <boost/test/unit_test.hpp>
29 namespace architecture {
31 BOOST_AUTO_TEST_SUITE(architecture)
61 std::map<Tilewire, CompactSegmentIndex>
mUsage;
77 mSegments(mDDB.getSegments()),
78 cUsagePruned(CompactSegmentIndex(CompactSegmentIndex::undefined())),
79 cUsageUndefined(CompactSegmentIndex(static_cast<boost::uint32_t>(-2))), mTilewireCount(0),
80 mTilewiresAnalyzed(0), mTilewiresPruned(0), mTilewiresUndefined(0), mTilewireMismatches(0) {
89 std::cerr <<
"=======================================" << std::endl;
90 std::cerr <<
"Total tilewire count: " << std::setw(12) << sTotalTilewireCount
92 std::cerr <<
"Total tilewires analyzed: " << std::setw(12) << sTotalTilewiresAnalyzed
94 std::cerr <<
"Total tilewires pruned: " << std::setw(12) << sTotalTilewiresPruned
96 std::cerr <<
"Total tilewires undefined: " << std::setw(12) << sTotalTilewiresUndefined
98 std::cerr <<
"Total tilewire mismatches: " << std::setw(12) << sTotalTilewireMismatches
102 void operator ()(
void) {
109 for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
112 WireCount wireCount = WireCount(tilewireSegments.
getSize());
113 for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
114 Tilewire tilewire(tileIndex, wireIndex);
115 mUsage[tilewire] = cUsageUndefined;
120 for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
123 WireCount wireCount = WireCount(tilewireSegments.
getSize());
124 for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
125 Tilewire tilewire(tileIndex, wireIndex);
126 analyzeSegmentTilewire(tilewire);
129 TilewireVector::const_iterator p = segmentTilewires.begin();
130 TilewireVector::const_iterator e = segmentTilewires.end();
132 analyzeSegmentTilewire(*p++);
137 for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
140 WireCount wireCount = WireCount(tilewireSegments.
getSize());
141 for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
142 Tilewire tilewire(tileIndex, wireIndex);
143 CompactSegmentIndex usage = mUsage[tilewire];
144 if(usage == cUsageUndefined) {
145 mTilewiresUndefined++;
146 std::cerr <<
"Undefined: " << tilewire << std::endl;
147 BOOST_CHECK(mUsage[tilewire] != cUsageUndefined);
148 }
else if(usage == cUsagePruned) {
153 std::cerr <<
"---------------------------------------" << std::endl;
154 std::cerr <<
"Tilewire count: " << std::setw(12) << mTilewireCount
156 std::cerr <<
"Tilewires analyzed: " << std::setw(12) << mTilewiresAnalyzed
158 std::cerr <<
"Tilewires pruned: " << std::setw(12) << mTilewiresPruned
160 std::cerr <<
"Tilewires undefined: " << std::setw(12) << mTilewiresUndefined
162 std::cerr <<
"Tilewire mismatches: " << std::setw(12) << mTilewireMismatches
164 sTotalTilewireCount += mTilewireCount;
165 sTotalTilewiresAnalyzed += mTilewiresAnalyzed;
166 sTotalTilewiresPruned += mTilewiresPruned;
167 sTotalTilewiresUndefined += mTilewiresUndefined;
168 sTotalTilewireMismatches += mTilewireMismatches;
173 BOOST_CHECK(mTilewireMismatches == 0);
177 mTilewiresAnalyzed++;
183 const SegmentReference& segmentReference = tilewireSegments[wireIndex];
186 (void) anchorTileIndex;
188 CompactSegmentIndex usageCompactSegmentIndex = mUsage[inTilewire];
189 if(compactSegmentIndex == usageCompactSegmentIndex) {
193 }
else if(usageCompactSegmentIndex == cUsageUndefined) {
195 mUsage[inTilewire] = compactSegmentIndex;
199 mTilewireMismatches++;
200 std::cerr <<
"Mismatch (" <<
static_cast<int>(compactSegmentIndex) <<
" vs. "
201 << static_cast<int>(usageCompactSegmentIndex) <<
") for " << inTilewire
203 BOOST_CHECK_EQUAL(static_cast<int>(compactSegmentIndex),
204 static_cast<int>(usageCompactSegmentIndex));
225 torc::common::DeviceVector::const_iterator dp = devices.begin();
226 torc::common::DeviceVector::const_iterator de = devices.end();
229 if(device.empty())
break;
239 BOOST_AUTO_TEST_SUITE_END()
const WireIndex & getWireIndex(void) const
Returns the wire index.
Encapsulation of a tile index in an unsigned 32-bit integer.
CompactSegmentIndex getCompactSegmentIndex(void) const
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
xilinx::CompactSegmentIndex CompactSegmentIndex
Header for the Segments class.
static uint64_t sTotalTilewireMismatches
Total number of tilewire mismatches (more than one segment contending for one tilewire).
Device database, including complete wiring and logic support.
BOOST_AUTO_TEST_CASE(ArcUnitTest)
Unit test for the Arc class.
void analyzeSegmentTilewire(const Tilewire &inTilewire)
Verifies and enforces segment ownership of the specified tilewire.
static uint64_t sTotalTilewiresPruned
Total number of tilewires pruned from the device (absent from XDLRC).
xilinx::TileTypeIndex TileTypeIndex
Header for the DDBStreamHelper class.
Segments::SegmentReference SegmentReference
Array2D< SegmentReference > mTilewireSegments
The segment references for every wire in every tile.
Encapsulation of a wire index in an unsigned 16-bit integer.
static uint64_t sTotalTilewiresAnalyzed
Total number of tilewires analyzed (visited or expanded).
static uint64_t sTotalTilewiresUndefined
Total number of tilewires never defined (sanity check).
TileCount getTileCount(void) const
Returns the tile count for this device.
uint64_t mTilewiresPruned
static uint64_t sTotalTilewireCount
Total number of tilewires visited.
uint32_t getActualWireCount(void) const
Return the number of actual wires in the device (unpruned and non-trivial).
xilinx::TileCount TileCount
xilinx::TileIndex TileIndex
xilinx::WireCount WireCount
static const DeviceVector & getSupportedDevices(void)
Returns all devices.
Header for torc::physical output stream helpers.
const CompactSegmentIndex cUsagePruned
const Segments & mSegments
TileIndex getAnchorTileIndex(void) const
Encapsulation of a device tile and wire pair.
Regression test class for segments consistency across all devices.
Tile map, tile type, and wire information for the family and device.
const CompactSegmentIndex cUsageUndefined
Encapsulation of a wire count in an unsigned 16-bit integer.
Encapsulation of a tile count in an unsigned 32-bit integer.
segments_regression_test_helper(DDB &inDDB)
Basic constructor.
Header for the Devices class.
Encapsulation of a compact segment index in an unsigned 32-bit integer.
uint64_t mTilewiresAnalyzed
static void statistics(void)
Outputs statistics on segment expansion.
Encapsulation of compact segment index and an anchoring tile index.
Encapsulation of a tile type index in an unsigned 16-bit integer.
Header for the DDB class.
const TileIndex & getTileIndex(void) const
Returns the tile index.
uint64_t mTilewiresUndefined
std::map< Tilewire, CompactSegmentIndex > mUsage
std::vector< std::string > DeviceVector
Vector of device names.
Segment and irregular arc data for the device.
uint64_t mTilewireMismatches
Encapsulation of a static array.
void expandSegment(const Tilewire &inTilewire, TilewireVector &outTilewires, EExpandDirection inExpandDirection=eExpandDirectionNone)
Expands the given tilewire's segment.
uint32_t getSize(void) const
Returns the array size.
xilinx::WireIndex WireIndex