Index: branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h
===================================================================
--- branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h	(revision 1010)
+++ branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h	(revision 1016)
@@ -29,6 +29,5 @@
     ///////////////////////////////////////////////////////////////////////////
     // Implementation Note :
-    // The xfirst_route(), broadcast_route() and is_broadcast() functions
-    // defined below are used to decode the DSPIN first flit format:
+    // DSPIN first flit format:
     // - In case of a non-broadcast packet :
     //  |   X     |   Y     |---------------------------------------|BC |
@@ -36,6 +35,6 @@
     //
     //  - In case of a broacast
-    //  |  XMIN   |  XMAX   |  YMIN   |  YMAX   |-------------------|BC |
-    //  |   5     |   5     |   5     |   5     | flit_width - 22   | 1 |
+    //  |  XMIN   |  XMAX   |  YMIN   |  YMAX   |----------------|SP|BC |
+    //  |   5     |   5     |   5     |   5     | flit_width - 21| 1| 1 |
     ///////////////////////////////////////////////////////////////////////////
 
@@ -147,29 +146,17 @@
     void    genMoore();
 
-    int     xfirst_route( size_t xdest, size_t ydest );
+    int     route( sc_uint<flit_width> data );
     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 );
+    int     reallocation_route();
 
-    int     broadcast_route( int iter, int source, sc_uint<flit_width> data );
     bool    is_broadcast( sc_uint<flit_width> data );
-    sc_uint<flit_width> compute_broadcast_header( int source );
+    internal_flit_t compute_broadcast_header( int source );
 
-    bool    is_destination_blackhole( size_t xdest, size_t ydest, int bhpos );
+    bool    is_reconfigurable();
+    bool    is_recovery_routing_enabled();
+    bool    is_reallocation_enabled();
+    bool    is_destination_blackhole( size_t xdest, size_t ydest );
     int     blackhole_position();
-
-    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 bool is_reconfigurable()
-    {
-        return (p_recovery_cfg != NULL);
-    }
 
     public:
Index: branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp
===================================================================
--- branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp	(revision 1010)
+++ branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp	(revision 1016)
@@ -26,20 +26,8 @@
   *
   */
-
-    ///////////////////////////////////////////////////////////////////////////
-    // Implementation Note :
-    // The xfirst_route(), broadcast_route() and is_broadcast() functions
-    // defined below are used to decode the DSPIN first flit format:
-    // - In case of a non-broadcast packet :
-    //  |   X     |   Y     |---------------------------------------|BC |
-    //  | x_width | y_width |  flit_width - (x_width + y_width + 2) | 0 |
-    //
-    //  - In case of a broacast
-    //  |  XMIN   |  XMAX   |  YMIN   |  YMAX   |----------------|SP|BC |
-    //  |   5     |   5     |   5     |   5     | flit_width - 21| 1| 1 |
-    ///////////////////////////////////////////////////////////////////////////
-
 #include "../include/dspin_router.h"
 #include "dspin_router_config.h"
+
+#include <cassert>
 
 namespace soclib { namespace caba {
@@ -132,8 +120,6 @@
     tmpl(int)::blackhole_position()
     {
-        if ( is_reconfigurable() ) {
-            return p_recovery_cfg->read() & 0xF;
-        }
-        return BH_NONE;
+        assert( is_reconfigurable() );
+        return p_recovery_cfg->read() & 0xF;
     }
 
@@ -141,5 +127,5 @@
     tmpl(void)::bind_recovery_port(sc_signal<uint32_t> &s)
     {
-        if (!is_reconfigurable()) {
+        if ( not is_reconfigurable() ) {
             std::cerr << "Error in " << name()
                       << ": router configuration not supported." << std::endl
@@ -150,100 +136,114 @@
     }
 
+    tmpl(bool)::is_recovery_routing_enabled()
+    {
+        assert( is_reconfigurable() );
+        return (((p_recovery_cfg->read() >> 4) & 0x1) != 0);
+    }
+
+    tmpl(bool)::is_reallocation_enabled()
+    {
+        assert( is_reconfigurable() );
+        return (blackhole_position() != NORMAL);
+    }
+
+    tmpl(int)::reallocation_route()
+    {
+        assert( is_reconfigurable() );
+        return ((p_recovery_cfg->read() >> 5) & 0x7);
+    }
+
+    tmpl(bool)::is_reconfigurable()
+    {
+        return (p_recovery_cfg != NULL);
+    }
+
     ///////////////////////////////////////////////////
-    tmpl(int)::xfirst_route( size_t xdest, size_t ydest )
-    {
-        return (xdest < m_local_x ? REQ_WEST :
-               (xdest > m_local_x ? REQ_EAST :
-               (ydest < m_local_y ? REQ_SOUTH :
-               (ydest > m_local_y ? REQ_NORTH : REQ_LOCAL))));
+    tmpl(bool)::is_destination_blackhole( size_t xdest, size_t ydest )
+    {
+        assert ( is_reconfigurable() );
+
+        const int bhpos = blackhole_position();
+
+        const bool is_n = (bhpos == N_OF_X);
+        const bool is_s = (bhpos == S_OF_X);
+        const bool is_w = (bhpos == W_OF_X);
+        const bool is_e = (bhpos == E_OF_X);
+        const bool is_nw = (bhpos == NW_OF_X);
+        const bool is_ne = (bhpos == NE_OF_X);
+        const bool is_sw = (bhpos == SW_OF_X);
+        const bool is_se = (bhpos == SE_OF_X);
+
+        if ( bhpos == NORMAL ) return false;
+
+        size_t xhole;
+        if      (is_nw || is_w  || is_sw) xhole = m_local_x + 1;
+        else if (is_ne || is_se || is_e ) xhole = m_local_x - 1;
+        else                              xhole = m_local_x;
+
+        size_t yhole;
+        if      (is_sw || is_s  || is_se) yhole = m_local_y + 1;
+        else if (is_nw || is_n  || is_ne) yhole = m_local_y - 1;
+        else                              yhole = m_local_y;
+
+        return ((xdest == xhole) && (ydest == yhole));
     }
 
     ///////////////////////////////////////////////////
-    tmpl(bool)::is_destination_blackhole( size_t xdest, size_t ydest, int bhpos )
-    {
-        size_t xhole, yhole;
-        switch (bhpos) {
-            case BH_N:
-                xhole = m_local_x;
-                yhole = m_local_y - 1;
-                break;
-            case BH_NW:
-                xhole = m_local_x + 1;
-                yhole = m_local_y - 1;
-                break;
-            case BH_W:
-                xhole = m_local_x + 1;
-                yhole = m_local_y;
-                break;
-            case BH_SW:
-                xhole = m_local_x + 1;
-                yhole = m_local_y + 1;
-                break;
-            case BH_S:
-                xhole = m_local_x;
-                yhole = m_local_y + 1;
-                break;
-            case BH_SE:
-                xhole = m_local_x - 1;
-                yhole = m_local_y + 1;
-                break;
-            case BH_E:
-                xhole = m_local_x - 1;
-                yhole = m_local_y;
-                break;
-            case BH_NE:
-                xhole = m_local_x - 1;
-                yhole = m_local_y - 1;
-                break;
-            default:
-                return false;
-        }
-
-        return ((xdest == xhole) && (ydest == yhole));
-    }
-
-    ///////////////////////////////////////////////////
-    tmpl(int)::recovery_route( size_t xdest, size_t ydest )
-    {
-        int bhpos = blackhole_position();
-
-        if ( xdest > m_local_x ) {
-            if ( (bhpos == BH_NE) || (bhpos == BH_E) || (bhpos == BH_SE) ||
-                 (bhpos == BH_S) ) {
+    tmpl(int)::recovery_route( size_t dx, size_t dy )
+    {
+        // use normal routing (X-first) when the recovery routing is disabled
+        int bhpos = NORMAL;
+        bool normal = true;
+        if (is_reconfigurable()) {
+            assert(not is_reallocation_enabled() or
+                   not is_destination_blackhole(dx, dy));
+
+            bhpos  = blackhole_position();
+
+            normal = (bhpos == NORMAL) or
+                     (not is_recovery_routing_enabled() and
+                      not is_destination_blackhole(dx, dy));
+        }
+
+        const bool is_n  = not normal and (bhpos == N_OF_X);
+        const bool is_s  = not normal and (bhpos == S_OF_X);
+        const bool is_w  = not normal and (bhpos == W_OF_X);
+        const bool is_e  = not normal and (bhpos == E_OF_X);
+        const bool is_nw = not normal and (bhpos == NW_OF_X);
+        const bool is_ne = not normal and (bhpos == NE_OF_X);
+        const bool is_sw = not normal and (bhpos == SW_OF_X);
+        const bool is_se = not normal and (bhpos == SE_OF_X);
+
+        const size_t lx = m_local_x;
+        const size_t ly = m_local_y;
+
+        if ( dx > lx ) {
+            if ( is_ne || is_e || is_se || is_s || normal )
                 return REQ_EAST;
-            }
-            else if ( bhpos == BH_N ) {
-                if ( (m_local_y == 1) || (m_local_x == 0) || (ydest >= m_local_y) ||
-                     (xdest > (m_local_x + 1)) ) {
+
+            else if ( is_n ) {
+                if ( (ly == 1) || (lx == 0) || (dy >= ly) || (dx > (lx + 1)) )
                     return REQ_EAST;
-                }
-                else {
+                else
                     return REQ_WEST;
-                }
-            }
-            else if ( bhpos == BH_NW ) {
-                if ( (m_local_y == 1) || (ydest >= m_local_y) ||
-                     (xdest > (m_local_x + 2)) ) {
+            }
+            else if ( is_nw ) {
+                if ( (ly == 1) || (dy >= ly) || (dx > (lx + 2)) )
                     return REQ_EAST;
-                }
-                else {
+                else
                     return REQ_SOUTH;
-                }
-            }
-            else if ( bhpos == BH_W ) {
-                if ( (m_local_y == 0) || (ydest > m_local_y)) {
+            }
+            else if ( is_w ) {
+                if ( (ly == 0) || (dy > ly))
                     return REQ_NORTH;
-                }
-                else {
+                else
                     return REQ_SOUTH;
-                }
-            }
-            else if ( bhpos == BH_SW ) {
-                if ( (ydest <= m_local_y) || (xdest > (m_local_x + 1)) ) {
+            }
+            else if ( is_sw ) {
+                if ( (dy <= ly) || (dx > (lx + 1)) )
                     return REQ_EAST;
-                }
-                else {
+                else
                     return REQ_NORTH;
-                }
             }
             std::cout << "error: unexpected condition in function "
@@ -251,34 +251,26 @@
                       << std::endl;
             exit(1);
-        }                    // end if (xdest > m_local_x)
-        else if ( xdest < m_local_x ) {
-            if ( (bhpos == BH_N) || (bhpos == BH_NW) || (bhpos == BH_W) ||
-                 (bhpos == BH_SW) || (bhpos == BH_S) ) {
+        }                    // end if (dx > lx)
+        else if ( dx < lx ) {
+            if ( is_n || is_nw || is_w || is_sw || is_s || normal )
                 return REQ_WEST;
-            }
-            else if ( bhpos == BH_NE ) {
-                if ( (xdest < (m_local_x - 1)) || (ydest >= m_local_y) ) {
+
+            else if ( is_ne ) {
+                if ( (dx < (lx - 1)) || (dy >= ly) )
                     return REQ_WEST;
-                }
-                else {
+                else
                     return REQ_SOUTH;
-                }
-            }
-            else if ( bhpos == BH_SE ) {
-                if ( (m_local_x == 1) && (ydest > (m_local_y + 1)) ) {
+            }
+            else if ( is_se ) {
+                if ( (lx == 1) && (dy > (ly + 1)) )
                     return REQ_NORTH;
-                }
-                else {
+                else
                     return REQ_WEST;
-                }
-            }
-            else if ( bhpos == BH_E ) {
-                if ( (m_local_y == 0) ||
-                    ((m_local_x == 1) && (ydest > m_local_y)) ) {
+            }
+            else if ( is_e ) {
+                if ( (ly == 0) || ((lx == 1) && (dy > ly)) )
                     return REQ_NORTH;
-                }
-                else {
+                else
                     return REQ_SOUTH;
-                }
             }
             std::cout << "error: unexpected condition in function "
@@ -286,27 +278,15 @@
                       << std::endl;
             exit(1);
-        }                    // end if (xdest < m_local_x)
-        else if ( ydest > m_local_y ) {
-            if ( bhpos != BH_S ) {
-                return REQ_NORTH;
-            }
-            else if ( m_local_x != 0 ) {
-                return REQ_WEST;
-            }
-            else {
-                return REQ_EAST;
-            }
-        }                    // end if (ydest > m_local_y)
-        else if ( ydest < m_local_y ) {
-            if ( bhpos != BH_N ) {
-                return REQ_SOUTH;
-            }
-            else if ( m_local_x != 0) {
-                return REQ_WEST;
-            }
-            else {
-                return REQ_EAST;
-            }
-        }                    // end if (ydest < m_local_y)
+        }                    // end if (dx < lx)
+        else if ( dy > ly ) {
+            if      ( ! is_s  ) return REQ_NORTH;
+            else if ( lx != 0 ) return REQ_WEST;
+            else                return REQ_EAST;
+        }
+        else if ( dy < ly ) {
+            if      ( ! is_n )  return REQ_SOUTH;
+            else if ( lx != 0)  return REQ_WEST;
+            else                return REQ_EAST;
+        }
         return REQ_LOCAL;
     }
@@ -315,33 +295,18 @@
     tmpl(int)::route( sc_uint<flit_width> data )
     {
-        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 ( 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()) )
+        const size_t dx = (size_t)(data >> m_x_shift) & m_x_mask;
+        const size_t dy = (size_t)(data >> m_y_shift) & m_y_mask;
+
+        if ( is_reconfigurable() ) {
+            // reroute requests whose destination is the blackhole (this is to
+            // implement the segment reallocation mechanism)
+            if ( is_reallocation_enabled() and is_destination_blackhole(dx, dy))
             {
-                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;
-            }
-        }
-        return xfirst_route(xdest, ydest);
+                return reallocation_route();
+            }
+        }
+
+        // use the recovery routing
+        return recovery_route(dx, dy);
     }
 
@@ -349,15 +314,30 @@
     tmpl(int)::broadcast_route(int step, int source, sc_uint<flit_width> data)
     {
-        const size_t lx   = m_local_x;
-        const size_t ly   = m_local_y;
+        const size_t lx = m_local_x;
+        const size_t ly = m_local_y;
         const size_t xmin = (data >> (flit_width - 5 )) & 0x1F;
         const size_t xmax = (data >> (flit_width - 10)) & 0x1F;
         const size_t ymin = (data >> (flit_width - 15)) & 0x1F;
         const size_t ymax = (data >> (flit_width - 20)) & 0x1F;
-        const int    bh   = blackhole_position();
-
-        int  sel = REQ_NOP;
-        bool special = ((data & 0x2) != 0);
-
+
+        int bhpos = NORMAL;
+        bool recovery = false;
+        if (is_reconfigurable()) {
+            bhpos    = blackhole_position();
+            recovery = is_recovery_routing_enabled();
+        }
+
+        const bool is_n  = recovery and (bhpos == N_OF_X);
+        const bool is_s  = recovery and (bhpos == S_OF_X);
+        const bool is_w  = recovery and (bhpos == W_OF_X);
+        const bool is_e  = recovery and (bhpos == E_OF_X);
+        const bool is_nw = recovery and (bhpos == NW_OF_X);
+        const bool is_ne = recovery and (bhpos == NE_OF_X);
+        const bool is_sw = recovery and (bhpos == SW_OF_X);
+        const bool is_se = recovery and (bhpos == SE_OF_X);
+
+        const bool special = ((data & 0x2) != 0) and recovery;
+
+        int sel = REQ_NOP;
         switch(source) {
         case REQ_LOCAL :
@@ -365,16 +345,14 @@
             else if ( step == 2 ) sel = REQ_SOUTH;
             else if ( step == 3 ) {
-                if ( (bh == BH_N) && (lx != 0) && (ly != 1) ) {
+                if ( is_n && (lx != 0) && (ly != 1) )
                     sel = REQ_NOP;
-                    break;
-                }
-                sel = REQ_EAST;
+                else
+                    sel = REQ_EAST;
             }
             else if ( step == 4 ) {
-                if ( (bh == BH_NE) && (lx != 1) && (ly != 1) ) {
+                if ( is_ne && (lx != 1) && (ly != 1) )
                     sel = REQ_NOP;
-                    break;
-                }
-                sel = REQ_WEST;
+                else
+                    sel = REQ_WEST;
             }
         break;
@@ -383,16 +361,14 @@
             else if ( step == 2 ) sel = REQ_LOCAL;
             else if ( step == 3 ) {
-                if ( bh == BH_SW ) {
+                if ( is_sw )
                     sel = REQ_EAST;
-                    break;
-                }
-                sel = REQ_NOP;
+                else
+                    sel = REQ_NOP;
             }
             else if ( step == 4 ) {
-                if ( (bh == BH_SE) && (!special || (lx == 1))) {
+                if ( is_se && (!special || (lx == 1)))
                     sel = REQ_WEST;
-                    break;
-                }
-                sel = REQ_NOP;
+                else
+                    sel = REQ_NOP;
             }
         break;
@@ -401,13 +377,10 @@
             else if ( step == 2 ) sel = REQ_LOCAL;
             else if ( step == 3 ) {
-                if ( bh == BH_NW ) {
+                if ( is_nw )
                     sel = REQ_EAST;
-                    break;
-                }
-                if ( (bh == BH_NE) && ((lx == 1) || (ly == 1)) ) {
+                else if ( is_ne && ((lx == 1) || (ly == 1)) )
                     sel = REQ_WEST;
-                    break;
-                }
-                sel = REQ_NOP;
+                else
+                    sel = REQ_NOP;
             }
             else if ( step == 4 ) sel = REQ_NOP;
@@ -415,9 +388,8 @@
         case REQ_EAST :
             if ( step == 1 ) {
-                if ( (bh == BH_NE) && (lx != 1) && (ly != 1) ) {
+                if ( is_ne && (lx != 1) && (ly != 1) )
                     sel = REQ_NOP;
-                    break;
-                }
-                sel = REQ_WEST;
+                else
+                    sel = REQ_WEST;
             }
             else if ( step == 2 ) sel = REQ_NORTH;
@@ -427,13 +399,10 @@
         case REQ_WEST :
             if ( step == 1 ) {
-                if ( (bh == BH_N) && (ly != 1) ) {
+                if ( is_n && (ly != 1) )
                     sel = REQ_NOP;
-                    break;
-                }
-                if ( (bh == BH_S) && special ) {
+                else if ( is_s && special )
                     sel = REQ_NOP;
-                    break;
-                }
-                sel = REQ_EAST;
+                else
+                    sel = REQ_EAST;
             }
             else if ( step == 2 ) sel = REQ_NORTH;
@@ -443,19 +412,9 @@
         }
 
-        if      ( (sel == REQ_NORTH) && !(ly < ymax) ) sel = REQ_NOP;
-        else if ( (sel == REQ_SOUTH) && !(ly > ymin) ) sel = REQ_NOP;
-        else if ( (sel == REQ_EAST ) && !(lx < xmax) ) sel = REQ_NOP;
-        else if ( (sel == REQ_WEST ) && !(lx > xmin) ) sel = REQ_NOP;
-
-#if 0
-        /* This code can be used if we want to inhibit requests to the
-         * blackhole. However, it is not strictly necessary because the
-         * blackhole will consume the request and will do nothing with it */
-
-        if      ( (sel == REQ_NORTH) && (bh == BH_S) ) sel = REQ_NOP;
-        else if ( (sel == REQ_SOUTH) && (bh == BH_N) ) sel = REQ_NOP;
-        else if ( (sel == REQ_EAST ) && (bh == BH_W) ) sel = REQ_NOP;
-        else if ( (sel == REQ_WEST ) && (bh == BH_E) ) sel = REQ_NOP;
-#endif
+        // inhibit requests to the blackhole or beyond the mesh boundaries.
+        if      ( (sel == REQ_NORTH) && (!(ly < ymax) || is_s)) sel = REQ_NOP;
+        else if ( (sel == REQ_SOUTH) && (!(ly > ymin) || is_n)) sel = REQ_NOP;
+        else if ( (sel == REQ_EAST ) && (!(lx < xmax) || is_w)) sel = REQ_NOP;
+        else if ( (sel == REQ_WEST ) && (!(lx > xmin) || is_e)) sel = REQ_NOP;
 
         return sel;
@@ -469,14 +428,20 @@
 
     /////////////////////////////////////////////////////////
-    tmpl(sc_uint<flit_width>)::compute_broadcast_header(int source)
-    {
-        const int bh = blackhole_position();
-        sc_uint<flit_width> header = r_fifo_in[source].read().data;
-        sc_uint<flit_width> special = 0x2;
+    tmpl(typename DspinRouter<flit_width>::internal_flit_t)::
+    compute_broadcast_header(int source)
+    {
+        const int bhpos = blackhole_position();
+
+        const int is_nw = (bhpos == NW_OF_X);
+        const int is_ne = (bhpos == NE_OF_X);
+
+        internal_flit_t header;
+        header.eop = false;
+        header.data = r_fifo_in[source].read().data;
+
+        const int SPECIAL = 0x2;
         switch (source) {
             case REQ_NORTH:
-                if ( (bh == BH_NW) || (bh == BH_NE) ) {
-                    header |= special;
-                }
+                if ( is_nw || is_ne ) header.data |= SPECIAL;
                 break;
 
@@ -484,7 +449,7 @@
              * network with the special bit set. This can arrive if an initiator
              * or a local interconnect uses the broadcast header reserved bits
-             * internally and don't reset them */
+             * internally */
             case REQ_LOCAL:
-                header &= ~special;
+                header.data &= ~SPECIAL;
                 break;
         }
@@ -521,17 +486,25 @@
         const char* bh_str[] =
         {
-            "BH_NONE",
-            "BH_N",
-            "BH_NE",
-            "BH_E",
-            "BH_SE",
-            "BH_S",
-            "BH_SW",
-            "BH_W",
-            "BH_NW"
+            "N_OF_X",
+            "NE_OF_X",
+            "E_OF_X",
+            "SE_OF_X",
+            "S_OF_X",
+            "SW_OF_X",
+            "W_OF_X",
+            "NW_OF_X"
         };
 
         std::cout << "DSPIN_ROUTER " << name();
-        std::cout << " / bh = " << bh_str[blackhole_position()];
+
+        if ( is_reconfigurable() ) {
+            std::cout << " / bh = " << bh_str[blackhole_position()];
+            if (is_recovery_routing_enabled())
+                std::cout << " / recovery_routing ";
+            if (is_reallocation_enabled())
+                std::cout << " / reallocation dir = "
+                          << port_name[reallocation_route()];
+        }
+
 
         for( size_t i = 0 ; i < 5 ; i++)  // loop on input ports
@@ -640,11 +613,10 @@
                             {
                                 std::cout << "ERROR in DSPIN_ROUTER " << name()
-                                          << " : broadcast packet must be 2 flits" << std::endl;
+                                          << " : broadcast packet must be 2 flits"
+                                          << std::endl;
                                 exit(1);
                             }
 
-                            internal_flit_t header;
-                            header.eop  = false;
-                            header.data = compute_broadcast_header(i);
+                            const internal_flit_t& header = compute_broadcast_header(i);
 
                             fifo_in_read[i] = true;
@@ -652,6 +624,6 @@
                             r_buf_in[i]     = header;
                             r_index_in[i]   = req_in[i];
-                            if( req_in[i] == REQ_NOP ) r_fsm_in[i] = INFSM_REQ_SECOND;
-                            else                       r_fsm_in[i] = INFSM_REQ_FIRST;
+                            if ( req_in[i] == REQ_NOP ) r_fsm_in[i] = INFSM_REQ_SECOND;
+                            else                        r_fsm_in[i] = INFSM_REQ_FIRST;
                         }
                         else                                  // unicast
