diff --git a/kite/src/GraphicKiteEngine.cpp b/kite/src/GraphicKiteEngine.cpp
index 3c788fa3..0055d841 100644
--- a/kite/src/GraphicKiteEngine.cpp
+++ b/kite/src/GraphicKiteEngine.cpp
@@ -151,6 +151,15 @@ namespace Kite {
}
+ void GraphicKiteEngine::_wipeoutRouting ()
+ {
+ if (getCell()) {
+ KiteEngine::wipeoutRouting( getCell() );
+ _viewer->getCellWidget()->refresh();
+ }
+ }
+
+
void GraphicKiteEngine::_loadGlobalSolution ()
{
KiteEngine* kite = getForFramework( CreateEngine );
@@ -282,6 +291,11 @@ namespace Kite {
);
_viewer->addToMenu( "placeAndRoute.stepByStep.========" );
+ _viewer->addToMenu( "placeAndRoute.stepByStep.wipeoutRouting"
+ , "Kite - Erase Previous Routing"
+ , "Erase any previously routed wires"
+ , std::bind(&GraphicKiteEngine::_wipeoutRouting,this)
+ );
_viewer->addToMenu( "placeAndRoute.stepByStep.detailedPreRoute"
, "Kite - Detailed Pre-Route"
, "Run the Kite detailed router on pre-routed nets"
diff --git a/kite/src/KiteEngine.cpp b/kite/src/KiteEngine.cpp
index 42aed0f5..3cd1b1a8 100644
--- a/kite/src/KiteEngine.cpp
+++ b/kite/src/KiteEngine.cpp
@@ -65,6 +65,7 @@ namespace Kite {
using std::vector;
using std::make_pair;
using Hurricane::dbo_ptr;
+ using Hurricane::UpdateSession;
using Hurricane::DebugSession;
using Hurricane::tab;
using Hurricane::inltrace;
@@ -78,6 +79,9 @@ namespace Kite {
using Hurricane::Box;
using Hurricane::Torus;
using Hurricane::Layer;
+ using Hurricane::Horizontal;
+ using Hurricane::Vertical;
+ using Hurricane::NetRoutingExtension;
using Hurricane::Cell;
using CRL::System;
using CRL::addMeasure;
@@ -212,38 +216,38 @@ namespace Kite {
void KiteEngine::wipeoutRouting ( Cell * cell )
{
- if(KiteEngine::get(cell) != NULL or KatabaticEngine::get(cell) != NULL)
- throw Error("Trying to wipe out a routing with a routing engine\n");
- using namespace Hurricane;
+ if ( (KiteEngine::get(cell) != NULL) or (KatabaticEngine::get(cell) != NULL) )
+ throw Error( "KiteEngine::wipeoutRouting(): KiteEngine still active on %s"
+ , getString(cell->getName()).c_str() );
+
UpdateSession::open();
- for(Net* net : cell->getNets()){
- if(NetRoutingExtension::isManualGlobalRoute(net))
- continue;
- // First pass: destroy the contacts
- std::vector contactPointers;
- for(Component* com : net->getComponents()){
- Contact * contact = dynamic_cast(com);
- if(contact){
- contactPointers.push_back(contact);
- }
+
+ for ( Net* net : cell->getNets() ) {
+ if (NetRoutingExtension::isManualGlobalRoute(net)) continue;
+
+ // First pass: destroy the contacts
+ std::vector contacts;
+ for ( Component* component : net->getComponents() ) {
+ Contact* contact = dynamic_cast(component);
+ if (contact and not contact->getAnchorHook()->isAttached())
+ contacts.push_back( contact );
}
- for(Contact* contact : contactPointers)
+ for ( Contact* contact : contacts )
contact->destroy();
- // Second pass: destroy unconnected segments added by Knik as blockages
- std::vector compPointers;
- for(Component* com : net->getComponents()){
- Horizontal * h = dynamic_cast(com);
- if(h){
- compPointers.push_back(h);
- }
- Vertical * v = dynamic_cast(com);
- if(v){
- compPointers.push_back(v);
- }
+
+ // Second pass: destroy unconnected segments added by Knik as blockages
+ std::vector segments;
+ for ( Component* component : net->getComponents() ) {
+ Horizontal* horizontal = dynamic_cast(component);
+ if (horizontal) segments.push_back( horizontal );
+
+ Vertical* vertical = dynamic_cast(component);
+ if (vertical) segments.push_back( vertical );
}
- for(Component* comp : compPointers)
- comp->destroy();
+ for ( Component* segment : segments )
+ segment->destroy();
}
+
UpdateSession::close();
}
diff --git a/kite/src/PyKiteEngine.cpp b/kite/src/PyKiteEngine.cpp
index a3986d9d..7ffa27fc 100644
--- a/kite/src/PyKiteEngine.cpp
+++ b/kite/src/PyKiteEngine.cpp
@@ -82,6 +82,23 @@ extern "C" {
// +=================================================================+
+ static PyObject* PyKiteEngine_wipeoutRouting ( PyObject*, PyObject* args )
+ {
+ trace << "PyKiteEngine_wipeoutRouting()" << endl;
+
+ HTRY
+ PyObject* arg0;
+ if (not ParseOneArg("Kite.wipeoutRouting", args, CELL_ARG, &arg0)) {
+ PyErr_SetString( ConstructorError, "Bad parameters given to Kite.wipeoutRouting()." );
+ return NULL;
+ }
+ KiteEngine::wipeoutRouting( PYCELL_O(arg0) );
+ HCATCH
+
+ Py_RETURN_NONE;
+ }
+
+
static PyObject* PyKiteEngine_get ( PyObject*, PyObject* args )
{
trace << "PyKiteEngine_get()" << endl;
@@ -303,7 +320,9 @@ extern "C" {
PyMethodDef PyKiteEngine_Methods[] =
- { { "get" , (PyCFunction)PyKiteEngine_get , METH_VARARGS|METH_STATIC
+ { { "wipeoutRouting" , (PyCFunction)PyKiteEngine_wipeoutRouting , METH_VARARGS|METH_STATIC
+ , "Remove any previous routing." }
+ , { "get" , (PyCFunction)PyKiteEngine_get , METH_VARARGS|METH_STATIC
, "Returns the Kite engine attached to the Cell, None if there isnt't." }
, { "create" , (PyCFunction)PyKiteEngine_create , METH_VARARGS|METH_STATIC
, "Create a Kite engine on this cell." }
diff --git a/kite/src/kite/GraphicKiteEngine.h b/kite/src/kite/GraphicKiteEngine.h
index 21a30fc4..b74fb805 100644
--- a/kite/src/kite/GraphicKiteEngine.h
+++ b/kite/src/kite/GraphicKiteEngine.h
@@ -84,6 +84,7 @@ namespace Kite {
protected:
GraphicKiteEngine ();
virtual ~GraphicKiteEngine ();
+ void _wipeoutRouting ();
void _route ();
void _loadGlobalSolution ();
void _saveGlobalSolution ();