Index: /branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h	(revision 946)
+++ /branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h	(revision 947)
@@ -141,5 +141,5 @@
 
     // fault-recovery methods
-    bool    need_reroute( size_t xdest, size_t ydest, int bhpos );
+    bool    is_destination_blackhole( size_t xdest, size_t ydest, int bhpos );
     int     recovery_route( size_t xdest, size_t ydest );
 
@@ -149,4 +149,19 @@
     {
         m_disable_mask = mask;
+    }
+
+    inline bool is_network_recovery_enable()
+    {
+        return (((p_recovery_cfg->read() >> 7) & 0x1) != 0);
+    }
+
+    inline int migration_route()
+    {
+        return ((p_recovery_cfg->read() >> 4) & 0x7);
+    }
+
+    inline int blackhole_position()
+    {
+        return (p_recovery_cfg->read() & 0xF);
     }
 
Index: /branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp	(revision 946)
+++ /branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp	(revision 947)
@@ -138,5 +138,5 @@
     {
         if (p_recovery_cfg == NULL) {
-            p_recovery_cfg = new sc_core::sc_in<uint32_t>;
+            p_recovery_cfg = new sc_core::sc_in<uint32_t> ("p_recovery_cfg");
         }
         (*p_recovery_cfg)(s);
@@ -144,5 +144,5 @@
 
     ///////////////////////////////////////////////////
-    tmpl(bool)::need_reroute( size_t xdest, size_t ydest, int bhpos )
+    tmpl(bool)::is_destination_blackhole( size_t xdest, size_t ydest, int bhpos )
     {
         size_t xhole, yhole;
@@ -189,18 +189,5 @@
     tmpl(int)::recovery_route( size_t xdest, size_t ydest )
     {
-        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;
-
-#if SOCLIB_MODULE_DEBUG
-        std::cout << "<" << name() << "> reroute request to DIR = "
-                  << recovery_direction << std::endl;
-#endif
-
-            return recovery_direction;
-        }
+        int bhpos = blackhole_position();
 
         if ( xdest > m_local_x ) {
@@ -315,7 +302,29 @@
         if ( p_recovery_cfg != NULL )
         {
-            if ( (p_recovery_cfg->read() & 0xF) != BH_NONE )
-            {
-                return recovery_route(xdest, ydest);
+            if (blackhole_position() != BH_NONE )
+            {
+                // reroute the request if its destination is the blackhole (this
+                // is to implement the segment recovery mechanism)
+                if (is_destination_blackhole(xdest, ydest, blackhole_position()))
+                {
+                    int dir = migration_route();
+
+#if SOCLIB_MODULE_DEBUG
+                    std::cout << "<" << name() << "> migration: "
+                              << "route request to DIR = " << dir << std::endl;
+#endif
+                    return dir;
+                }
+
+                if (is_network_recovery_enable())
+                {
+                    int dir = recovery_route(xdest, ydest);
+
+#if SOCLIB_MODULE_DEBUG
+                    std::cout << "<" << name() << "> network recovery: "
+                              << "route request to DIR = " << dir << std::endl;
+#endif
+                    return dir;
+                }
             }
         }
Index: /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/main.c
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/main.c	(revision 946)
+++ /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/main.c	(revision 947)
@@ -25,44 +25,45 @@
     /* configure the routers around the blackhole (1, 1) to define a cycle-free
      * contour */
+    const int PATH_RECOVERY = 1;
     uint32_t val;
 
     printf("router(0, 2): configuring as NW\n");
     assert(xcu_get_register(0, 2, XICU_CFG_REG, 0) == BH_NONE);
-    val = (REQ_SOUTH << 4) | BH_NW;
+    val = (PATH_RECOVERY << 7) | (REQ_SOUTH << 4) | BH_NW;
     xcu_set_register(0, 2, XICU_CFG_REG, 0, val);     /* configure NW */
 
     printf("router(0, 1): configuring as W\n");
     assert(xcu_get_register(0, 1, XICU_CFG_REG, 0) == BH_NONE);
-    val = (REQ_LOCAL << 4) | BH_W;
+    val = (PATH_RECOVERY << 7) | (REQ_LOCAL << 4) | BH_W;
     xcu_set_register(0, 1, XICU_CFG_REG, 0, val);     /* configure W */
 
     printf("router(0, 0): configuring as SW\n");
     assert(xcu_get_register(0, 0, XICU_CFG_REG, 0) == BH_NONE);
-    val = (REQ_NORTH << 4) | BH_SW;
+    val = (PATH_RECOVERY << 7) | (REQ_NORTH << 4) | BH_SW;
     xcu_set_register(0, 0, XICU_CFG_REG, 0, val);     /* configure SW */
 
     printf("router(1, 2): configuring as N\n");
     assert(xcu_get_register(1, 2, XICU_CFG_REG, 0) == BH_NONE);
-    val = (REQ_WEST << 4) | BH_N;
+    val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_N;
     xcu_set_register(1, 2, XICU_CFG_REG, 0, val);     /* configure N */
 
     printf("router(2, 2): configuring as NE\n");
     assert(xcu_get_register(2, 2, XICU_CFG_REG, 0) == BH_NONE);
-    val = (REQ_WEST << 4) | BH_NE;
+    val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_NE;
     xcu_set_register(2, 2, XICU_CFG_REG, 0, val);     /* configure NE */
 
     printf("router(2, 1): configuring as E\n");
     assert(xcu_get_register(2, 1, XICU_CFG_REG, 0) == BH_NONE);
-    val = (REQ_SOUTH << 4) | BH_E;
+    val = (PATH_RECOVERY << 7) | (REQ_SOUTH << 4) | BH_E;
     xcu_set_register(2, 1, XICU_CFG_REG, 0, val);     /* configure E */
 
     printf("router(2, 0): configuring as SE\n");
     assert(xcu_get_register(2, 0, XICU_CFG_REG, 0) == BH_NONE);
-    val = (REQ_WEST << 4) | BH_SE;
+    val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_SE;
     xcu_set_register(2, 0, XICU_CFG_REG, 0, val);     /* configure SE */
 
     printf("router(1, 0): configuring as S\n");
     assert(xcu_get_register(1, 0, XICU_CFG_REG, 0) == BH_NONE);
-    val = (REQ_WEST << 4) | BH_S;
+    val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_S;
     xcu_set_register(1, 0, XICU_CFG_REG, 0, val);     /* configure S */
 
