Index: branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h
===================================================================
--- branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h	(revision 886)
+++ branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h	(revision 931)
@@ -94,5 +94,7 @@
     DspinInput<flit_width>      *p_in;
     DspinOutput<flit_width>     *p_out;
-    sc_in<uint32_t>             *p_blackhole_pos;
+
+    // reconfiguration port
+    sc_in<uint32_t>             *p_recovery_cfg;
 
     // constructor / destructor
@@ -104,6 +106,5 @@
                  const size_t    in_fifo_depth,
                  const size_t    out_fifo_depth,
-                 const bool      broadcast_supported = false,
-                 const bool      reconfigurable = false );
+                 const bool      broadcast_supported = false );
 
     ~DspinRouter();
@@ -146,15 +147,20 @@
     void    genMoore();
     int     xfirst_route( size_t xdest, size_t ydest );
-    int     recovery_route( size_t xdest, size_t ydest );
     int     route( sc_uint<flit_width> data );
     int     broadcast_route( int iter, int source, sc_uint<flit_width> data );
     bool    is_broadcast( sc_uint<flit_width> data );
 
+    // fault-recovery methods
+    bool    need_reroute( size_t xdest, size_t ydest, int bhpos );
+    int     recovery_route( size_t xdest, size_t ydest );
+
     public:
 
-    void set_disable_mask( int mask )
+    inline void set_disable_mask( int mask )
     {
         m_disable_mask = mask;
     }
+
+    void bind_recovery_port( sc_core::sc_signal<uint32_t> &s );
 
     void print_trace();
Index: branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp
===================================================================
--- branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp	(revision 886)
+++ branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp	(revision 931)
@@ -60,6 +60,5 @@
                              const size_t   in_fifo_depth,
                              const size_t   out_fifo_depth,
-                             const bool     broadcast_supported,
-                             const bool     reconfigurable )
+                             const bool     broadcast_supported)
     : soclib::caba::BaseModule(name),
 
@@ -117,6 +116,5 @@
         }
 
-        if ( reconfigurable ) p_blackhole_pos = new sc_core::sc_in<uint32_t>;
-        else                  p_blackhole_pos = NULL;
+        p_recovery_cfg = NULL;
     } //  end constructor
 
@@ -124,5 +122,5 @@
     tmpl(/**/)::~DspinRouter()
     {
-        if ( p_blackhole_pos != NULL ) delete p_blackhole_pos;
+        if ( p_recovery_cfg != NULL ) delete p_recovery_cfg;
     }
 
@@ -137,7 +135,67 @@
 
     ///////////////////////////////////////////////////
+    tmpl(void)::bind_recovery_port( sc_core::sc_signal<uint32_t> &s )
+    {
+        if (p_recovery_cfg == NULL) {
+            p_recovery_cfg = new sc_core::sc_in<uint32_t>;
+        }
+        (*p_recovery_cfg)(s);
+    }
+
+    ///////////////////////////////////////////////////
+    tmpl(bool)::need_reroute( size_t xdest, size_t ydest, int bhpos )
+    {
+        size_t xhole, yhole;
+        if (bhpos == BH_N) {
+            xhole = m_local_x;
+            yhole = m_local_y - 1;
+        }
+        else if (bhpos == BH_NW) {
+            xhole = m_local_x + 1;
+            yhole = m_local_y - 1;
+        }
+        else if (bhpos == BH_W) {
+            xhole = m_local_x + 1;
+            yhole = m_local_y;
+        }
+        else if (bhpos == BH_SW) {
+            xhole = m_local_x + 1;
+            yhole = m_local_y + 1;
+        }
+        else if (bhpos == BH_S) {
+            xhole = m_local_x;
+            yhole = m_local_y + 1;
+        }
+        else if (bhpos == BH_SE) {
+            xhole = m_local_x - 1;
+            yhole = m_local_y + 1;
+        }
+        else if (bhpos == BH_E) {
+            xhole = m_local_x - 1;
+            yhole = m_local_y;
+        }
+        else if (bhpos == BH_NE) {
+            xhole = m_local_x - 1;
+            yhole = m_local_y - 1;
+        }
+        else {
+            return false;
+        }
+
+        return ((xdest == xhole) && (ydest == yhole));
+    }
+
+    ///////////////////////////////////////////////////
     tmpl(int)::recovery_route( size_t xdest, size_t ydest )
     {
-        int bhpos = p_blackhole_pos->read();
+        int bhpos = p_recovery_cfg->read() & 0xF;
+
+        // reroute the request if its destination is the blackhole (this is to
+        // implement the segment recovery mechanism)
+        if (need_reroute(xdest, ydest, bhpos)) {
+            int recovery_direction = (p_recovery_cfg->read() >> 4) & 0xF;
+            return recovery_direction;
+        }
+
         if ( xdest > m_local_x ) {
             if ( (bhpos == BH_NE) || (bhpos == BH_E) || (bhpos == BH_SE) ||
@@ -249,7 +307,7 @@
         size_t xdest = (size_t)(data >> m_x_shift) & m_x_mask;
         size_t ydest = (size_t)(data >> m_y_shift) & m_y_mask;
-        if ( p_blackhole_pos != NULL )
-        {
-            if ( p_blackhole_pos->read() != BH_NONE )
+        if ( p_recovery_cfg != NULL )
+        {
+            if ( (p_recovery_cfg->read() & 0xF) != BH_NONE )
             {
                 return recovery_route(xdest, ydest);
