Index: branches/reconfiguration/modules/vci_xicu/caba/source/src/vci_xicu.cpp
===================================================================
--- branches/reconfiguration/modules/vci_xicu/caba/source/src/vci_xicu.cpp	(revision 988)
+++ branches/reconfiguration/modules/vci_xicu/caba/source/src/vci_xicu.cpp	(revision 990)
@@ -224,5 +224,5 @@
     switch (func)
     {
-    case XICU_WTI_REG:
+        case XICU_WTI_REG:
         CHECK_BOUNDS(wti);
         data = r_wti_reg[idx];
@@ -328,12 +328,18 @@
         case XICU_PRIO:
         CHECK_BOUNDS(irq);
-        data =
-            (((r_msk_pti[idx] & r_pti_pending) ? 1 : 0) << 0) |
-            (((r_msk_hwi[idx] & r_hwi_pending) ? 1 : 0) << 1) |
-            (((r_msk_wti[idx] & r_wti_pending) ? 1 : 0) << 2) |
-            ((soclib::common::ctz<uint32_t>(r_msk_pti[idx] & r_pti_pending) & 0x1f) <<  8) |
-            ((soclib::common::ctz<uint32_t>(r_msk_hwi[idx] & r_hwi_pending) & 0x1f) << 16) |
-            ((soclib::common::ctz<uint32_t>(r_msk_wti[idx] & r_wti_pending) & 0x1f) << 24);
-
+        {
+            uint32_t pti_active = r_msk_pti[idx] & r_pti_pending;
+            uint32_t hwi_active = r_msk_hwi[idx] & r_hwi_pending;
+            uint32_t wti_active = r_msk_wti[idx] & r_wti_pending;
+            uint32_t t = pti_active ? 1 : 0;
+            uint32_t h = hwi_active ? 1 : 0;
+            uint32_t w = wti_active ? 1 : 0;
+            uint32_t prio_pti = t ? soclib::common::ctz<uint32_t>(pti_active) : 0;
+            uint32_t prio_hwi = h ? soclib::common::ctz<uint32_t>(hwi_active) : 0;
+            uint32_t prio_wti = w ? soclib::common::ctz<uint32_t>(wti_active) : 0;
+
+            data = (t << 0) | (h << 1) | (w << 2) |
+                   (prio_pti << 8 ) | (prio_hwi << 16) | (prio_wti << 24);
+        }
 #if SOCLIB_MODULE_DEBUG
 std::cout << "[" << name() << "] Read XICU_PRIO[" << std::dec << idx << "] = "
@@ -342,12 +348,14 @@
         return true;
 
-    case XICU_CONFIG:
+        case XICU_CONFIG:
         data = (m_irq_count << 24) | (m_wti_count << 16) | (m_hwi_count << 8) | m_pti_count;
-#if SOCLIB_MODULE_DEBUG
-std::cout << "[" << name() << "] Read XICU_CONFIG = " << std::hex << (int)data << std::dec << " time = " << m_clock_cycles << std::endl;
-#endif
-        return true;
-
-    case XICU_CFG_REG:
+
+#if SOCLIB_MODULE_DEBUG
+std::cout << "[" << name() << "] Read XICU_CONFIG = "
+<< std::hex << (int)data << std::dec << " time = " << m_clock_cycles << std::endl;
+#endif
+        return true;
+
+        case XICU_CFG_REG:
         CHECK_BOUNDS(cfg);
         data = r_cfg_reg[idx];
