Index: /branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h	(revision 933)
+++ /branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h	(revision 934)
@@ -57,15 +57,4 @@
 : public soclib::caba::BaseModule
 {
-    // Port indexing
-    enum
-    {
-        REQ_NORTH   = 0,
-        REQ_SOUTH   = 1,
-        REQ_EAST    = 2,
-        REQ_WEST    = 3,
-        REQ_LOCAL   = 4,
-        REQ_NOP     = 5,
-    };
-
     // Input Port FSM
     enum
Index: /branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp	(revision 933)
+++ /branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp	(revision 934)
@@ -195,4 +195,10 @@
         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;
         }
Index: /branches/reconfiguration/modules/dspin_router/caba/test/simple_recovery_routing_test/test.sh
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/test/simple_recovery_routing_test/test.sh	(revision 933)
+++ /branches/reconfiguration/modules/dspin_router/caba/test/simple_recovery_routing_test/test.sh	(revision 934)
@@ -9,9 +9,9 @@
 export SOCLIB_TTY=FILES
 export SOCLIB_FB=HEADLESS
-export SOCLIB_GDB=
+#export SOCLIB_GDB=
 export DISTRIBUTED_BOOT=1
 PLATFORM=../../../../../platforms/tsar_generic_iob
 SIMULATOR=$PLATFORM/simul.x
-$SIMULATOR -SOFT $SOFT -DISK /dev/null -FAULTY_ROUTER 0x11 2> /dev/null >> output/log
+$SIMULATOR -DSOFT $SOFT -DISK /dev/null -FAULTY_ROUTER 0 1 1 2> /dev/null >> output/log
 soclib-cleanup-terms &> /dev/null
 mv term0 output/term
Index: /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/Makefile
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/Makefile	(revision 934)
+++ /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/Makefile	(revision 934)
@@ -0,0 +1,85 @@
+# =============================================================================
+# \file      Makefile
+# \author    Cesar Fuguet
+# \date      July 9, 2014
+# =============================================================================
+include ../common.mk
+
+# =============================================================================
+# Include files paths
+# =============================================================================
+
+CONFDIR ?= output
+CONF    := $(addprefix $(CONFDIR)/config/, hard_config.h)
+
+INCLUDE += -I$(CONFDIR)/config
+
+# =============================================================================
+# Utils library
+# =============================================================================
+
+LIB_SRCS   := stdio.c \
+              string.c \
+              tty.c \
+              simhelper.c \
+			  xcu.c
+
+LIB_OBJS   := $(addprefix $(BUILD_DIR)/,\
+                  $(subst .c,.o, $(notdir $(LIB_SRCS))))
+
+LIB_TARGET := $(BUILD_DIR)/libutils.a
+
+# =============================================================================
+# Object files
+# =============================================================================
+
+S_SRCS := reset.S
+C_SRCS := main.c
+
+OBJS   := $(addprefix $(BUILD_DIR)/,\
+              $(subst .c,.o, $(notdir $(C_SRCS))) \
+              $(subst .S,.o, $(notdir $(S_SRCS))))
+
+TARGET := $(BUILD_DIR)/soft.elf
+
+# =============================================================================
+# Test variables
+# =============================================================================
+PLATFORM  := ../../../../../platforms/tsar_generic_iob
+SIMULATOR := $(PLATFORM)/simul.x
+
+# =============================================================================
+# Makefile rules
+# =============================================================================
+
+all: $(TARGET)
+
+# Specific dependencies
+# NOTE: normal prerequisites | order-only prerequisites
+# SEE: http://www.gnu.org/software/make/manual/make.html#Prerequisite-Types
+
+$(LIB_OBJS): $(CONF) | $(BUILD_DIR)
+$(OBJS): $(CONF) | $(BUILD_DIR)
+
+$(LIB_TARGET): $(LIB_OBJS)
+	$(AR) rcs $@ $(LIB_OBJS)
+
+$(TARGET): $(OBJS) ../soft.ld $(LIB_TARGET)
+	$(LD) -o $@ -T ../soft.ld $(OBJS) -L$(BUILD_DIR) -lutils
+	$(DU) -D $@ > $@.txt
+
+mkconfig $(SIMULATOR) $(CONF): $(PLATFORM)/scripts/onerun.py
+	./$< -o $(CONFDIR) -p $(PLATFORM) -x3 -y3 -n1 -c
+
+$(BUILD_DIR):
+	$(MKDIR) $@
+
+clean:
+	$(RM) $(BUILD_DIR)
+
+clean-log:
+	$(RM) $(CONFDIR)
+
+.PHONY: $(SIMULATOR) mkconfig
+
+distclean: clean clean-log
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 934)
+++ /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/main.c	(revision 934)
@@ -0,0 +1,77 @@
+#include "stdio.h"
+#include "cpu.h"
+#include "hard_config.h"
+#include "io.h"
+#include "simhelper.h"
+#include "cpu_registers.h"
+#include "xcu.h"
+#include "soclib/dspin_router_config.h"
+#include "assert.h"
+
+void exception_handler()
+{
+    printf("exception_handler(): failure / pid %d\n", cpu_procid());
+    simh_stop_simulation();
+}
+
+void main(void)
+{
+    printf("main(): pid %d\n", cpu_procid());
+
+    /* set the watchdog timer threshold to detect an error during the
+     * reconfiguration of the NoC */
+    cpu_set_wdt_max(5000);
+
+    /* configure the routers around the blackhole (1, 1) to define a cycle-free
+     * contour */
+    printf("router(0, 2): configuring as NW\n");
+    assert(xcu_get_config(0, 2, 0) == BH_NONE);
+    xcu_set_config(0, 2, 0, (REQ_SOUTH << 4) | BH_NW);     /* configure NW */
+
+    printf("router(0, 1): configuring as W\n");
+    assert(xcu_get_config(0, 1, 0) == BH_NONE);
+    xcu_set_config(0, 1, 0, (REQ_LOCAL << 4) | BH_W);      /* configure W */
+
+    printf("router(0, 0): configuring as SW\n");
+    assert(xcu_get_config(0, 0, 0) == BH_NONE);
+    xcu_set_config(0, 0, 0, (REQ_NORTH << 4) | BH_SW);     /* configure SW */
+
+    printf("router(1, 2): configuring as N\n");
+    assert(xcu_get_config(1, 2, 0) == BH_NONE);
+    xcu_set_config(1, 2, 0, (REQ_WEST << 4) | BH_N);       /* configure N */
+
+    printf("router(2, 2): configuring as NE\n");
+    assert(xcu_get_config(2, 2, 0) == BH_NONE);
+    xcu_set_config(2, 2, 0, (REQ_WEST << 4) | BH_NE);      /* configure NE */
+
+    printf("router(2, 1): configuring as E\n");
+    assert(xcu_get_config(2, 1, 0) == BH_NONE);
+    xcu_set_config(2, 1, 0, (REQ_SOUTH << 4) | BH_E);      /* configure E */
+
+    printf("router(2, 0): configuring as SE\n");
+    assert(xcu_get_config(2, 0, 0) == BH_NONE);
+    xcu_set_config(2, 0, 0, (REQ_WEST << 4) | BH_SE);      /* configure SE */
+
+    printf("router(1, 0): configuring as S\n");
+    assert(xcu_get_config(1, 0, 0) == BH_NONE);
+    xcu_set_config(1, 0, 0, (REQ_WEST << 4) | BH_S);       /* configure S */
+
+    assert((xcu_get_config(0, 2, 0) & 0xF) == BH_NW);
+    assert((xcu_get_config(0, 1, 0) & 0xF) == BH_W);
+    assert((xcu_get_config(0, 0, 0) & 0xF) == BH_SW);
+    assert((xcu_get_config(1, 2, 0) & 0xF) == BH_N);
+    assert((xcu_get_config(2, 2, 0) & 0xF) == BH_NE);
+    assert((xcu_get_config(2, 1, 0) & 0xF) == BH_E);
+    assert((xcu_get_config(2, 0, 0) & 0xF) == BH_SE);
+    assert((xcu_get_config(1, 0, 0) & 0xF) == BH_S);
+
+    /* Test the recovered segment that has been migrated to the EAST cluster */
+    ioread32(CLUSTER_BASE(1, 1) | SEG_RAM_BASE);
+
+    printf("main(): success\n");
+    simh_stop_simulation();
+}
+
+/*
+ * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
+ */
Index: /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/reset.S
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/reset.S	(revision 934)
+++ /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/reset.S	(revision 934)
@@ -0,0 +1,81 @@
+/**
+ * File   : reset.S
+ * Author : Cesar FUGUET <cesar.fuguet-tortolero@lip6.fr>
+ * Date   : 16 October 2014
+ */
+
+#include "hard_config.h"
+#include "cpu_registers.h"
+
+    .section .reset,"ax",@progbits
+
+    .extern seg_stack_base
+    .extern seg_kcode_base
+    .extern main
+
+    .globl  reset
+    .ent    reset
+    .align  2
+
+#define P_MASK ((1<<P_WIDTH)-1)
+#define Y_MASK ((1<<Y_WIDTH)-1)
+
+reset:
+    .set noreorder
+
+    /*
+     * SR register initialization
+     * - Disable interrupts
+     * - Keep the Bootstrap Exception Vector (BEV) bit set
+     */
+    li     k0,  0x00400000
+    mtc0   k0,  CP0_STATUS
+
+    /*
+     * All processors compute:
+     *   cid = (x * Y_SIZE) + y
+     *   pid = (cid * NB_PROCS_MAX) + lpid
+     */
+    mfc0   k0,  CP0_PROCID
+    andi   k0,  k0,  0xFFF             /* k0 <= proc_xyl                 */
+
+    /* Only the processor 0 continues the execution                      */
+    beqz   k0,  1f
+    nop
+    wait
+
+1:  /* processor 0 initializes stack pointer (16K) */
+    la     sp,  _stack
+    addiu  sp,  sp,  (1<<14)           /* sp <= _stack + 16K             */
+
+    /* jumps to main in kernel mode */
+    jal    main
+    nop
+
+    j      exit
+    nop
+
+    .set reorder
+    .end reset
+
+
+
+.org 0x380
+
+reset_exception_handler:
+    mtc2   $0,  MMU_DATA_PADDR_EXT
+    j exception_handler
+
+
+
+    .section .data
+
+/*
+ * Stack segment definition
+ */
+_stack:
+    .space (1<<14)                     /* 16 Kbytes                      */
+
+/*
+ * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
+ */
Index: /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/test.sh
===================================================================
--- /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/test.sh	(revision 934)
+++ /branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/test.sh	(revision 934)
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+make mkconfig
+
+SOFT=build/soft.elf
+make $SOFT
+
+# batch mode => no xterm or frame buffer windows
+export SOCLIB_TTY=FILES
+export SOCLIB_FB=HEADLESS
+#export SOCLIB_GDB=
+export DISTRIBUTED_BOOT=1
+PLATFORM=../../../../../platforms/tsar_generic_iob
+SIMULATOR=$PLATFORM/simul.x
+$SIMULATOR -DSOFT $SOFT -DISK /dev/null -FAULTY_ROUTER 0 1 1 2> /dev/null >> output/log
+soclib-cleanup-terms &> /dev/null
+mv term0 output/term
+grep -q "success" output/term
+if [ $? == 0 ];
+	then echo $(basename $PWD) ": Success";
+	else echo $(basename $PWD) ": Failure";
+fi;
Index: /branches/reconfiguration/modules/dspin_router/include/soclib/dspin_router_config.h
===================================================================
--- /branches/reconfiguration/modules/dspin_router/include/soclib/dspin_router_config.h	(revision 933)
+++ /branches/reconfiguration/modules/dspin_router/include/soclib/dspin_router_config.h	(revision 934)
@@ -27,4 +27,15 @@
 #define DSPIN_ROUTER_CONFIG_H
 
+// Port indexing
+enum
+{
+    REQ_NORTH   = 0,
+    REQ_SOUTH   = 1,
+    REQ_EAST    = 2,
+    REQ_WEST    = 3,
+    REQ_LOCAL   = 4,
+    REQ_NOP     = 5,
+};
+
 // Black-Hole position
 enum
