27 size_t tileTypeDBCount = tileTypeDbs.size();
28 for (
size_t i = 0; i < tileTypeDBCount; ++i)
35 gatherCorrelationUnits(tileTypeDb.
typeIndex(), design, device, cfgExtractor);
36 if (m_tileUnits.size() == 0)
continue;
46 initPIPStates(firstUnit.pipBitSize(), firstUnit.cfgBitSize());
50 isolatePIPs(m_tileUnits);
53 writePIPsToDb(tileTypeDb);
58 void Correlator::gatherCorrelationUnits(
size_t tileTypeIndex,
63 m_tileIndices.clear();
65 xdlExtractor.getTileTypeUnits(m_tileUnits, m_tileIndices, tileTypeIndex);
69 size_t tileIndicesIndex = 0;
71 while (unitIndex < (m_tileUnits.size()))
76 size_t tileIndex = m_tileIndices[tileIndicesIndex++];
77 const Tile& tile = tiles.at(tileIndex);
78 unsigned tileRow = tile.
row();
79 unsigned tileColumn = tile.
column();
86 if (0 != dataWordCount) ++unitIndex;
89 m_tileUnits.erase(m_tileUnits.begin() + unitIndex);
94 if (m_buffer.size() < dataWordCount) m_buffer.resize(dataWordCount);
96 cfgExtractor.
getDataWords(tileRow, tileColumn, &(m_buffer[0]), dataWordCount);
103 m_tileIndices.clear();
107 void Correlator::buildPIPControlSetMap(
const PIPControlSets& pipControlSets)
110 m_pipControlSetMap.clear();
113 size_t controlSetCount = pipControlSets.size();
114 for (
size_t i = 0; i < controlSetCount; ++i)
121 size_t pipCount = pipBitValues.size();
122 for (
size_t j = 0; j < pipCount; ++j)
125 size_t pipIndex = (pipBitValues[j]).pipIndex();
128 pipControlSetMap_t::iterator lb = m_pipControlSetMap.lower_bound(pipIndex);
129 if ((m_pipControlSetMap.end() != lb) && (pipIndex == lb->first))
132 m_pipControlSetMap.insert(lb, std::make_pair(pipIndex, &controlSet));
138 void Correlator::initPIPStates(
size_t pipCount,
size_t cfgBitCount)
141 m_pipStates.resize(pipCount);
142 for (
size_t i = 0; i < pipCount; ++i)
156 size_t pipCount = m_pipStates.size();
157 for (
size_t i = 0; i < pipCount; ++i)
163 pipControlSetMap_t::const_iterator it = m_pipControlSetMap.find(i);
164 if (m_pipControlSetMap.end() == it)
throw Exception();
168 size_t pipCountCs = pipBitValues.size();
171 size_t unitCount = correlationUnits.size();
172 for (
size_t j = 0; j < unitCount; ++j)
182 bool compatible =
true;
183 for (
size_t k = 0; k < pipCountCs; ++k)
184 if (unit.
testPIPBit((pipBitValues[k]).pipIndex()))
201 size_t controlSetCount = controlSets.size();
202 for (
size_t i = 0; i < controlSetCount; ++i)
210 getCfgBitPositions(bitPositions, pipBitValues);
211 getCfgBitValues(pipBitValues, bitPositions);
214 PIPBitValues::iterator itBegin = pipBitValues.begin();
215 PIPBitValues::iterator itEnd = pipBitValues.end();
216 std::sort(itBegin, itEnd);
221 void Correlator::getCfgBitPositions(
BitPositions &bitPositions,
225 bitPositions.clear();
228 size_t pipCount = pipBitValues.size();
229 for (
size_t i = 0; i < pipCount; ++i)
232 size_t pipIndex = (pipBitValues[i]).pipIndex();
243 BitPositions::iterator itBegin = bitPositions.begin();
244 BitPositions::iterator itEnd = bitPositions.end();
245 BitPositions::iterator it = std::lower_bound(itBegin, itEnd, bitIndex);
247 if ((it == itEnd) || (*it != bitIndex))
248 bitPositions.insert(it, bitIndex);
256 void Correlator::getCfgBitValues(
PIPBitValues& pipBitValues,
261 size_t bitPositionCount = bitPositions.size();
265 size_t pipCount = pipBitValues.size();
266 for (
size_t i = 0; i < pipCount; ++i)
272 size_t pipIndex = pipBitValue.
pipIndex();
276 boost::uint32_t value = 0;
277 for (
size_t j = bitPositionCount; j-- > 0;)
280 size_t bitPosition = bitPositions[j];
281 if (pipState.
testCfgBit(bitPosition)) value |= 1;