16 #ifndef TORC_ROUTER_PATHFINDER_HPP
17 #define TORC_ROUTER_PATHFINDER_HPP
24 #include <boost/functional/hash.hpp>
34 #include <boost/timer.hpp>
35 #include <boost/unordered_map.hpp>
36 #include <boost/functional/hash.hpp>
37 #include <boost/cstdint.hpp>
99 bool flag_resources =
true;
101 unsigned int numNets = nets.size();
103 flag_resources =
true;
105 int routingPasses = 0;
110 double updatetime = 0;
112 for (
unsigned int i = 0; i < numNets; i++) {
117 std::cout <<
"BAD NET: " << net.
getName() << std::endl;
132 std::cout <<
"Failed routing net " << i <<
": " << std::endl;
139 std::cout <<
"Initial routes time: " <<
iterationtimer.elapsed() << std::endl;
141 for (
unsigned int i = 0; i < numNets; i++) {
142 for (
unsigned int j = 0; j < nets[i].routeNodes().size(); j++) {
148 while (flag_resources) {
150 std::cout <<
"." << std::flush;
152 double avgroutetime = 0;
153 double minroutetime = std::numeric_limits<double>::max();
154 double maxroutetime = std::numeric_limits<double>::min();
158 for (
unsigned int n = 0; n < numNets; n++) {
173 std::cout <<
"Failed routing net " << net.
getName() <<
" index: "
174 << n <<
" of " << nets.size() << std::endl;
180 if (routetime < minroutetime)
181 minroutetime = routetime;
182 if (routetime > maxroutetime)
183 maxroutetime = routetime;
184 avgroutetime += routetime;
188 avgroutetime = avgroutetime / netsRouted;
191 PathFinderSharingMap::iterator p;
192 unsigned int conflicts = 0;
193 unsigned int maxpresent = 0;
194 unsigned int maxhistory = 0;
199 if ((*p).second.mPresentSharing > 1)
201 (*p).second.mHistorySharing += (*p).second.mPresentSharing;
205 if ((*p).second.mPresentSharing > maxpresent)
207 maxpresent = (*p).second.mPresentSharing;
208 maxPresentTilewire = (*p).first;
210 if ((*p).second.mHistorySharing > maxhistory)
212 maxhistory = (*p).second.mHistorySharing;
213 maxHistoryTilewire = (*p).first;
228 if (netsRouted == 1) {
229 flag_resources =
false;
230 for (
unsigned int i = 0; i < numNets; i++) {
233 std::cout <<
"FOUND SELF CONFLICT NET: " << net.
getName() << std::endl;
235 for (
unsigned int j = 0; j < net.
routeNodes().size(); j++) {
236 std::cout <<
"\t" << net.
routeNodes()[j]->getArc() << std::endl;
245 if (conflicts == 0) flag_resources =
false;
248 std::cout << std::endl;
249 std::cout <<
"Total time: " <<
totaltimer.elapsed() <<
" Update time: " << updatetime
257 int rVecSize = routeVector.size();
258 for (
int x = 0; x < rVecSize; x++)
263 for (
int i = 0; i < numWireSources; i++)
275 std::cout <<
"ERROR PRESENT: " << tw <<
" net " << netname << std::endl;
284 delete routeVector[x];
290 for (
unsigned int i = 0; i < outRoute.size(); i++) {
298 for (
int i = 0; i < numWireSources; i++) {
318 std::vector<RouteNodePtrVector>& tempRoutes,
319 std::vector<unsigned int>& priorities,
unsigned int plevel) {
320 if (outRoutes.size() != tempRoutes.size()) {
321 std::cout <<
"BAD SIZE: " << outRoutes.size() <<
" " << tempRoutes.size() << std::endl;
324 for (
unsigned int i = 0; i < outRoutes.size(); i++) {
330 for (
unsigned int i = 0; i < tempRoute.size(); i++) {
331 outRoute.push_back(tempRoute[i]);
332 arc = tempRoute[i]->getArc();
338 for (
unsigned int i = 0; i < currentRoute.size(); i++) {
340 &&
mConflicts[currentRoute[i]->getSinkTilewire()].mPresentSharing > 1) {
368 #endif // TORC_ROUTER_PATHFINDER_HPP
TilewireVector::const_iterator TilewireConstIterator
TilewireConstIterator sinksEnd(void) const
Returns the end constant iterator for sink Tilewires.
Pathfinder annotations for Tilewires.
TilewireVector mTempWireSinks
Encapsulation of an arc between two tilewires.
void releaseSegment(const Tilewire &inTilewire)
Marks all wires on the segment as unused.
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
std::vector< RouteNode * > RouteNodePtrVector
Vector of RouteNode pointers.
TilewireVector mTempWireSources
Device database, including complete wiring and logic support.
std::vector< RouteNet > RouteNetVector
Vector of RouteNet objects.
TilewireVector::const_iterator TilewireConstIterator
const string & getName() const
Returns the name of the net.
bool testReroute(RouteNodePtrVector ¤tRoute)
NetRouterBase * mNetRouter
Pointer to the underlying net router.
Header for the NetVectorRouterHeuristicBase class.
Encapsulation the design wire usage.
Header for the RouteNode class.
void unmarkSourcesAndSinks(RouteNet &net)
TilewireConstIterator sinksBegin(void) const
Returns the begin constant iterator for sink Tilewires.
Header for the BasicRouter class.
Provides net routing based on the Nillson graphsearch algorithm.
void useArc(const Arc &inArc)
Marks the arc and all of its source and sink segment wires as used.
RouteNodePtrVector & routeNodes()
Returns a reference to the RouteNodePtrVector.
void clear(void)
Marks all wires as being unused, without releasing the bitset objects.
WireUsage mConflictWireUsage
void recordResult(RouteNodePtrVector &outRoute, RouteNodePtrVector &tempRoute)
Header for the NetVectorRouterBase class.
void setParameter(boost::uint32_t index, boost::any inParameter)
Set a parameter.
Encapsulation of a device tile and wire pair.
NetRouterHeuristicBase * getHeuristic()
Get the current heuristic.
boost::timer iterationtimer
void updateSharing(RouteNodePtrVector &outRoute)
void use(const Tilewire &inTilewire)
Marks the specified tilewire as being used.
boost::uint32_t mHistorySharing
TilewireConstIterator sourcesBegin(void) const
Returns the begin constant iterator for source Tilewires.
void recordResult(std::vector< RouteNodePtrVector > &outRoutes, std::vector< RouteNodePtrVector > &tempRoutes, std::vector< unsigned int > &priorities, unsigned int plevel)
virtual void processParameters()
Do something with the parameters.
Header for the Tilewire class.
void useSegment(const Tilewire &inTilewire)
Marks all wires on the segment as used.
boost::uint32_t mPresentSharing
PathFinderSharingMap mConflicts
void routeNets(RouteNetVector &nets)
bool hasOneSource(void) const
Returns true if the net has exactly one source.
architecture::TilewireVector TilewireVector
architecture::Tilewire Tilewire
void release(const Tilewire &inTilewire)
Marks the specified tilewire as being unused.
Abstract class for a net router.
Abstract class for a net router.
Header for the DDB class.
void route(RouteNet &inNet)
Primary route call.
PathFinder(DDB &inDB, NetVectorRouterHeuristicBase *inHeuristic, NetRouterBase *inNetRouter)
Pathfinder constructor.
void unrouteNet(RouteNodePtrVector &routeVector, const string &netname)
boost::unordered_map< Tilewire, TilewireData > PathFinderSharingMap
architecture::WireUsage WireUsage
DDB & mDB
Database reference.
bool isUsed(const Tilewire &inTilewire)
Determines whether the specified tilewire is in use.
void markSourcesAndSinks(RouteNet &net)
bool hasAnySinks(void) const
Returns true if the net has any sinks.
void autosize(void)
Size the wire usage according to the number of device tiles.
void expandSegment(const Tilewire &inTilewire, TilewireVector &outTilewires, EExpandDirection inExpandDirection=eExpandDirectionNone)
Expands the given tilewire's segment.
Header for the Net class.
void updateSharing(const Tilewire &inTilewire)