22 #include <boost/algorithm/string.hpp>
90 namespace architecture {
102 cout <<
"sizeof(short) = " <<
sizeof(short) << endl;
103 cout <<
"sizeof(int) = " <<
sizeof(int) << endl;
104 cout <<
"sizeof(float) = " <<
sizeof(float) << endl;
105 cout <<
"sizeof(t_rr_node) = " <<
sizeof(
t_rr_node) << endl;
108 mMaxTileRow = min(mMaxTileRow, mDDB.getTiles().getRowCount());
109 mMaxTileCol = min(mMaxTileCol, mDDB.getTiles().getColCount());
111 ss << mDDB.getDeviceName() <<
"-[" << mMinTileRow <<
"," << mMinTileCol <<
"]-["
112 << mMaxTileRow <<
"," << mMaxTileCol <<
"].vpr";
114 /
"regression" / ss.str();
115 mStream.open(generatedPath.string().c_str(), std::ios::out | std::ios::binary);
118 typedef map<Tilewire, uint32_t> TilewireToIndex;
119 TilewireToIndex tilewireToIndex;
120 typedef map<Tilewire, bool> TilewireIsExcluded;
121 TilewireIsExcluded tilewireIsExcluded;
123 TileCount tileCount = mTiles.getTileCount();
125 for(
TileIndex tileIndex(0); tileIndex < tileCount; tileIndex++) {
127 const TileInfo& tileInfo = mTiles.getTileInfo(tileIndex);
131 WireCount wireCount = mTiles.getWireCount(tileTypeIndex);
132 for(
WireIndex wireIndex(0); wireIndex < wireCount; wireIndex++) {
134 Tilewire currentTilewire(tileIndex, wireIndex);
135 if(tilewireIsExcluded.find(currentTilewire) != tilewireIsExcluded.end())
continue;
138 mDDB.expandSegment(currentTilewire, tilewires);
140 if(tilewires.empty())
continue;
142 TilewireVector::iterator tp = tilewires.begin();
143 TilewireVector::iterator te = tilewires.end();
145 while(include && tp < te) {
147 if(ewi.
mTileRow < mMinTileRow) include =
false;
148 if(ewi.
mTileCol < mMinTileCol) include =
false;
149 if(ewi.
mTileRow > mMaxTileRow) include =
false;
150 if(ewi.
mTileCol > mMaxTileCol) include =
false;
153 tp = tilewires.begin();
154 while(tp < te) tilewireIsExcluded[*tp++] = !include;
155 if(!include)
continue;
157 if(tilewireToIndex.find(tilewires[0]) == tilewireToIndex.end())
158 tilewireToIndex[tilewires[0]] = size++;
161 cout <<
"Found " << tilewireToIndex.size() <<
" total segments compared to expected "
162 << mSegments.getTotalSegmentCount() << endl;
165 typedef vector<Node> NodeVector;
167 nodes.resize(tilewireToIndex.size());
169 TilewireToIndex::const_iterator p = tilewireToIndex.begin();
170 TilewireToIndex::const_iterator e = tilewireToIndex.end();
172 TilewireToIndex::value_type value = *p++;
173 uint32_t index = value.second;
175 nodes[index].mIndex = index;
176 nodes[index].mTilewire = tilewire;
181 ArcVector::const_iterator ap = arcVector.begin();
182 ArcVector::const_iterator ae = arcVector.end();
189 if(tilewireToIndex.find(tilewires[0]) == tilewireToIndex.end())
continue;
191 uint32_t sinkIndex = tilewireToIndex[tilewires[0]];
192 nodes[index].mEdges.push_back(sinkIndex);
197 mDDB.expandSegment(tilewire, tilewires);
198 TilewireVector::iterator tp = tilewires.begin();
199 TilewireVector::iterator te = tilewires.end();
202 nodes[index].mMinRow = min(nodes[index].mMinRow, ewi.
mTileRow);
203 nodes[index].mMinCol = min(nodes[index].mMinCol, ewi.
mTileCol);
204 nodes[index].mMaxRow = max(nodes[index].mMaxRow, ewi.
mTileRow);
205 nodes[index].mMaxCol = max(nodes[index].mMaxCol, ewi.
mTileCol);
206 nodes[index].mRowRange = nodes[index].mMaxRow - nodes[index].mMinRow;
207 nodes[index].mColRange = nodes[index].mMaxCol - nodes[index].mMinCol;
214 size_t nodeCount = tilewireToIndex.size();
215 size_t edgeCount = 0;
216 mStream.write(reinterpret_cast<char*>(&nodeCount),
sizeof(nodeCount));
218 NodeVector::iterator np = nodes.begin();
219 NodeVector::iterator ne = nodes.end();
223 if(debug) cout <<
"[" << node.
mMinRow <<
"," << node.
mMinCol <<
"]-["
227 Uint32Vector::const_iterator ep = node.
mEdges.begin();
228 Uint32Vector::const_iterator ee = node.
mEdges.end();
229 if(debug)
while(ep < ee) {
230 cout << *ep++ <<
" ";
232 if(debug) cout << endl;
257 vpr_rr_node.
edges = edgePtr;
263 vpr_rr_node.
R = vpr_rr_node.
C = 0;
275 vpr_rr_node.
tnode = 0;
280 mStream.write(reinterpret_cast<char*>(&vpr_rr_node),
sizeof(
t_rr_node));
284 mStream.write(reinterpret_cast<char*>(&edgeCount),
sizeof(edgeCount));
285 uint32_t delimiter = -1;
289 Uint32Vector::const_iterator ep = node.
mEdges.begin();
290 Uint32Vector::const_iterator ee = node.
mEdges.end();
292 uint32_t edge = *ep++;
293 mStream.write(reinterpret_cast<char*>(&edge),
sizeof(edge));
295 mStream.write(reinterpret_cast<char*>(&delimiter),
sizeof(delimiter));
const WireIndex & getWireIndex(void) const
Returns the wire index.
Encapsulation of a tile index in an unsigned 32-bit integer.
VPR node temporary class.
bool isOutput(void) const
Returns true if the wire is a logic output.
Encapsulation of an arc between two tilewires.
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
TileRow mTileRow
The tile row.
Header for the DirectoryTree class.
void operator()(void)
Exports routing graph information for VPR v6.0.
bool isInput(void) const
Returns true if the wire is a logic input.
enum e_direction direction
Encapsulation of a wire index in an unsigned 16-bit integer.
std::vector< Arc > ArcVector
Vector of Arc objects.
Header for the DDB class.
const Tilewire & getSinkTilewire(void) const
Returns the sink tilewire.
Header for torc::physical output stream helpers.
Encapsulation of a device tile and wire pair.
Encapsulation of a wire count in an unsigned 16-bit integer.
Encapsulation of a tile count in an unsigned 32-bit integer.
Encapsulation of a tile within a device tile map.
Verbose encapsulation of a wire's information.
boost::filesystem::path path
const TileTypeIndex & getTypeIndex(void) const
Returns the tile type index for this tile.
struct s_rr_node t_rr_node
t_pb_graph_pin * pb_graph_pin
Encapsulation of a tile type index in an unsigned 16-bit integer.
float pack_intrinsic_cost
WireFlags mWireFlags
The wire flags.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.
TileCol mTileCol
The tile column.