19 #include <boost/test/unit_test.hpp>
29 namespace architecture {
31 BOOST_AUTO_TEST_SUITE(architecture)
62 std::map<Tilewire, CompactSegmentIndex>
mUsage;
76 mSegments(mDDB.getSegments()),
77 cUsagePruned(CompactSegmentIndex(CompactSegmentIndex::undefined())),
78 cUsageUndefined(CompactSegmentIndex(static_cast<boost::uint32_t>(-2))), mTilewireCount(0),
79 mTilewiresAnalyzed(0), mTilewiresPruned(0), mTilewiresUndefined(0) {
88 std::cerr <<
"=======================================" << std::endl;
89 std::cerr <<
"Total tilewire count: " << std::setw(12) << sTotalTilewireCount
91 std::cerr <<
"Total tilewires analyzed: " << std::setw(12) << sTotalTilewiresAnalyzed
93 std::cerr <<
"Total tilewires pruned: " << std::setw(12) << sTotalTilewiresPruned
95 std::cerr <<
"Total tilewires undefined: " << std::setw(12) << sTotalTilewiresUndefined
99 void operator ()(
void) {
124 for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
127 WireCount wireCount = WireCount(tilewireSegments.
getSize());
128 for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
129 Tilewire tilewire(tileIndex, wireIndex);
130 mUsage[tilewire] = cUsageUndefined;
136 for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
139 WireCount wireCount = WireCount(tilewireSegments.
getSize());
140 for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
141 Tilewire tilewire(tileIndex, wireIndex);
142 analyzeSegmentTilewire(tilewire);
145 TilewireVector::const_iterator p = segmentTilewires.begin();
146 TilewireVector::const_iterator e = segmentTilewires.end();
148 analyzeSegmentTilewire(*p++);
154 for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
157 WireCount wireCount = WireCount(tilewireSegments.
getSize());
158 for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
159 Tilewire tilewire(tileIndex, wireIndex);
160 CompactSegmentIndex usage = mUsage[tilewire];
161 if(usage == cUsageUndefined) {
162 mTilewiresUndefined++;
163 std::cerr <<
"Undefined: " << tilewire << std::endl;
164 BOOST_CHECK(mUsage[tilewire] != cUsageUndefined);
165 }
else if(usage == cUsagePruned) {
170 std::cerr <<
"---------------------------------------" << std::endl;
171 std::cerr <<
"Tilewire count: " << std::setw(12) << mTilewireCount
173 std::cerr <<
"Tilewires analyzed: " << std::setw(12) << mTilewiresAnalyzed
175 std::cerr <<
"Tilewires pruned: " << std::setw(12) << mTilewiresPruned
177 std::cerr <<
"Tilewires undefined: " << std::setw(12) << mTilewiresUndefined
179 sTotalTilewireCount += mTilewireCount;
180 sTotalTilewiresAnalyzed += mTilewiresAnalyzed;
181 sTotalTilewiresPruned += mTilewiresPruned;
182 sTotalTilewiresUndefined += mTilewiresUndefined;
186 mTilewiresAnalyzed++;
192 const SegmentReference& segmentReference = tilewireSegments[wireIndex];
195 (void) anchorTileIndex;
197 CompactSegmentIndex usageCompactSegmentIndex = mUsage[inTilewire];
198 if(compactSegmentIndex == usageCompactSegmentIndex) {
202 }
else if(usageCompactSegmentIndex == cUsageUndefined) {
204 mUsage[inTilewire] = compactSegmentIndex;
208 std::cerr <<
"Mismatch (" <<
static_cast<int>(compactSegmentIndex) <<
" vs. "
209 << static_cast<int>(usageCompactSegmentIndex) <<
") for " << inTilewire
211 BOOST_CHECK_EQUAL(static_cast<int>(compactSegmentIndex),
212 static_cast<int>(usageCompactSegmentIndex));
234 torc::common::DeviceVector::const_iterator dp = devices.begin();
235 torc::common::DeviceVector::const_iterator de = devices.end();
239 if(device.empty())
break;
242 segments_unit_test_helper segmentTester(ddb);
247 BOOST_CHECK_MESSAGE(
false,
"WARNING: Need to check segment packing.");
252 BOOST_AUTO_TEST_SUITE_END()
uint64_t mTilewiresAnalyzed
const WireIndex & getWireIndex(void) const
Returns the wire index.
Encapsulation of a tile index in an unsigned 32-bit integer.
CompactSegmentIndex getCompactSegmentIndex(void) const
uint64_t mTilewiresPruned
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
Header for the Segments class.
static uint64_t sTotalTilewiresUndefined
Total number of tilewires never defined (sanity check).
Device database, including complete wiring and logic support.
BOOST_AUTO_TEST_CASE(ArcUnitTest)
Unit test for the Arc class.
const CompactSegmentIndex cUsagePruned
xilinx::TileCount TileCount
std::map< Tilewire, CompactSegmentIndex > mUsage
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).
Header for the DDBStreamHelper class.
Array2D< SegmentReference > mTilewireSegments
The segment references for every wire in every tile.
Encapsulation of a wire index in an unsigned 16-bit integer.
TileCount getTileCount(void) const
Returns the tile count for this device.
static void statistics(void)
Outputs statistics on segment expansion.
const Segments & mSegments
xilinx::CompactSegmentIndex CompactSegmentIndex
segments_unit_test_helper(DDB &inDDB)
Basic constructor.
Header for torc::physical output stream helpers.
TileIndex getAnchorTileIndex(void) const
Encapsulation of a device tile and wire pair.
Tile map, tile type, and wire information for the family and device.
xilinx::WireCount WireCount
Encapsulation of a wire count in an unsigned 16-bit integer.
Encapsulation of a tile count in an unsigned 32-bit integer.
xilinx::WireIndex WireIndex
Header for the Devices class.
Encapsulation of a compact segment index in an unsigned 32-bit integer.
static uint64_t sTotalTilewiresAnalyzed
Total number of tilewires analyzed (visited or expanded).
Encapsulation of compact segment index and an anchoring tile index.
static uint64_t sTotalTilewireCount
Total number of tilewires visited.
Encapsulation of a tile type index in an unsigned 16-bit integer.
const CompactSegmentIndex cUsageUndefined
Segments::SegmentReference SegmentReference
Header for the DDB class.
const TileIndex & getTileIndex(void) const
Returns the tile index.
std::vector< std::string > DeviceVector
Vector of device names.
Segment and irregular arc data for the device.
xilinx::TileIndex TileIndex
static const DeviceVector & getUnitTestDevices(void)
Returns a subset of devices for unit tests.
xilinx::TileTypeIndex TileTypeIndex
uint64_t mTilewiresUndefined
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.