torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::architecture::segments_unit_test_helper Class Reference
+ Collaboration diagram for torc::architecture::segments_unit_test_helper:

Public Member Functions

 segments_unit_test_helper (DDB &inDDB)
 Basic constructor. More...
 
void operator() (void)
 Analyze segment expansion, and detect any tilewire conflicts. More...
 
void analyzeSegmentTilewire (const Tilewire &inTilewire)
 Verifies and enforces segment ownership of the specified tilewire. More...
 

Static Public Member Functions

static void statistics (void)
 Outputs statistics on segment expansion. More...
 

Private Types

typedef xilinx::TileCount TileCount
 
typedef xilinx::TileIndex TileIndex
 
typedef xilinx::TileTypeIndex TileTypeIndex
 
typedef xilinx::WireCount WireCount
 
typedef xilinx::WireIndex WireIndex
 
typedef Segments::SegmentReference SegmentReference
 
typedef xilinx::CompactSegmentIndex CompactSegmentIndex
 
typedef boost::uint64_t uint64_t
 

Private Attributes

DDBmDDB
 
const TilesmTiles
 
const SegmentsmSegments
 
std::map< Tilewire,
CompactSegmentIndex
mUsage
 
const CompactSegmentIndex cUsagePruned
 
const CompactSegmentIndex cUsageUndefined
 
uint64_t mTilewireCount
 
uint64_t mTilewiresAnalyzed
 
uint64_t mTilewiresPruned
 
uint64_t mTilewiresUndefined
 

Static Private Attributes

static uint64_t sTotalTilewireCount = 0
 Total number of tilewires visited. More...
 
static uint64_t sTotalTilewiresAnalyzed = 0
 Total number of tilewires analyzed (visited or expanded). More...
 
static uint64_t sTotalTilewiresPruned = 0
 Total number of tilewires pruned from the device (absent from XDLRC). More...
 
static uint64_t sTotalTilewiresUndefined = 0
 Total number of tilewires never defined (sanity check). More...
 

Detailed Description

Definition at line 50 of file SegmentsUnitTest.cpp.

Member Typedef Documentation

Definition at line 58 of file SegmentsUnitTest.cpp.

Constructor & Destructor Documentation

torc::architecture::segments_unit_test_helper::segments_unit_test_helper ( DDB inDDB)
inline

Basic constructor.

Definition at line 75 of file SegmentsUnitTest.cpp.

75  : mDDB(inDDB), mTiles(mDDB.getTiles()),
78  cUsageUndefined(CompactSegmentIndex(static_cast<boost::uint32_t>(-2))), mTilewireCount(0),
80  // functions tested during database initialization and deletion:
81  // Segments(void);
82  // size_t readTilewireSegments(DigestStream& inStream);
83  // size_t readSegments(DigestStream& inStream);
84  // size_t readIrregularArcs(DigestStream& inStream);
85  }
const Tiles & getTiles(void) const
Returns a constant reference to the family and device tile data.
Definition: DDB.hpp:146
const Segments & getSegments(void) const
Returns a constant reference to the device segment data.
Definition: DDB.hpp:142

Member Function Documentation

void torc::architecture::segments_unit_test_helper::analyzeSegmentTilewire ( const Tilewire inTilewire)
inline

Verifies and enforces segment ownership of the specified tilewire.

Definition at line 185 of file SegmentsUnitTest.cpp.

185  {
187  // extract the tilewire information
188  TileIndex tileIndex = inTilewire.getTileIndex();
189  WireIndex wireIndex = inTilewire.getWireIndex();
190  const Array<SegmentReference>& tilewireSegments = mSegments.mTilewireSegments[tileIndex];
191  // look up the segment reference information
192  const SegmentReference& segmentReference = tilewireSegments[wireIndex];
193  CompactSegmentIndex compactSegmentIndex = segmentReference.getCompactSegmentIndex();
194  TileIndex anchorTileIndex = segmentReference.getAnchorTileIndex();
195  (void) anchorTileIndex;
196  // look up the current tilewire membership
197  CompactSegmentIndex usageCompactSegmentIndex = mUsage[inTilewire];
198  if(compactSegmentIndex == usageCompactSegmentIndex) {
199  // there has been no change
200  //std::cerr << "Match: " << static_cast<int>(compactSegmentIndex) << " for "
201  // << inTilewire << std::endl;
202  } else if(usageCompactSegmentIndex == cUsageUndefined) {
203  // this wire was not previously defined, so we accept the new value
204  mUsage[inTilewire] = compactSegmentIndex;
205  //std::cerr << "Definition: " << static_cast<int>(compactSegmentIndex) << " for "
206  // << inTilewire << std::endl;
207  } else {
208  std::cerr << "Mismatch (" << static_cast<int>(compactSegmentIndex) << " vs. "
209  << static_cast<int>(usageCompactSegmentIndex) << ") for " << inTilewire
210  << std::endl;
211  BOOST_CHECK_EQUAL(static_cast<int>(compactSegmentIndex),
212  static_cast<int>(usageCompactSegmentIndex));
213  }
214  }
std::map< Tilewire, CompactSegmentIndex > mUsage
Array2D< SegmentReference > mTilewireSegments
The segment references for every wire in every tile.
Definition: Segments.hpp:119

+ Here is the call graph for this function:

void torc::architecture::segments_unit_test_helper::operator() ( void  )
inline

Analyze segment expansion, and detect any tilewire conflicts.

Definition at line 99 of file SegmentsUnitTest.cpp.

99  {
100  // functions tested:
101  // const Segments::SegmentReference& getTilewireSegment(const Tilewire& inTilewire);
102  TileCount tileCount = mTiles.getTileCount();
103  mUsage.clear();
104 // int totalTrivialCount = 0;
105 // int totalDefinedCount = 0;
106 // for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
107 // const TileInfo& tileInfo = mTiles.getTileInfo(tileIndex);
108 // TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
109 // WireCount wireCount = mTiles.getWireCount(tileTypeIndex);
110 // for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
111 // Tilewire tilewire(tileIndex, wireIndex);
112 // const SegmentReference& segmentReference
113 // = mSegments.getTilewireSegment(tilewire);
114 // if(segmentReference.isDefined()) { totalDefinedCount++; continue; }
115 // if(segmentReference.isTrivial()) { totalTrivialCount++; continue; }
116 // // this segment is real, so we want to track things
117 // }
118 // }
119  //std::cerr << "totalTrivialCount: " << totalTrivialCount << std::endl;
120  //std::cerr << "totalDefinedCount: " << totalDefinedCount << std::endl;
121  //BOOST_CHECK_EQUAL(totalWireCount, mSegments.getTotalWireCount());
122 
123  // clear the usage information for all tilewires
124  for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
125  const Array<SegmentReference>& tilewireSegments
126  = mSegments.mTilewireSegments[tileIndex];
127  WireCount wireCount = WireCount(tilewireSegments.getSize());
128  for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
129  Tilewire tilewire(tileIndex, wireIndex);
130  mUsage[tilewire] = cUsageUndefined;
131  mTilewireCount++;
132  }
133  }
134 
135  // iterate through all tilewires and look for any conflicting segment ownership
136  for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
137  const Array<SegmentReference>& tilewireSegments
138  = mSegments.mTilewireSegments[tileIndex];
139  WireCount wireCount = WireCount(tilewireSegments.getSize());
140  for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
141  Tilewire tilewire(tileIndex, wireIndex);
142  analyzeSegmentTilewire(tilewire);
143  TilewireVector segmentTilewires;
144  mDDB.expandSegment(tilewire, segmentTilewires, DDB::eExpandDirectionNone);
145  TilewireVector::const_iterator p = segmentTilewires.begin();
146  TilewireVector::const_iterator e = segmentTilewires.end();
147  while(p < e) {
149  }
150  }
151  }
152 
153  // look for any tilewires without segment definitions
154  for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
155  const Array<SegmentReference>& tilewireSegments
156  = mSegments.mTilewireSegments[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) {
163  std::cerr << "Undefined: " << tilewire << std::endl;
164  BOOST_CHECK(mUsage[tilewire] != cUsageUndefined);
165  } else if(usage == cUsagePruned) {
167  }
168  }
169  }
170  std::cerr << "---------------------------------------" << std::endl;
171  std::cerr << "Tilewire count: " << std::setw(12) << mTilewireCount
172  << std::endl;
173  std::cerr << "Tilewires analyzed: " << std::setw(12) << mTilewiresAnalyzed
174  << std::endl;
175  std::cerr << "Tilewires pruned: " << std::setw(12) << mTilewiresPruned
176  << std::endl;
177  std::cerr << "Tilewires undefined: " << std::setw(12) << mTilewiresUndefined
178  << std::endl;
183  }
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
Definition: Tilewire.hpp:101
static uint64_t sTotalTilewiresUndefined
Total number of tilewires never defined (sanity check).
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).
Array2D< SegmentReference > mTilewireSegments
The segment references for every wire in every tile.
Definition: Segments.hpp:119
TileCount getTileCount(void) const
Returns the tile count for this device.
Definition: Tiles.hpp:149
static uint64_t sTotalTilewiresAnalyzed
Total number of tilewires analyzed (visited or expanded).
static uint64_t sTotalTilewireCount
Total number of tilewires visited.
void expandSegment(const Tilewire &inTilewire, TilewireVector &outTilewires, EExpandDirection inExpandDirection=eExpandDirectionNone)
Expands the given tilewire's segment.
Definition: DDB.cpp:154

+ Here is the call graph for this function:

static void torc::architecture::segments_unit_test_helper::statistics ( void  )
inlinestatic

Outputs statistics on segment expansion.

Definition at line 87 of file SegmentsUnitTest.cpp.

87  {
88  std::cerr << "=======================================" << std::endl;
89  std::cerr << "Total tilewire count: " << std::setw(12) << sTotalTilewireCount
90  << std::endl;
91  std::cerr << "Total tilewires analyzed: " << std::setw(12) << sTotalTilewiresAnalyzed
92  << std::endl;
93  std::cerr << "Total tilewires pruned: " << std::setw(12) << sTotalTilewiresPruned
94  << std::endl;
95  std::cerr << "Total tilewires undefined: " << std::setw(12) << sTotalTilewiresUndefined
96  << std::endl;
97  }
static uint64_t sTotalTilewiresUndefined
Total number of tilewires never defined (sanity check).
static uint64_t sTotalTilewiresPruned
Total number of tilewires pruned from the device (absent from XDLRC).
static uint64_t sTotalTilewiresAnalyzed
Total number of tilewires analyzed (visited or expanded).
static uint64_t sTotalTilewireCount
Total number of tilewires visited.

Field Documentation

const CompactSegmentIndex torc::architecture::segments_unit_test_helper::cUsagePruned
private

Definition at line 63 of file SegmentsUnitTest.cpp.

const CompactSegmentIndex torc::architecture::segments_unit_test_helper::cUsageUndefined
private

Definition at line 64 of file SegmentsUnitTest.cpp.

DDB& torc::architecture::segments_unit_test_helper::mDDB
private

Definition at line 59 of file SegmentsUnitTest.cpp.

const Segments& torc::architecture::segments_unit_test_helper::mSegments
private

Definition at line 61 of file SegmentsUnitTest.cpp.

const Tiles& torc::architecture::segments_unit_test_helper::mTiles
private

Definition at line 60 of file SegmentsUnitTest.cpp.

uint64_t torc::architecture::segments_unit_test_helper::mTilewireCount
private

Definition at line 65 of file SegmentsUnitTest.cpp.

uint64_t torc::architecture::segments_unit_test_helper::mTilewiresAnalyzed
private

Definition at line 66 of file SegmentsUnitTest.cpp.

uint64_t torc::architecture::segments_unit_test_helper::mTilewiresPruned
private

Definition at line 67 of file SegmentsUnitTest.cpp.

uint64_t torc::architecture::segments_unit_test_helper::mTilewiresUndefined
private

Definition at line 68 of file SegmentsUnitTest.cpp.

std::map<Tilewire, CompactSegmentIndex> torc::architecture::segments_unit_test_helper::mUsage
private

Definition at line 62 of file SegmentsUnitTest.cpp.

uint64_t torc::architecture::segments_unit_test_helper::sTotalTilewireCount = 0
staticprivate

Total number of tilewires visited.

Definition at line 69 of file SegmentsUnitTest.cpp.

uint64_t torc::architecture::segments_unit_test_helper::sTotalTilewiresAnalyzed = 0
staticprivate

Total number of tilewires analyzed (visited or expanded).

Definition at line 70 of file SegmentsUnitTest.cpp.

uint64_t torc::architecture::segments_unit_test_helper::sTotalTilewiresPruned = 0
staticprivate

Total number of tilewires pruned from the device (absent from XDLRC).

Definition at line 71 of file SegmentsUnitTest.cpp.

uint64_t torc::architecture::segments_unit_test_helper::sTotalTilewiresUndefined = 0
staticprivate

Total number of tilewires never defined (sanity check).

Definition at line 72 of file SegmentsUnitTest.cpp.


The documentation for this class was generated from the following file: