Changeset 712 for trunk/modules


Ignore:
Timestamp:
Jun 10, 2014, 11:32:32 AM (10 years ago)
Author:
alain
Message:

Introducing support for read and write WTI transactions.
The WTI read transaction is used for IRQ reset.

Location:
trunk/modules/vci_io_bridge
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_io_bridge/caba/source/include/vci_io_bridge.h

    r585 r712  
    3737//                 configuration or data transactions to peripherals.
    3838//
    39 // Regarding DMA transactions initiated by external peripherals, it provides
     39// It supports two types of transactions from peripherals:
     40//   - DMA transactions to the RAM network,
     41//   - WTI transactions to the INT network.
     42// Regarding transactions initiated by external peripherals, it provides
    4043// an - optional - IOMMU service : the 32 bits virtual address is translated
    4144// to a (up to) 40 bits physical address by a standard SoCLib generic TLB.
    4245// In case of TLB MISS, the DMA transaction is stalled until the TLB is updated.
    43 // In case of page fault (illegal access), a VCI error is returned to the
    44 // faulty peripheral.
     46// In case of page fault or read_only violation (illegal access), a VCI error
     47// is returned to the faulty peripheral, and a IOMMU WTI is sent.
    4548/////////////////////////////////////////////////////////////////////////////////
    4649//   General Constraints:
     
    6366// - Ne pas garder tous les champs WRITE CMD dans les FIFO a chaque flit
    6467//   (seulement 'data' et 'be')
    65 // - Traiter complêtement les codes d'erreur en réponse à une transaction
    66 //   WTI write
    6768///////////////////////////////////////////////////////////////////////////////
    6869
     
    9495    : public soclib::caba::BaseModule
    9596{
    96     // Data and be fields have different widths on INT and EXT networks
     97    // Data and be fields have different widths on INT and EXT/IOC networks
    9798    typedef typename vci_param_ext::data_t          ext_data_t;
    9899    typedef typename vci_param_int::data_t          int_data_t;
    99100    typedef typename vci_param_ext::be_t            ext_be_t;
    100     typedef typename vci_param_int::be_t            ext_in_t;
     101    typedef typename vci_param_int::be_t            int_be_t;
    101102
    102103    // Other fields must be equal   
     
    130131    { 
    131132        DMA_CMD_IDLE,
    132         DMA_CMD_FIFO_PUT_CMD,
    133         DMA_CMD_FIFO_PUT_RSP,
    134         DMA_CMD_MISS_WAIT,
    135         DMA_CMD_WAIT_EOP,
     133        DMA_CMD_DMA_REQ,
     134        DMA_CMD_WTI_IOX_REQ,
     135        DMA_CMD_ERR_WAIT_EOP,
     136        DMA_CMD_ERR_WTI_REQ,
     137        DMA_CMD_ERR_RSP_REQ,
     138        DMA_CMD_TLB_MISS_WAIT,
    136139    };
    137140   
    138     // States for DMA_RSP FSM (from RAM to IOX)
     141    // States for DMA_RSP FSM
    139142    enum dma_rsp_fsm_state
    140143    { 
    141         DMA_RSP_IDLE,
    142         DMA_RSP_FIFO_PUT,
     144        DMA_RSP_IDLE_DMA,
     145        DMA_RSP_IDLE_WTI,
     146        DMA_RSP_IDLE_ERR,
     147        DMA_RSP_PUT_DMA,
     148        DMA_RSP_PUT_WTI,
     149        DMA_RSP_PUT_ERR,
    143150    };
    144151   
     
    159166        };
    160167   
    161     // States for CONFIG_CMD FSM (from INT to IOX)
     168    // States for CONFIG_CMD FSM
    162169    enum config_cmd_fsm_state
    163170    { 
     
    168175        };
    169176   
    170     // states for CONFIG_RSP FSM (from IOX to INT)
     177    // states for CONFIG_RSP FSM
    171178    enum config_rsp_fsm_state
    172179    { 
    173         CONFIG_RSP_IDLE,
    174         CONFIG_RSP_PUT_LO,
     180        CONFIG_RSP_IDLE_IOX,
     181        CONFIG_RSP_IDLE_LOC,
     182        CONFIG_RSP_PUT_LOW,
    175183        CONFIG_RSP_PUT_HI,
    176184        CONFIG_RSP_PUT_UNC,
     185        CONFIG_RSP_PUT_LOC,
     186
    177187    };
    178188   
    179     // States for MISS_WTI_CMD FSM (to INT network)
    180     enum miss_wti_cmd_state
    181     { 
    182         MISS_WTI_CMD_IDLE,
    183         MISS_WTI_CMD_WTI,
    184         MISS_WTI_CMD_MISS,
    185         };
    186    
    187     // States for MISS_WTI_RSP FSM (from INT network)
     189    // States for MISS_WTI_RSP FSM 
    188190    enum miss_wti_rsp_state
    189191    { 
    190192        MISS_WTI_RSP_IDLE,
    191         MISS_WTI_RSP_WTI,
     193        MISS_WTI_RSP_WTI_IOX,
     194        MISS_WTI_RSP_WTI_MMU,
    192195        MISS_WTI_RSP_MISS,
    193196        };
     
    196199    enum pktid_values_e
    197200    {
    198         PKTID_READ  = 0x0,  // TSAR code for read data uncached
    199         PKTID_WRITE = 0x4,  // TSAR code for write
     201        PKTID_MISS    = 0x0,  // TSAR code for read data uncached
     202        PKTID_WTI_IOX = 0x4,  // TSAR code for write
     203        PKTID_WTI_MMU = 0xC,  // TSAR code for write
    200204    };
    201205   
     
    210214    sc_in<bool>                               p_clk;
    211215    sc_in<bool>                               p_resetn;
    212     sc_in<bool>*                              p_irq[32];     // not always constructed
    213216   
    214217    soclib::caba::VciInitiator<vci_param_ext> p_vci_ini_ram;
     
    222225private:
    223226    const size_t                                  m_words;
    224     const bool                                m_has_irqs;
    225227
    226228    // INT & IOX Networks
    227229    std::list<soclib::common::Segment>        m_int_seglist;
    228     const vci_srcid_t                             m_int_srcid;  // local SRCID on INT network
     230    const vci_srcid_t                             m_int_srcid;      // SRCID on INT network
    229231    std::list<soclib::common::Segment>        m_iox_seglist;
    230232
     
    241243    // MEMORY MAPPED REGISTERS
    242244    ///////////////////////////////
    243     sc_signal<uint32_t>         r_iommu_ptpr;           // page table pointer register
     245    sc_signal<uint32_t>         r_iommu_ptpr;           // page table pointer
    244246    sc_signal<bool>             r_iommu_active;         // iotlb mode
    245     sc_signal<uint32_t>         r_iommu_bvar;           // iommu bad virtual address
    246     sc_signal<uint32_t>         r_iommu_etr;            // iommu error type
    247     sc_signal<uint32_t>         r_iommu_bad_id;         // SRCID of faulty peripheral
    248     sc_signal<uint32_t>         r_iommu_wti_enable;     // enable WTI transactions 
    249     sc_signal<vci_addr_t>       r_iommu_wti_paddr;      // address of IOMMU WTI
    250     sc_signal<vci_addr_t>*      r_iommu_peri_wti;       // array[32] WTI for peripherals
     247    sc_signal<uint32_t>         r_iommu_bvar;           // bad vaddr
     248    sc_signal<uint32_t>         r_iommu_etr;            // error type
     249    sc_signal<uint32_t>         r_iommu_bad_id;         // faulty srcid
     250    sc_signal<bool>             r_iommu_wti_enable;     // enable IOB WTI 
     251    sc_signal<uint32_t>         r_iommu_wti_addr_lo;    // IOMMU WTI paddr (32 lsb)
     252    sc_signal<uint32_t>         r_iommu_wti_addr_hi;    // IOMMU WTI paddr (32 msb)
     253
     254    sc_signal<uint32_t>         r_xicu_base;            // XICU paddr base (cluster 0)
     255    sc_signal<uint32_t>         r_xicu_size;            // XIXU paddr size (cluster 0)
    251256 
    252257        ///////////////////////////////////
     
    254259    ///////////////////////////////////
    255260    sc_signal<int>              r_dma_cmd_fsm;         
    256     sc_signal<uint32_t>         r_dma_cmd_vaddr;        // input virtual address
    257     sc_signal<vci_addr_t>       r_dma_cmd_paddr;        // output physical address
     261    sc_signal<vci_addr_t>       r_dma_cmd_paddr;                // output paddr
     262
     263    sc_signal<bool>             r_dma_cmd_to_miss_wti_cmd_req;
     264    sc_signal<vci_addr_t>       r_dma_cmd_to_miss_wti_cmd_addr;
     265    sc_signal<vci_cmd_t>        r_dma_cmd_to_miss_wti_cmd_cmd;
     266    sc_signal<vci_srcid_t>      r_dma_cmd_to_miss_wti_cmd_srcid;
     267    sc_signal<vci_trdid_t>      r_dma_cmd_to_miss_wti_cmd_trdid;
     268    sc_signal<vci_trdid_t>      r_dma_cmd_to_miss_wti_cmd_pktid;
     269    sc_signal<int_data_t>       r_dma_cmd_to_miss_wti_cmd_wdata;
     270
     271    sc_signal<bool>             r_dma_cmd_to_dma_rsp_req;
     272    sc_signal<vci_srcid_t>      r_dma_cmd_to_dma_rsp_rsrcid;
     273    sc_signal<vci_trdid_t>      r_dma_cmd_to_dma_rsp_rtrdid;
     274    sc_signal<vci_pktid_t>      r_dma_cmd_to_dma_rsp_rpktid;
     275    sc_signal<vci_rerror_t>     r_dma_cmd_to_dma_rsp_rerror;
     276    sc_signal<ext_data_t>       r_dma_cmd_to_dma_rsp_rdata;
     277     
     278    sc_signal<bool>             r_dma_cmd_to_tlb_req;
     279    sc_signal<uint32_t>         r_dma_cmd_to_tlb_vaddr;         // input vaddr
    258280
    259281    ///////////////////////////////////
     
    266288    ///////////////////////////////////
    267289    sc_signal<int>              r_config_cmd_fsm;
    268     sc_signal<uint32_t>         r_config_cmd_rdata;
    269     sc_signal<bool>             r_config_cmd_error;
    270     sc_signal<uint32_t>         r_config_cmd_inval_vaddr;
     290
     291    sc_signal<bool>             r_config_cmd_to_tlb_req;
     292    sc_signal<uint32_t>         r_config_cmd_to_tlb_vaddr;
     293
     294    sc_signal<bool>             r_config_cmd_to_config_rsp_req;
     295    sc_signal<bool>             r_config_cmd_to_config_rsp_rerror;
     296    sc_signal<uint32_t>         r_config_cmd_to_config_rsp_rdata;
    271297
    272298    sc_signal<ext_data_t>       r_config_cmd_wdata;
     
    293319    // TLB FSM REGISTERS
    294320    ///////////////////////////////////
    295     sc_signal<int>              r_tlb_fsm;                      // state register
    296     sc_signal<bool>             r_waiting_transaction;  // Flag for returning from
     321    sc_signal<int>              r_tlb_fsm;                          // state register
     322    sc_signal<bool>             r_waiting_transaction;      // Flag for returning from
    297323    sc_signal<int>              r_tlb_miss_type;
    298324        sc_signal<bool>             r_tlb_miss_error;
    299325
    300     sc_signal<vci_addr_t>       r_tlb_paddr;                // physical address of pte
    301     sc_signal<uint32_t>         r_tlb_pte_flags;            // pte1 or first word of pte2
    302     sc_signal<uint32_t>         r_tlb_pte_ppn;          // second word of pte2
    303     sc_signal<size_t>           r_tlb_way;                      // selected way in tlb   
    304     sc_signal<size_t>           r_tlb_set;                      // selected set in tlb   
    305 
    306     uint32_t*                   r_tlb_buf_data;         // prefetch buffer for PTEs
    307     sc_signal<bool>             r_tlb_buf_valid;        // one valit flag for all PTEs
    308     sc_signal<vci_addr_t>       r_tlb_buf_tag;          // cache line number 
    309     sc_signal<vci_addr_t>       r_tlb_buf_vaddr;        // virtual address first PTE 
    310     sc_signal<bool>             r_tlb_buf_big_page;     // ???
    311 
    312     ///////////////////////////////////
    313     // MISS_WTI_CMD FSM REGISTERS
    314     ///////////////////////////////////
    315     sc_signal<int>              r_miss_wti_cmd_fsm;
    316     sc_signal<size_t>           r_miss_wti_cmd_index;
     326    sc_signal<vci_addr_t>       r_tlb_paddr;                    // physical address of pte
     327    sc_signal<uint32_t>         r_tlb_pte_flags;                // pte1 or first word of pte2
     328    sc_signal<uint32_t>         r_tlb_pte_ppn;              // second word of pte2
     329    sc_signal<size_t>           r_tlb_way;                          // selected way in tlb   
     330    sc_signal<size_t>           r_tlb_set;                          // selected set in tlb   
     331
     332    uint32_t*                   r_tlb_buf_data;             // prefetch buffer for PTEs
     333    sc_signal<bool>             r_tlb_buf_valid;            // one valit flag for all PTEs
     334    sc_signal<vci_addr_t>       r_tlb_buf_tag;              // cache line number 
     335    sc_signal<vci_addr_t>       r_tlb_buf_vaddr;            // vaddr for first PTE 
     336    sc_signal<bool>             r_tlb_buf_big_page;         // ???
     337
     338    sc_signal<bool>             r_tlb_to_miss_wti_cmd_req;
    317339
    318340    ///////////////////////////////////
     
    320342    ///////////////////////////////////
    321343    sc_signal<int>              r_miss_wti_rsp_fsm;
    322     sc_signal<bool>             r_miss_wti_rsp_error;
    323     sc_signal<size_t>           r_miss_wti_rsp_count;
     344    sc_signal<bool>             r_miss_wti_rsp_error_wti;   // VCI error on WTI
     345    sc_signal<bool>             r_miss_wti_rsp_error_miss;  // VCI error on MISS
     346    sc_signal<size_t>           r_miss_wti_rsp_count;       // flits counter
     347
     348    sc_signal<bool>             r_miss_wti_rsp_to_dma_rsp_req;
     349    sc_signal<vci_rerror_t>     r_miss_wti_rsp_to_dma_rsp_rerror;
     350    sc_signal<vci_srcid_t>      r_miss_wti_rsp_to_dma_rsp_rsrcid;
     351    sc_signal<vci_trdid_t>      r_miss_wti_rsp_to_dma_rsp_rtrdid;
     352    sc_signal<vci_pktid_t>      r_miss_wti_rsp_to_dma_rsp_rpktid;
     353
    324354   
    325355    /////////////////////////////////////////////////////
     
    327357    /////////////////////////////////////////////////////
    328358    sc_signal<bool>             r_alloc_fifo_config_rsp_local; 
    329     sc_signal<bool>             r_alloc_fifo_dma_rsp_local; 
    330 
    331     //////////////////////////////////
    332     // IRQ FSM registers
    333     //////////////////////////////////
    334         sc_signal<bool>*            r_irq_pending;  // array[32]
    335         sc_signal<bool>*            r_irq_request;  // array[32]
     359
    336360   
    337361    //////////////////////////////////////////////////////////////////
     
    340364    GenericTlb<vci_addr_t>      r_iotlb;
    341365       
    342     //////////////////////////////////////////////////////////////////
    343     // Inter-FSM communications
    344     //////////////////////////////////////////////////////////////////
    345    
    346     // between DMA_CMD and TLB FSM
    347     sc_signal<bool>             r_dma_tlb_req;
    348 
    349     // between CONFIG_CMD FSM and TLB FSM
    350     sc_signal<bool>             r_config_tlb_req;
    351    
    352     // between TLB FSM and MISS_WTI FSM
    353     sc_signal<bool>             r_tlb_miss_req;
    354366   
    355367    /////////////////////////
     
    405417    GenericFifo<vci_rerror_t>   m_config_rsp_rerror_fifo;
    406418       
    407    
     419    // output FIFO to VCI_INI port on INT network (VCI command)
     420    GenericFifo<vci_addr_t>     m_miss_wti_cmd_addr_fifo;
     421    GenericFifo<vci_srcid_t>    m_miss_wti_cmd_srcid_fifo;
     422    GenericFifo<vci_trdid_t>    m_miss_wti_cmd_trdid_fifo;
     423    GenericFifo<vci_pktid_t>    m_miss_wti_cmd_pktid_fifo;
     424    GenericFifo<int_be_t>       m_miss_wti_cmd_be_fifo;
     425    GenericFifo<vci_cmd_t>      m_miss_wti_cmd_cmd_fifo;
     426    GenericFifo<vci_contig_t>   m_miss_wti_cmd_contig_fifo;
     427    GenericFifo<int_data_t>     m_miss_wti_cmd_data_fifo;
     428    GenericFifo<vci_eop_t>      m_miss_wti_cmd_eop_fifo;
     429    GenericFifo<vci_cons_t>     m_miss_wti_cmd_cons_fifo;
     430    GenericFifo<vci_plen_t>     m_miss_wti_cmd_plen_fifo;
     431    GenericFifo<vci_wrap_t>     m_miss_wti_cmd_wrap_fifo;
     432    GenericFifo<vci_cfixed_t>   m_miss_wti_cmd_cfixed_fifo;
     433    GenericFifo<vci_clen_t>     m_miss_wti_cmd_clen_fifo;
     434   
    408435    ////////////////////////////////
    409436    // Activity counters
     
    432459    uint32_t m_cpt_fsm_config_cmd       [32];
    433460    uint32_t m_cpt_fsm_config_rsp       [32];
    434     uint32_t m_cpt_fsm_miss_wti_cmd     [32];
    435461    uint32_t m_cpt_fsm_miss_wti_rsp     [32];
    436462 
    437463protected:
     464
    438465    SC_HAS_PROCESS(VciIoBridge);
    439466
    440467public:
     468
    441469    VciIoBridge(
    442470        sc_module_name insname,
     
    447475        const    soclib::common::IntTab        &int_srcid,   // INT network SRCID
    448476        const    soclib::common::IntTab        &iox_tgtid,   // IOX network TGTID
    449         const    bool                          has_irqs,     // component has irq ports
    450477        const    size_t                        dcache_words,
    451478        const    size_t                        iotlb_ways,
     
    462489
    463490private:
     491
     492    bool is_wti( vci_addr_t paddr );
    464493    void transition();
    465494    void genMoore();
  • trunk/modules/vci_io_bridge/caba/source/src/vci_io_bridge.cpp

    r585 r712  
    4343#define DEBUG_CONFIG_CMD                1
    4444#define DEBUG_CONFIG_RSP                1
    45 #define DEBUG_MISS_WTI                  1
     45#define DEBUG_MISS_WTI_CMD              1
    4646
    4747namespace soclib {
     
    5353    {
    5454        "DMA_CMD_IDLE",
    55         "DMA_CMD_FIFO_PUT_CMD",
    56         "DMA_CMD_FIFO_PUT_RSP",
    57         "DMA_CMD_MISS_WAIT",
    58         "DMA_CMD_WAIT_EOP",
     55        "DMA_CMD_DMA_REQ",
     56        "DMA_CMD_WTI_IOX_REQ",
     57        "DMA_CMD_ERR_WAIT_EOP",
     58        "DMA_CMD_ERR_WTI_REQ",
     59        "DMA_CMD_ERR_RSP_REQ",
     60        "DMA_CMD_TLB_MISS_WAIT",
    5961    };
    6062
    6163const char *dma_rsp_fsm_state_str[] =
    6264    {
    63         "DMA_RSP_IDLE",
    64         "DMA_RSP_FIFO_PUT",
     65        "DMA_RSP_IDLE_DMA",
     66        "DMA_RSP_IDLE_WTI",
     67        "DMA_RSP_IDLE_ERR",
     68        "DMA_RSP_PUT_DMA",
     69        "DMA_RSP_PUT_WTI",
     70        "DMA_RSP_PUT_ERR",
    6571    };
    6672
     
    9096const char *config_rsp_fsm_state_str[] =
    9197    {
    92         "CONFIG_RSP_IDLE",
    93         "CONFIG_RSP_PUT_LO",
     98        "CONFIG_RSP_IDLE_IOX",
     99        "CONFIG_RSP_IDLE_LOC",
     100        "CONFIG_RSP_PUT_LOW",
    94101        "CONFIG_RSP_PUT_HI",
    95102        "CONFIG_RSP_PUT_UNC",
     103        "CONFIG_RSP_PUT_LOC",
    96104    };
    97105
    98 const char *miss_wti_cmd_state_str[] =
    99     { 
    100         "MISS_WTI_CMD_IDLE",
    101         "MISS_WTI_CMD_WTI",
    102         "MISS_WTI_CMD_MISS",
    103     };
    104106const char *miss_wti_rsp_state_str[] =
    105107    { 
    106108        "MISS_WTI_RSP_IDLE",
    107         "MISS_WTI_RSP_WTI",
     109        "MISS_WTI_RSP_WTI_IOX",
     110        "MISS_WTI_RSP_WTI_MMU",
    108111        "MISS_WTI_RSP_MISS",
    109112    };
     
    121124    const soclib::common::IntTab            &int_srcid,     // INT network SRCID
    122125    const soclib::common::IntTab            &iox_tgtid,     // IOX network TGTID
    123     const bool                          has_irqs,
    124126    const size_t                        dcache_words,
    125127    const size_t                                        iotlb_ways,
     
    138140
    139141      m_words( dcache_words ),
    140       m_has_irqs( has_irqs ),
    141142
    142143      // INT & IOX Network
     
    157158      r_iommu_etr("r_iommu_etr"),
    158159      r_iommu_bad_id("r_iommu_bad_id"),
    159       r_iommu_wti_paddr("r_iommu_wti_paddr"),
    160       r_iommu_peri_wti(alloc_elems<sc_signal<vci_addr_t> >("r_peri_wti_paddr", 32)),
     160      r_iommu_wti_enable("r_iommu_wti_enable"),
     161      r_iommu_wti_addr_lo("r_iommu_wti_addr_lo"),
    161162
    162163      // DMA_CMD FSM registers
    163164      r_dma_cmd_fsm("r_dma_cmd_fsm"),
    164       r_dma_cmd_vaddr("r_dma_cmd_vaddr"),
    165165      r_dma_cmd_paddr("r_dma_cmd_paddr"),
    166166
     167      r_dma_cmd_to_miss_wti_cmd_req("r_dma_cmd_to_miss_wti_cmd_req"),
     168      r_dma_cmd_to_miss_wti_cmd_addr("r_dma_cmd_to_miss_wti_cmd_addr"),
     169      r_dma_cmd_to_miss_wti_cmd_srcid("r_dma_cmd_to_miss_wti_cmd_srcid"),
     170      r_dma_cmd_to_miss_wti_cmd_trdid("r_dma_cmd_to_miss_wti_cmd_trdid"),
     171      r_dma_cmd_to_miss_wti_cmd_pktid("r_dma_cmd_to_miss_wti_cmd_pktid"),
     172      r_dma_cmd_to_miss_wti_cmd_wdata("r_dma_cmd_to_miss_wti_cmd_wdata"),
     173
     174      r_dma_cmd_to_dma_rsp_req("r_dma_cmd_to_dma_rsp_req"),
     175      r_dma_cmd_to_dma_rsp_rsrcid("r_dma_cmd_to_dma_rsp_rsrcid"),
     176      r_dma_cmd_to_dma_rsp_rtrdid("r_dma_cmd_to_dma_rsp_rtrdid"),
     177      r_dma_cmd_to_dma_rsp_rpktid("r_dma_cmd_to_dma_rsp_rpktid"),
     178     
     179      r_dma_cmd_to_tlb_req("r_dma_cmd_to_tlb_req"),
     180      r_dma_cmd_to_tlb_vaddr("r_dma_cmd_to_tlb_vaddr"),
     181     
    167182      //DMA_RSP FSM registers
    168183      r_dma_rsp_fsm("r_dma_rsp_fsm"),
     
    170185      // CONFIG_CMD FSM registers
    171186      r_config_cmd_fsm("r_config_cmd_fsm"),
    172       r_config_cmd_rdata("r_config_cmd_rdata"),
    173       r_config_cmd_error("r_config_cmd_error"),
    174       r_config_cmd_inval_vaddr("r_config_cmd_inval_vaddr"),
     187
     188      r_config_cmd_to_tlb_req("r_config_cmd_to_tlb_req"),
     189      r_config_cmd_to_tlb_vaddr("r_config_cmd_to_tlb_vaddr"),
     190
     191      r_config_cmd_to_config_rsp_req("r_config_cmd_to_config_rsp_req"),
     192      r_config_cmd_to_config_rsp_rerror("r_config_cmd_to_config_rsp_rerror"),
     193      r_config_cmd_to_config_rsp_rdata("r_config_cmd_to_config_rsp_rdata"),
     194
    175195      r_config_cmd_wdata("r_config_cmd_wdata"),
    176196      r_config_cmd_be("r_config_cmd_be"),
     
    196216      r_tlb_miss_type("r_tlb_miss_type"),
    197217      r_tlb_miss_error("r_tlb_miss_error"),
     218
    198219      r_tlb_paddr("r_tlb_paddr"),               
    199220      r_tlb_pte_flags("r_tlb_pte_flags"),
    200221      r_tlb_pte_ppn("r_tlb_pte_ppn"),
    201222      r_tlb_way("r_tlb_way"),
    202       r_tlb_set("r_tlb_set"),   
     223      r_tlb_set("r_tlb_set"),
     224   
    203225      r_tlb_buf_valid("r_tlb_buf_valid"),
    204226      r_tlb_buf_tag("r_tlb_buf_tag"),
     
    206228      r_tlb_buf_big_page("r_tlb_buf_big_page"),
    207229
    208       // MISS_WTI_CMD FSM registers
    209       r_miss_wti_cmd_fsm("r_miss_wti_cmd_fsm"),
    210       r_miss_wti_cmd_index("r_miss_wti_cmd_index"),
    211 
    212       // MISS_WTI_CMD FSM registers
     230      r_tlb_to_miss_wti_cmd_req("r_tlb_to_miss_wti_cmd_req"),
     231
     232      // MISS_WTI_RSP FSM registers
    213233      r_miss_wti_rsp_fsm("r_miss_wti_rsp_fsm"),
    214       r_miss_wti_rsp_error("r_miss_wti_rsp_error"),
    215 
    216       // allocator for CONFIG_RSP & DMA_RSP fifos
    217       r_alloc_fifo_config_rsp_local("r_alloc_fifo_config_rsp_local"),
    218       r_alloc_fifo_dma_rsp_local("r_alloc_fifo_dma_rsp_local"),
    219 
    220       // IRQs registers
    221       r_irq_pending(alloc_elems<sc_signal<bool> >("r_irq_pending", 32)),
    222       r_irq_request(alloc_elems<sc_signal<bool> >("r_irq_request", 32)),
    223      
     234      r_miss_wti_rsp_error_wti("r_miss_wti_rsp_error_wti"),
     235      r_miss_wti_rsp_error_miss("r_miss_wti_rsp_error_miss"),
     236      r_miss_wti_rsp_count("r_miss_wti_rsp_count"),
     237
     238      r_miss_wti_rsp_to_dma_rsp_req("r_miss_wti_rsp_to_dma_rsp_req"),
     239      r_miss_wti_rsp_to_dma_rsp_rerror("r_miss_wti_rsp_to_dma_rsp_rerror"),
     240      r_miss_wti_rsp_to_dma_rsp_rsrcid("r_miss_wti_rsp_to_dma_rsp_rsrcid"),
     241      r_miss_wti_rsp_to_dma_rsp_rtrdid("r_miss_wti_rsp_to_dma_rsp_rtrdid"),
     242      r_miss_wti_rsp_to_dma_rsp_rpktid("r_miss_wti_rsp_to_dma_rsp_rpktid"),
     243
    224244      // TLB for IOMMU
    225245      r_iotlb("iotlb", 0, iotlb_ways, iotlb_sets, vci_param_int::N),
    226246     
    227       // Inter-FSM communications
    228       r_dma_tlb_req("r_dma_tlb_req"),
    229       r_config_tlb_req("r_config_tlb_req"),
    230       r_tlb_miss_req("r_tlb_miss_req"),
    231      
    232247      // DMA_CMD FIFOs
    233248      m_dma_cmd_addr_fifo("m_dma_cmd_addr_fifo",2),
     
    276291      m_config_rsp_rpktid_fifo("m_config_rsp_rpktid_fifo",2),
    277292      m_config_rsp_reop_fifo("m_config_rsp_reop_fifo",2),
    278       m_config_rsp_rerror_fifo("m_config_rsp_rerror_fifo",2)
     293      m_config_rsp_rerror_fifo("m_config_rsp_rerror_fifo",2),
     294
     295      // MISS_WTI_CMD FIFOs
     296      m_miss_wti_cmd_addr_fifo("m_miss_wti_cmd_addr_fifo",2),
     297      m_miss_wti_cmd_srcid_fifo("m_miss_wti_cmd_srcid_fifo",2),
     298      m_miss_wti_cmd_trdid_fifo("m_miss_wti_cmd_trdid_fifo",2),
     299      m_miss_wti_cmd_pktid_fifo("m_miss_wti_cmd_pktid_fifo",2),
     300      m_miss_wti_cmd_be_fifo("m_miss_wti_cmd_be_fifo",2),
     301      m_miss_wti_cmd_cmd_fifo("m_miss_wti_cmd_cmd_fifo",2),
     302      m_miss_wti_cmd_contig_fifo("m_miss_wti_cmd_contig_fifo",2),
     303      m_miss_wti_cmd_data_fifo("m_miss_wti_cmd_data_fifo",2),
     304      m_miss_wti_cmd_eop_fifo("m_miss_wti_cmd_eop_fifo",2),
     305      m_miss_wti_cmd_cons_fifo("m_miss_wti_cmd_cons_fifo",2),
     306      m_miss_wti_cmd_plen_fifo("m_miss_wti_cmd_plen_fifo",2),
     307      m_miss_wti_cmd_wrap_fifo("m_miss_wti_cmd_wrap_fifo",2),
     308      m_miss_wti_cmd_cfixed_fifo("m_miss_wti_cmd_cfixed_fifo",2),
     309      m_miss_wti_cmd_clen_fifo("m_miss_wti_cmd_clen_fifo",2)
    279310{
    280311    std::cout << "  - Building VciIoBridge : " << name << std::endl;
     
    320351            "VCI_IO_BRIDGE ERROR: SRCID widths must be equal on the 3 networks");
    321352
    322     // contruct 32 IRQ ports if required
    323     if ( has_irqs )
    324     {
    325         for ( size_t n=0 ; n<32 ; n++ ) p_irq[n] = new sc_core::sc_in<bool>;
    326     }
    327    
    328353    // Cache line buffer
    329354    r_tlb_buf_data = new uint32_t[dcache_words];
     
    343368/////////////////////////////////////
    344369{
    345     delete [] r_iommu_peri_wti;
    346370    delete [] r_tlb_buf_data;
    347     soclib::common::dealloc_elems(p_irq, 32);
    348     soclib::common::dealloc_elems(r_irq_request, 32);
    349     soclib::common::dealloc_elems(r_irq_pending, 32);
    350371}
    351372
     
    363384              << " | " << config_cmd_fsm_state_str[r_config_cmd_fsm.read()]
    364385              << " | " << config_rsp_fsm_state_str[r_config_rsp_fsm.read()]
    365               << " | " << miss_wti_cmd_state_str[r_miss_wti_cmd_fsm.read()]
    366386              << " | " << miss_wti_rsp_state_str[r_miss_wti_rsp_fsm.read()]
    367387              << std::endl;
     
    396416}
    397417
     418////////////////////////////////////
     419tmpl(bool)::is_wti(vci_addr_t paddr)
     420////////////////////////////////////
     421{
     422    uint32_t addr32 = (uint32_t)paddr;
     423    uint32_t base   = r_xicu_base.read();
     424    uint32_t size   = r_xicu_size.read();
     425    return ( (addr32 >= base) and (addr32 < (base + size)) );
     426}
     427
    398428/////////////////////////
    399429tmpl(void)::transition()
     
    403433    {
    404434        r_dma_cmd_fsm      = DMA_CMD_IDLE;
    405         r_dma_rsp_fsm      = DMA_RSP_IDLE;
     435        r_dma_rsp_fsm      = DMA_RSP_IDLE_DMA;
    406436        r_tlb_fsm              = TLB_IDLE;
    407437        r_config_cmd_fsm   = CONFIG_CMD_IDLE;
    408         r_config_rsp_fsm   = CONFIG_RSP_IDLE;
    409         r_miss_wti_cmd_fsm = MISS_WTI_CMD_IDLE;
     438        r_config_rsp_fsm   = CONFIG_RSP_IDLE_IOX;
    410439        r_miss_wti_rsp_fsm = MISS_WTI_RSP_IDLE;
    411 
    412         r_alloc_fifo_config_rsp_local = true;
    413         r_alloc_fifo_dma_rsp_local    = true;
    414440
    415441        r_tlb_buf_valid    = false;
    416442                r_iommu_active     = false;
    417443                r_iommu_wti_enable = false;
    418        
     444
     445        r_xicu_size        = 0;
     446        r_xicu_base        = 0;
     447
    419448        // initializing FIFOs
    420449        m_dma_cmd_addr_fifo.init();
     
    455484        m_config_cmd_clen_fifo.init();
    456485       
     486        m_miss_wti_cmd_addr_fifo.init();
     487        m_miss_wti_cmd_srcid_fifo.init();
     488        m_miss_wti_cmd_trdid_fifo.init();
     489        m_miss_wti_cmd_pktid_fifo.init();
     490        m_miss_wti_cmd_be_fifo.init();
     491        m_miss_wti_cmd_cmd_fifo.init();
     492        m_miss_wti_cmd_contig_fifo.init();
     493        m_miss_wti_cmd_data_fifo.init();
     494        m_miss_wti_cmd_eop_fifo.init();
     495        m_miss_wti_cmd_cons_fifo.init();
     496        m_miss_wti_cmd_plen_fifo.init();
     497        m_miss_wti_cmd_wrap_fifo.init();
     498        m_miss_wti_cmd_cfixed_fifo.init();
     499        m_miss_wti_cmd_clen_fifo.init();
     500       
    457501        m_config_rsp_rsrcid_fifo.init();
    458502        m_config_rsp_rtrdid_fifo.init();
     
    463507       
    464508        // SET/RESET Communication flip-flops
    465         r_dma_tlb_req                   = false;
    466         r_config_tlb_req                    = false;
    467         r_tlb_miss_req              = false;
     509        r_dma_cmd_to_miss_wti_cmd_req  = false;
     510        r_dma_cmd_to_dma_rsp_req       = false;
     511        r_dma_cmd_to_tlb_req               = false;
     512        r_config_cmd_to_tlb_req            = false;
     513        r_config_cmd_to_config_rsp_req = false;
     514        r_tlb_to_miss_wti_cmd_req      = false;
     515        r_miss_wti_rsp_to_dma_rsp_req  = false;
     516
     517        // error flip_flops
     518        r_miss_wti_rsp_error_miss      = false;
     519        r_miss_wti_rsp_error_wti       = false;
    468520
    469521        // Debug variable
    470                 m_debug_activated               = false;
     522                m_debug_activated                  = false;
    471523       
    472         for ( size_t n=0 ; n<32 ; n++ )
    473         {
    474             r_irq_pending[n]        = false;
    475             r_irq_request[n]        = false;
    476         }
    477          
    478524            // activity counters
    479             m_cpt_total_cycles            = 0;
    480         m_cpt_iotlb_read              = 0;             
    481         m_cpt_iotlb_miss              = 0;             
    482         m_cpt_iotlbmiss_transaction   = 0;   
    483         m_cost_iotlbmiss_transaction  = 0;   
     525            m_cpt_total_cycles             = 0;
     526        m_cpt_iotlb_read               = 0;             
     527        m_cpt_iotlb_miss               = 0;             
     528        m_cpt_iotlbmiss_transaction    = 0;   
     529        m_cost_iotlbmiss_transaction   = 0;   
    484530       
    485         m_cpt_trt_dma_full            = 0;
    486         m_cpt_trt_dma_full_cost       = 0;
    487         m_cpt_trt_config_full         = 0;
    488         m_cpt_trt_config_full_cost    = 0;
     531        m_cpt_trt_dma_full             = 0;
     532        m_cpt_trt_dma_full_cost        = 0;
     533        m_cpt_trt_config_full          = 0;
     534        m_cpt_trt_config_full_cost     = 0;
    489535
    490536        for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_dma_cmd            [i]   = 0;
     
    493539        for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_config_cmd         [i]   = 0;
    494540        for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_config_rsp         [i]   = 0;
    495         for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_miss_wti_cmd       [i]   = 0;
    496541        for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_miss_wti_rsp       [i]   = 0;
    497542
     
    499544    }
    500545
    501     // default values for FIFOs
    502     bool        dma_cmd_fifo_put      = false;
    503     bool        dma_cmd_fifo_get      = false;
    504 
    505     bool        dma_rsp_fifo_put      = false;
    506     bool        dma_rsp_fifo_get      = false;
     546    // default values for the 5 FIFOs
     547    bool            dma_cmd_fifo_put          = false;
     548    bool            dma_cmd_fifo_get          = p_vci_ini_ram.cmdack.read();
    507549   
    508     bool        config_cmd_fifo_put   = false;
    509     bool        config_cmd_fifo_get   = false;
    510 
    511     bool        config_rsp_fifo_put   = false;
    512     bool        config_rsp_fifo_get   = false;
     550    bool            dma_rsp_fifo_put          = false;
     551    bool            dma_rsp_fifo_get          = p_vci_tgt_iox.rspack.read();
     552    vci_rerror_t    dma_rsp_fifo_rerror       = 0;
     553    vci_srcid_t     dma_rsp_fifo_rsrcid       = 0;
     554    vci_trdid_t     dma_rsp_fifo_rtrdid       = 0;
     555    vci_pktid_t     dma_rsp_fifo_rpktid       = 0;
     556    ext_data_t      dma_rsp_fifo_rdata        = 0;
     557    bool            dma_rsp_fifo_reop         = false;
     558
     559    bool            config_cmd_fifo_put       = false;
     560    bool            config_cmd_fifo_get       = p_vci_ini_iox.cmdack.read();
     561
     562    bool            config_rsp_fifo_put       = false;
     563    bool            config_rsp_fifo_get       = p_vci_tgt_int.rspack.read();
     564    vci_rerror_t    config_rsp_fifo_rerror    = 0;
     565    vci_srcid_t     config_rsp_fifo_rsrcid    = 0;
     566    vci_trdid_t     config_rsp_fifo_rtrdid    = 0;
     567    vci_pktid_t     config_rsp_fifo_rpktid    = 0;
     568    ext_data_t      config_rsp_fifo_rdata     = 0;
     569    bool            config_rsp_fifo_reop      = false;
     570
     571    bool            miss_wti_cmd_fifo_put     = false;
     572    bool            miss_wti_cmd_fifo_get     = p_vci_ini_int.cmdack.read();
     573    vci_addr_t      miss_wti_cmd_fifo_address = 0;
     574    vci_cmd_t       miss_wti_cmd_fifo_cmd     = 0;
     575    vci_srcid_t     miss_wti_cmd_fifo_srcid   = 0;
     576    vci_trdid_t     miss_wti_cmd_fifo_trdid   = 0;
     577    vci_pktid_t     miss_wti_cmd_fifo_pktid   = 0;
     578    int_data_t      miss_wti_cmd_fifo_wdata   = 0;
    513579
    514580#ifdef INSTRUMENTATION
     
    518584    m_cpt_fsm_config_cmd            [r_config_cmd_fsm.read() ] ++;
    519585    m_cpt_fsm_config_rsp            [r_config_rsp_fsm.read() ] ++;
    520     m_cpt_fsm_miss_wti_cmd      [r_miss_wti_cmd_fsm.read() ] ++;
    521586    m_cpt_fsm_miss_wti_rsp      [r_miss_wti_rsp_fsm.read() ] ++;
    522587#endif
     
    527592
    528593    //////////////////////////////////////////////////////////////////////////////
    529     // The DMA_CMD_FSM handles DMA transactions requested by peripherals
    530     // It makes the address translation if IOMMU is activated.
     594    // The DMA_CMD_FSM handles transactions requested by peripherals.
     595    // - it can be DMA transactions to RAM network (DMA_REQ state).
     596    // - it can be WTI transactions to INT network (EXT_WTI_REQ state).
     597    // It makes the address translation if IOMMU is activated, requesting
     598    // the TLB_MISS FSM in case of TLB miss (TLB_MISS_WAIT state).
     599    // When the IOMMU is activated, a DMA request can fail in two cases:
     600    // - write to a read-only address : detected in IDLE state
     601    // - virtual address unmapped     : detected in MISS_WAIT state
     602    // In both cases of violation, the DMA_CMD FSM makes the following actions :
     603    // 1. register the error in r_iommu_*** registers
     604    // 2. wait the faulty command EOP (ERR_WAIT_EOP state)
     605    // 3. request a IOMMU WTI to MISS_WTI FSM, (ERR_WTI_REQ state)
     606    // 4. request a response error to DMA_RSP FSM (ERR_RSP_REQ state)
    531607    ///////////////////////////////////////////////////////////////////////////////
    532608
     
    534610    {
    535611    //////////////////
    536     case DMA_CMD_IDLE:  // waiting DMA VCI transaction
    537     {
    538         if ( p_vci_tgt_iox.cmdval.read() ) // compute physical address
     612    case DMA_CMD_IDLE:  // wait a DMA or WTI VCI transaction and route it
     613                        // after an IOMMU translation if IOMMU activated.
     614                        // no VCI flit is consumed in this state
     615    {
     616        if ( p_vci_tgt_iox.cmdval.read() )
    539617        {
    540618            if ( not r_iommu_active.read() )    // tlb not activated
    541619            {
     620                // save paddr address
     621                r_dma_cmd_paddr = p_vci_tgt_iox.address.read();
     622
     623                // analyse paddr for WTI/DMA routing
     624                // WTI requests must be single flit (READ or WRITE)
     625                if ( is_wti( p_vci_tgt_iox.address.read() ) )
     626                {
     627                    assert( p_vci_tgt_iox.eop.read() and
     628                    "ERROR in VCI_IOB illegal VCI WTI command from IOX network");
     629
     630                    r_dma_cmd_fsm = DMA_CMD_WTI_IOX_REQ;
     631                }
     632                else
     633                {
     634                    r_dma_cmd_fsm = DMA_CMD_DMA_REQ;
     635                }
     636
    542637#if DEBUG_DMA_CMD
    543638if( m_debug_activated )
    544 std::cout << "  <IOB DMA_CMD_IDLE> @@@ dma command" << std::endl
    545           << " address = " << std::hex << p_vci_tgt_iox.address.read()
     639std::cout << "  <IOB DMA_CMD_IDLE> DMA command" << std::endl
     640          << " : address = " << std::hex << p_vci_tgt_iox.address.read()
    546641          << " / srcid = " << p_vci_tgt_iox.srcid.read()
    547           << " / trdid = " << p_vci_tgt_iox.trdid.read()
    548642          << " / wdata = " << std::hex << p_vci_tgt_iox.wdata.read()
    549           << " / be = " << p_vci_tgt_iox.be.read()
    550643          << " / plen = " << std::dec << p_vci_tgt_iox.plen.read()
    551644          << " / eop = " << p_vci_tgt_iox.eop.read() << std::endl;
    552 
    553 #endif
    554                 // put DMA transaction into DMA_CMD fifo
    555                 r_dma_cmd_paddr = p_vci_tgt_iox.address.read();
    556                 r_dma_cmd_fsm   = DMA_CMD_FIFO_PUT_CMD;
     645#endif
    557646            }
    558647            else if (r_tlb_fsm.read() == TLB_IDLE ||
     
    581670                        (p_vci_tgt_iox.cmd.read() == vci_param_ext::CMD_WRITE) )
    582671                    {
    583                         // put DMA response error into DMA_RSP fifo
     672                        // register error
    584673                        r_iommu_etr      = MMU_WRITE_ACCES_VIOLATION; 
    585674                        r_iommu_bvar     = p_vci_tgt_iox.address.read();
    586675                        r_iommu_bad_id   = p_vci_tgt_iox.srcid.read();
    587                         r_dma_cmd_fsm    = DMA_CMD_FIFO_PUT_RSP;
     676                       
     677                        // prepare response error request to DMA_RSP FSM
     678                        r_dma_cmd_to_dma_rsp_rsrcid = p_vci_tgt_iox.srcid.read();
     679                        r_dma_cmd_to_dma_rsp_rtrdid = p_vci_tgt_iox.trdid.read();
     680                        r_dma_cmd_to_dma_rsp_rpktid = p_vci_tgt_iox.pktid.read();
     681
     682                        // jumps IOMMU error sequence
     683                        r_dma_cmd_fsm = DMA_CMD_ERR_WAIT_EOP;
    588684#if DEBUG_DMA_CMD
    589685if( m_debug_activated )
     
    597693std::cout << "  <IOB DMA_CMD_IDLE> TLB HIT" << std::endl;
    598694#endif
    599                     // put DMA transaction into DMA_CMD fifo
    600                     r_dma_cmd_paddr   = iotlb_paddr;                   
    601                     r_dma_cmd_fsm     = DMA_CMD_FIFO_PUT_CMD;
     695                        // save paddr address
     696                        r_dma_cmd_paddr = iotlb_paddr;
     697
     698                        // analyse address for WTI/DMA routing
     699                        if ( is_wti( iotlb_paddr ) )
     700                        {
     701                            assert( p_vci_tgt_iox.eop.read() and
     702                                   (p_vci_tgt_iox.cmd == vci_param_int::CMD_WRITE) and
     703                            "ERROR in VCI_IOB illegal VCI WTI command from IOX network");
     704
     705                            r_dma_cmd_fsm   = DMA_CMD_WTI_IOX_REQ;
     706                        }
     707                        else
     708                        {
     709                            r_dma_cmd_fsm = DMA_CMD_DMA_REQ;
     710                        }
    602711                    }
    603712                }
     
    608717m_cpt_iotlb_miss++;
    609718#endif
    610                         // register virtual address, and send request to TLB FSM
    611                                 r_dma_cmd_vaddr = p_vci_tgt_iox.address.read();
    612                         r_dma_tlb_req   = true;
    613                         r_dma_cmd_fsm   = DMA_CMD_MISS_WAIT;
     719                    // register virtual address, and send request to TLB FSM
     720                            r_dma_cmd_to_tlb_vaddr = p_vci_tgt_iox.address.read();
     721                    r_dma_cmd_to_tlb_req   = true;
     722                    r_dma_cmd_fsm          = DMA_CMD_TLB_MISS_WAIT;
    614723#if DEBUG_DMA_CMD
    615724if( m_debug_activated )
    616725std::cout << "  <IOB DMA_CMD_IDLE> TLB MISS" << std::endl;
    617726#endif
    618                 } // end !hit
     727                } // end tlb miss
    619728            } // end if tlb_activated
    620729        } // end if cmdval
    621730        break;
    622731    }
    623     //////////////////////////
    624     case DMA_CMD_FIFO_PUT_CMD:    // put a DMA transaction in DMA_CMD fifo       
    625                                   // if contig, VCI address must be incremented
     732    /////////////////////
     733    case DMA_CMD_DMA_REQ:    // put a flit in DMA_CMD FIFO
     734                             // if contig, VCI address must be incremented
     735                             // after initial translation by IOMMU.
     736                             // flit is consumed if DMA_CMD FIFO not full
    626737    {
    627738        if ( p_vci_tgt_iox.cmdval && m_dma_cmd_addr_fifo.wok() )
     
    639750          << " address = " << std::hex << r_dma_cmd_paddr.read()
    640751          << " srcid = " << p_vci_tgt_iox.srcid.read()
    641           << " trdid = " << p_vci_tgt_iox.trdid.read()
    642752          << " wdata = " << p_vci_tgt_iox.wdata.read()
    643           << " be = " << p_vci_tgt_iox.be.read()
    644           << " contig = " << p_vci_tgt_iox.contig.read()
    645           << " eop = " << std::dec << p_vci_tgt_iox.eop.read()
    646           << " plen = " << std::dec << p_vci_tgt_iox.plen.read() << std::endl;
     753          << " plen = " << std::dec << p_vci_tgt_iox.plen.read()
     754          << " eop = " << std::dec << p_vci_tgt_iox.eop.read() << std::endl;
    647755#endif
    648756        }
    649757        break;
    650758    }
    651     //////////////////////
    652     case DMA_CMD_WAIT_EOP:       // An error has been detected on the VCI DMA command
    653                              // consume the VCI packet before sending the error response
    654     {
    655         if ( p_vci_tgt_iox.eop.read() )    r_dma_cmd_fsm   = DMA_CMD_FIFO_PUT_RSP;
    656         break;
    657     }
    658     //////////////////////////
    659     case DMA_CMD_FIFO_PUT_RSP:   // try to put a response error in DMA_RSP fifo
    660                                  // The FIFO is shared with DMA_RSP FSM
    661                                  // and we must we wait for allocation...
    662     {
    663         if ( r_alloc_fifo_dma_rsp_local.read() )
     759    /////////////////////////
     760    case DMA_CMD_WTI_IOX_REQ:    // post a WTI_IOX request to MISS_WTI FSM
     761                                 // if no prending previous request
     762                                 // command arguments are stored in dedicated registers
     763                                 // VCI flit is consumed if no previous request
     764    {
     765        if ( not r_dma_cmd_to_miss_wti_cmd_req.read() )  // no previous pending request
    664766        {
    665             dma_rsp_fifo_put = true;
    666 
    667             if( m_dma_rsp_data_fifo.wok() )
    668             {
    669 
     767            r_dma_cmd_to_miss_wti_cmd_req   = true;
     768            r_dma_cmd_to_miss_wti_cmd_addr  = p_vci_tgt_iox.address.read();
     769            r_dma_cmd_to_miss_wti_cmd_cmd   = p_vci_tgt_iox.cmd.read();
     770            r_dma_cmd_to_miss_wti_cmd_wdata = (uint32_t)p_vci_tgt_iox.wdata.read();
     771            r_dma_cmd_to_miss_wti_cmd_srcid = p_vci_tgt_iox.srcid.read();
     772            r_dma_cmd_to_miss_wti_cmd_trdid = p_vci_tgt_iox.trdid.read();
     773            r_dma_cmd_to_miss_wti_cmd_pktid = PKTID_WTI_IOX;
     774
     775            r_dma_cmd_fsm = DMA_CMD_IDLE;
     776           
    670777#if DEBUG_DMA_CMD
    671778if( m_debug_activated )
    672 std::cout << "  <IOB DMA_CMD_FIFO_PUT_RSP> Put a response error to a DMA transaction."
    673           << std::endl;
    674 #endif
    675                 r_dma_cmd_fsm = DMA_CMD_IDLE;
    676             }
     779std::cout << "  <IOB DMA_CMD_WTI_IOX_REQ> request WTI transaction from ext peripheral"
     780          << " : address = " << std::hex << r_dma_cmd_paddr.read()
     781          << " / srcid = " << p_vci_tgt_iox.srcid.read()
     782          << " / wdata = " << p_vci_tgt_iox.wdata.read() << std::endl;
     783#endif
    677784        }
    678785        break;
    679786    }
    680     ///////////////////////
    681     case DMA_CMD_MISS_WAIT:  // waiting completion of a TLB miss
    682                              // we must test a possible page fault error...   
    683     {
    684         if ( not r_dma_tlb_req.read() ) // TLB miss completed
     787    //////////////////////////
     788    case DMA_CMD_ERR_WAIT_EOP:   // wait EOP before requesting WTI & error response
     789                                 // VCI flit is always consumed
     790    {
     791        if ( p_vci_tgt_iox.eop.read() ) r_dma_cmd_fsm = DMA_CMD_ERR_WTI_REQ;
     792
     793#if DEBUG_DMA_CMD
     794if( m_debug_activated )
     795std::cout << "  <IOB DMA_CMD_WAIT_EOP> wait EOP for faulty DMA command" << std::endl;
     796#endif
     797        break;
     798    }
     799   
     800    /////////////////////////
     801    case DMA_CMD_ERR_WTI_REQ:    // post a WTI_MMU request to MISS_WTI_CMD FSM
     802                                 // if no prending previous request
     803                                 // response arguments are stored in dedicated registers
     804                                 // no VCI flit is consumed
     805    {
     806        if ( not r_dma_cmd_to_miss_wti_cmd_req.read() )  // no pending previous request
     807        {
     808            r_dma_cmd_to_miss_wti_cmd_req   = true;
     809            r_dma_cmd_to_miss_wti_cmd_addr  = (vci_addr_t)r_iommu_wti_addr_lo.read() |
     810                                              (((vci_addr_t)r_iommu_wti_addr_hi.read())<<32);
     811            r_dma_cmd_to_miss_wti_cmd_wdata = 0;
     812            r_dma_cmd_to_miss_wti_cmd_srcid = m_int_srcid;
     813            r_dma_cmd_to_miss_wti_cmd_trdid = 0;
     814            r_dma_cmd_to_miss_wti_cmd_pktid = PKTID_WTI_MMU;
     815
     816            r_dma_cmd_fsm            = DMA_CMD_ERR_RSP_REQ;
     817
     818#if DEBUG_DMA_CMD
     819if( m_debug_activated )
     820std::cout << "  <IOB DMA_CMD_ERR_WTI_REQ> request an IOMMU WTI" << std::endl;
     821#endif
     822        }
     823        break;
     824    }
     825    /////////////////////////
     826    case DMA_CMD_ERR_RSP_REQ:    // post an error response request to DMA_RSP FSM
     827                                 // if no prending previous request
     828                                 // response arguments are stored in dedicated registers
     829                                 // no VCI flit is consumed
     830    {
     831        if ( not r_dma_cmd_to_dma_rsp_req.read() )  // no pending previous request
     832        {
     833            r_dma_cmd_to_dma_rsp_req    = true;
     834            r_dma_cmd_to_dma_rsp_rerror = 0x1;
     835            r_dma_cmd_to_dma_rsp_rdata  = 0;
     836        }
     837        break;
     838    }
     839    ///////////////////////////
     840    case DMA_CMD_TLB_MISS_WAIT:  // waiting completion of a TLB miss
     841                                 // we must test a possible page fault error...   
     842    {
     843        if ( not r_dma_cmd_to_tlb_req.read() ) // TLB miss completed
    685844        {
    686845            if ( r_tlb_miss_error.read() )   // Error reported by TLB FSM
    687846            {
    688847                r_iommu_etr     = MMU_READ_PT2_UNMAPPED;
    689                 r_iommu_bvar    = r_dma_cmd_vaddr.read();
     848                r_iommu_bvar    = r_dma_cmd_to_tlb_vaddr.read();
    690849                r_iommu_bad_id  = p_vci_tgt_iox.srcid.read();
    691                 r_dma_cmd_fsm   = DMA_CMD_FIFO_PUT_RSP;
     850                r_dma_cmd_fsm   = DMA_CMD_ERR_WAIT_EOP;
    692851            }
    693852            else                            // No error
     
    700859    } // end switch DMA_CMD FSM
    701860
    702     //////////////////////////////////////////////////////////////////////////////
    703     // The DMA_RSP_FSM handles the RAM responses to peripherals DMA transactions.
    704     //////////////////////////////////////////////////////////////////////////////
    705 
    706     switch( r_dma_rsp_fsm.read() )
    707     {
    708     //////////////////
    709     case DMA_RSP_IDLE:  // waiting a response from RAM betwork
    710     {           
    711         if ( p_vci_ini_ram.rspval.read() )
    712                 {
    713                         r_dma_rsp_fsm = DMA_RSP_FIFO_PUT;
    714                 }
    715                 break;
    716     }
    717     //////////////////////
    718     case DMA_RSP_FIFO_PUT:
    719     {
    720         if(p_vci_ini_ram.rspval.read() and not r_alloc_fifo_dma_rsp_local.read() )
    721         {
    722             dma_rsp_fifo_put = true;
    723 
    724             if(p_vci_ini_ram.reop.read())   r_dma_rsp_fsm = DMA_RSP_IDLE;       
     861    ////////////////////////////////////////////////////////////////////////////////
     862    // The DMA_RSP_FSM controls access to the DMA_RSP FIFO to the IOX network.
     863    // There exist 3 "clients" to send VCI responses on the IOX network:
     864    // - request from p_vci_ini_ram    : normal DMA response from RAM network,
     865    // - request from MISS_WTI_RSP FSM : normal WTI response from INT network,
     866    // - request from DMA_CMD FSM      : bad address error response
     867    // This FSM implements a round robin priority, with a "dead cycle" between
     868    // two transactions. It could be optimized if throughput is critical...
     869    ////////////////////////////////////////////////////////////////////////////////
     870
     871    // does nothing if FIFO is full
     872    if ( m_dma_rsp_rerror_fifo.wok() )
     873    {
     874        switch( r_dma_rsp_fsm.read() )
     875        {
     876            //////////////////////
     877            case DMA_RSP_IDLE_DMA:  // normal DMA response has highest priority
     878            {           
     879                if     (p_vci_ini_ram.rspval.read())          r_dma_rsp_fsm = DMA_RSP_PUT_DMA;
     880                else if(r_miss_wti_rsp_to_dma_rsp_req.read()) r_dma_rsp_fsm = DMA_RSP_PUT_WTI;
     881                else if(r_dma_cmd_to_dma_rsp_req.read())      r_dma_rsp_fsm = DMA_RSP_PUT_ERR;
     882                break;
     883            }
     884            //////////////////////
     885            case DMA_RSP_IDLE_WTI:  // normal WTI response has highest priority
     886            {           
     887                if     (r_miss_wti_rsp_to_dma_rsp_req.read()) r_dma_rsp_fsm = DMA_RSP_PUT_WTI;
     888                else if(r_dma_cmd_to_dma_rsp_req.read())      r_dma_rsp_fsm = DMA_RSP_PUT_ERR;
     889                else if(p_vci_ini_ram.rspval.read())          r_dma_rsp_fsm = DMA_RSP_PUT_DMA;
     890                break;
     891            }
     892            //////////////////////
     893            case DMA_RSP_IDLE_ERR:  // error  response has highest priority
     894            {           
     895                if     (r_dma_cmd_to_dma_rsp_req.read())      r_dma_rsp_fsm = DMA_RSP_PUT_ERR;
     896                else if(p_vci_ini_ram.rspval.read())          r_dma_rsp_fsm = DMA_RSP_PUT_DMA;
     897                else if(r_miss_wti_rsp_to_dma_rsp_req.read()) r_dma_rsp_fsm = DMA_RSP_PUT_WTI;
     898                break;
     899            }
     900            ///////////////////////
     901            case DMA_RSP_PUT_DMA:  // put one flit of the DMA response into FIFO
     902            {           
     903                dma_rsp_fifo_put    = true;
     904                dma_rsp_fifo_rerror = p_vci_ini_ram.rerror.read();
     905                dma_rsp_fifo_rdata  = p_vci_ini_ram.rdata.read();
     906                dma_rsp_fifo_rsrcid = p_vci_ini_ram.rsrcid.read();
     907                dma_rsp_fifo_rtrdid = p_vci_ini_ram.rtrdid.read();
     908                dma_rsp_fifo_rpktid = p_vci_ini_ram.rpktid.read();
     909                dma_rsp_fifo_reop   = p_vci_ini_ram.reop.read();
     910
     911                // update priority
     912                if ( p_vci_ini_ram.reop.read() ) r_dma_rsp_fsm = DMA_RSP_IDLE_WTI;
    725913
    726914#if DEBUG_DMA_RSP
    727915if( m_debug_activated )
    728 std::cout << "  <IOB DMA_RSP_FIFO_PUT> Push response into DMA_RSP fifo:"
    729           << " / rsrcid = " << std::hex << p_vci_ini_ram.rsrcid.read()
     916std::cout << "  <IOB DMA_RSP_PUT_DMA> Push DMA response into DMA_RSP FIFO"
     917          << " : rsrcid = " << std::hex << p_vci_ini_ram.rsrcid.read()
    730918          << " / rtrdid = " << p_vci_ini_ram.rtrdid.read()
    731           << " / rdata = " << std::hex << p_vci_ini_ram.rdata.read()
     919          << " / rpktid = " << p_vci_ini_ram.rpktid.read()
     920          << " / rdata = "  << p_vci_ini_ram.rdata.read()
    732921          << " / rerror = " << p_vci_ini_ram.rerror.read()
    733           << " / reop = " << p_vci_ini_ram.reop.read() << std::endl;
    734 #endif
    735         }
    736         break;
    737     }
    738     } // end switch DMA_RSP_FSM
     922          << " / reop = "   << p_vci_ini_ram.reop.read() << std::endl;
     923#endif
     924                break;
     925                    }
     926            ///////////////////////
     927            case DMA_RSP_PUT_WTI:  // put single flit WTI response into FIFO
     928            {           
     929                dma_rsp_fifo_put    = true;
     930                dma_rsp_fifo_rerror = r_miss_wti_rsp_to_dma_rsp_rerror.read();
     931                dma_rsp_fifo_rdata  = 0;
     932                dma_rsp_fifo_rsrcid = r_miss_wti_rsp_to_dma_rsp_rsrcid.read();
     933                dma_rsp_fifo_rtrdid = r_miss_wti_rsp_to_dma_rsp_rtrdid.read();
     934                dma_rsp_fifo_rpktid = r_miss_wti_rsp_to_dma_rsp_rpktid.read();
     935                dma_rsp_fifo_reop   = true;
     936
     937                // acknowledge request
     938                r_miss_wti_rsp_to_dma_rsp_req = false;
     939 
     940                // update priority
     941                r_dma_rsp_fsm = DMA_RSP_IDLE_ERR;
     942
     943#if DEBUG_DMA_RSP
     944if( m_debug_activated )
     945std::cout << "  <IOB DMA_RSP_PUT_WTI> Push WTI response into DMA_RSP FIFO"
     946          << " : rsrcid = " << std::hex << r_miss_wti_rsp_to_dma_rsp_rsrcid.read()
     947          << " / rtrdid = " << r_miss_wti_rsp_to_dma_rsp_rtrdid.read()
     948          << " / rpktid = " << r_miss_wti_rsp_to_dma_rsp_rpktid.read()
     949          << " / rdata = "  << 0
     950          << " / rerror = " << r_miss_wti_rsp_to_dma_rsp_rerror.read()
     951          << " / reop = "   << true << std::endl;
     952#endif
     953                break;
     954            }
     955            ///////////////////////
     956            case DMA_RSP_PUT_ERR:  // put sinfle flit error response into FIFO
     957            {
     958                dma_rsp_fifo_put    = true;
     959                dma_rsp_fifo_rerror = 0x1;
     960                dma_rsp_fifo_rdata  = 0;
     961                dma_rsp_fifo_rsrcid = r_dma_cmd_to_dma_rsp_rsrcid.read();
     962                dma_rsp_fifo_rtrdid = r_dma_cmd_to_dma_rsp_rtrdid.read();
     963                dma_rsp_fifo_rpktid = r_dma_cmd_to_dma_rsp_rpktid.read();
     964                dma_rsp_fifo_reop   = true;
     965
     966                // acknowledge request
     967                r_dma_cmd_to_dma_rsp_req = false;
     968 
     969                // update priority
     970                r_dma_rsp_fsm = DMA_RSP_PUT_DMA;
     971
     972#if DEBUG_DMA_RSP
     973if( m_debug_activated )
     974std::cout << "  <IOB DMA_RSP_PUT_DMA> Push IOMMU ERROR response into DMA_RSP FIFO"
     975          << " : rsrcid = " << std::hex << r_dma_cmd_to_dma_rsp_rsrcid.read()
     976          << " / rtrdid = " << r_dma_cmd_to_dma_rsp_rtrdid.read()
     977          << " / rpktid = " << r_dma_cmd_to_dma_rsp_rpktid.read()
     978          << " / rdata = "  << 0
     979          << " / rerror = " << r_dma_cmd_to_dma_rsp_rerror.read()
     980          << " / reop = "   << true << std::endl;
     981#endif
     982                break;
     983            }
     984                } // end switch DMA_RSP FSM
     985    }  // end if FIFO full
     986
    739987
    740988    //////////////////////////////////////////////////////////////////////////////////
    741     // The TLB FSM handles TLB miss request (from DMA_CMD FSM),
     989    // The TLB FSM handles the TLB miss requests from DMA_CMD FSM,
    742990    // and the PTE inval request (from CONFIG_CMD FSM).
    743991    // PTE inval request have highest priority. In case of TLB miss,
     
    745993    // In case of buffer miss,  it request the MISS_WTI FSM to access the memory.
    746994    // It bypass the first level page table access if possible.
    747     // It reset the r_dma_tlb_req flip-flop to signal TLB miss completion.
     995    // It reset the r_dma_cmd_to_tlb_req flip-flop to signal TLB miss completion.
    748996    // An unexpected, but possible page fault is signaled in r_tlb_miss_error flip_flop.
    749997    ////////////////////////////////////////////////////////////////////////////////////
     
    7551003                     // PTE inval request are handled as unmaskable interrupts
    7561004    {
    757         if ( r_config_tlb_req ) // Request from CONFIG FSM for a PTE invalidation
     1005        if ( r_config_cmd_to_tlb_req.read() ) // Request for a PTE invalidation
    7581006        {
    759             r_config_tlb_req      = false;
    760             r_waiting_transaction = false;
    761             r_tlb_fsm = TLB_INVAL_CHECK;
     1007            r_config_cmd_to_tlb_req  = false;
     1008            r_waiting_transaction    = false;
     1009            r_tlb_fsm                = TLB_INVAL_CHECK;
    7621010        }
    7631011
    764         else if ( r_dma_tlb_req.read() )   // request from DMA_CMD for a TLB Miss
     1012        else if ( r_dma_cmd_to_tlb_req.read() )   // request for a TLB Miss
    7651013        {
    7661014            // Checking prefetch buffer
     
    7691017                if( r_tlb_buf_valid &&         // Hit on prefetch buffer
    7701018                    (r_tlb_buf_vaddr.read() ==
    771                     (r_dma_cmd_vaddr.read()& ~PTE2_LINE_OFFSET & ~K_PAGE_OFFSET_MASK)))
    772                 {
    773                     size_t   pte_offset = (r_dma_cmd_vaddr.read()& PTE2_LINE_OFFSET)>>12;
     1019                    (r_dma_cmd_to_tlb_vaddr.read()& ~PTE2_LINE_OFFSET & ~K_PAGE_OFFSET_MASK)))
     1020                {
     1021                    size_t   pte_offset = (r_dma_cmd_to_tlb_vaddr.read()& PTE2_LINE_OFFSET)>>12;
    7741022                    uint32_t pte_flags  = r_tlb_buf_data[2*pte_offset];
    7751023                    uint32_t pte_ppn    = r_tlb_buf_data[2*pte_offset+1];
     
    7821030                       
    7831031                        r_tlb_miss_error = true;
    784                         r_dma_tlb_req    = false;
     1032                        r_dma_cmd_to_tlb_req    = false;
    7851033#if DEBUG_TLB_MISS
    7861034if ( m_debug_activated )
     
    8101058                if( r_tlb_buf_valid &&         // Hit on prefetch buffer
    8111059                    (r_tlb_buf_vaddr.read() ==
    812                     (r_dma_cmd_vaddr.read()& ~PTE1_LINE_OFFSET & ~M_PAGE_OFFSET_MASK )))
    813                 {
    814                     size_t   pte_offset = (r_dma_cmd_vaddr.read()& PTE1_LINE_OFFSET)>>21;
     1060                    (r_dma_cmd_to_tlb_vaddr.read()& ~PTE1_LINE_OFFSET & ~M_PAGE_OFFSET_MASK )))
     1061                {
     1062                    size_t   pte_offset = (r_dma_cmd_to_tlb_vaddr.read()& PTE1_LINE_OFFSET)>>21;
    8151063                    uint32_t pte_flags  = r_tlb_buf_data[pte_offset];
    8161064                           
     
    8221070                       
    8231071                        r_tlb_miss_error = true;
    824                         r_dma_tlb_req    = false;
     1072                        r_dma_cmd_to_tlb_req    = false;
    8251073#if DEBUG_TLB_MISS
    8261074if ( m_debug_activated )
     
    8511099if ( m_debug_activated )
    8521100std::cout << "  <IOB TLB_IDLE> Miss on prefetch buffer"
    853           << std::hex << " / vaddr = " << r_dma_cmd_vaddr.read() << std::endl;
     1101          << std::hex << " / vaddr = " << r_dma_cmd_to_tlb_vaddr.read() << std::endl;
    8541102#endif
    8551103        }
     
    8671115#endif
    8681116        // evaluate bypass in order to skip first level page table access
    869         bypass = r_iotlb.get_bypass(r_dma_cmd_vaddr.read(), &ptba);
     1117        bypass = r_iotlb.get_bypass(r_dma_cmd_to_tlb_vaddr.read(), &ptba);
    8701118       
    8711119        // Request MISS_WTI_FSM a transaction on INT Network
     
    8781126#endif
    8791127            pte_paddr = (vci_addr_t)((r_iommu_ptpr.read()) << (INDEX1_NBITS+2)) |
    880                         (vci_addr_t)((r_dma_cmd_vaddr.read() >> PAGE_M_NBITS) << 2);
     1128                        (vci_addr_t)((r_dma_cmd_to_tlb_vaddr.read() >> PAGE_M_NBITS) << 2);
    8811129            r_tlb_paddr = pte_paddr;
    8821130           
    883             r_tlb_miss_req    = true;
    884             r_tlb_miss_type    = PTE1_MISS;
    885             r_tlb_fsm          = TLB_WAIT;
     1131            r_tlb_to_miss_wti_cmd_req = true;
     1132            r_tlb_miss_type           = PTE1_MISS;
     1133            r_tlb_fsm                 = TLB_WAIT;
    8861134        }
    8871135        else                  // Read PTE2 in XRAM
     
    8941142            //&PTE2 = PTBA + IX2 * 8
    8951143            pte_paddr = (vci_addr_t)ptba << PAGE_K_NBITS |
    896                         (vci_addr_t)(r_dma_cmd_vaddr.read()&PTD_ID2_MASK)>>(PAGE_K_NBITS-3);
     1144                        (vci_addr_t)(r_dma_cmd_to_tlb_vaddr.read()&PTD_ID2_MASK)>>(PAGE_K_NBITS-3);
    8971145           
    8981146            r_tlb_paddr = pte_paddr;
    8991147           
    900             r_tlb_miss_req    = true;
    901             r_tlb_miss_type    = PTE2_MISS;
    902             r_tlb_fsm          = TLB_WAIT;
     1148            r_tlb_to_miss_wti_cmd_req = true;
     1149            r_tlb_miss_type           = PTE2_MISS;
     1150            r_tlb_fsm                 = TLB_WAIT;
    9031151        }
    9041152
     
    9291177                       
    9301178            r_tlb_miss_error       = true;
    931             r_dma_tlb_req         = false;
    932             r_tlb_fsm             = TLB_IDLE;           
     1179            r_dma_cmd_to_tlb_req   = false;
     1180            r_tlb_fsm              = TLB_IDLE;           
    9331181
    9341182#if DEBUG_TLB_MISS
     
    9461194        {
    9471195            // register bypass
    948             r_iotlb.set_bypass( r_dma_cmd_vaddr.read(),
     1196            r_iotlb.set_bypass( r_dma_cmd_to_tlb_vaddr.read(),
    9491197                                entry & ((1 << (vci_param_int::N-PAGE_K_NBITS)) - 1),
    9501198                                0); //nline, unused
    9511199
    952             //&PTE2 = PTBA + IX2 * 8
     1200            // &PTE2 = PTBA + IX2 * 8
    9531201            // ps: PAGE_K_NBITS corresponds also to the size of a second level page table
    9541202            r_tlb_paddr = (vci_addr_t)(entry & ((1<<(vci_param_int::N-PAGE_K_NBITS))-1)) << PAGE_K_NBITS |
    955                                 (vci_addr_t)(((r_dma_cmd_vaddr.read() & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3);
    956             r_tlb_miss_req     = true;
    957             r_tlb_miss_type    = PTE2_MISS;
    958             r_tlb_fsm          = TLB_WAIT;
     1203                                (vci_addr_t)(((r_dma_cmd_to_tlb_vaddr.read() & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3);
     1204
     1205            r_tlb_to_miss_wti_cmd_req = true;
     1206            r_tlb_miss_type           = PTE2_MISS;
     1207            r_tlb_fsm                 = TLB_WAIT;
    9591208
    9601209#ifdef INSTRUMENTATION
     
    9901239        size_t  set;
    9911240       
    992         r_iotlb.select(  r_dma_cmd_vaddr.read(),
     1241        r_iotlb.select(  r_dma_cmd_to_tlb_vaddr.read(),
    9931242                        true,  // PTE1
    9941243                        &way,
     
    10161265       
    10171266        r_tlb_paddr = (vci_addr_t)( ((r_tlb_pte_flags.read() & PPN1_MASK) << 21)
    1018                         | (r_dma_cmd_vaddr.read()& M_PAGE_OFFSET_MASK) );
     1267                        | (r_dma_cmd_to_tlb_vaddr.read()& M_PAGE_OFFSET_MASK) );
    10191268       
    10201269        // update TLB
     
    10221271                      pte,
    10231272                      0,                // argument unused for a PTE1
    1024                       r_dma_cmd_vaddr.read(),   
     1273                      r_dma_cmd_to_tlb_vaddr.read(),   
    10251274                      r_tlb_way.read(),
    10261275                      r_tlb_set.read(),
    10271276                      0 );      //we set nline = 0
     1277
    10281278#ifdef INSTRUMENTATION
    10291279m_cpt_iotlb_write++;
     
    10661316                       
    10671317            r_tlb_miss_error       = true;
    1068             r_dma_tlb_req         = false;
     1318            r_dma_cmd_to_tlb_req         = false;
    10691319            r_tlb_fsm             = TLB_IDLE;           
    10701320
     
    10961346        size_t set;
    10971347
    1098         r_iotlb.select( r_dma_cmd_vaddr.read(),
     1348        r_iotlb.select( r_dma_cmd_to_tlb_vaddr.read(),
    10991349                        false,  // PTE2
    11001350                        &way,
     
    11061356#if DEBUG_TLB_MISS
    11071357if ( m_debug_activated )
    1108 {
    1109         std::cout << "  <IOB TLB_PTE2_SELECT> Select a slot in IOTLB:";
    1110         std::cout << " way = " << std::dec << way
    1111                   << " / set = " << set << std::endl;
    1112 }
     1358std::cout << "  <IOB TLB_PTE2_SELECT> Select a slot in IOTLB:"
     1359          << " way = " << std::dec << way
     1360          << " / set = " << set << std::endl;
    11131361#endif
    11141362        r_tlb_way = way;
     
    11251373       
    11261374        r_tlb_paddr = (vci_addr_t)( ((r_tlb_pte_ppn.read() & PPN2_MASK) << 12)
    1127                         | (r_dma_cmd_vaddr.read()& K_PAGE_OFFSET_MASK) );
     1375                        | (r_dma_cmd_to_tlb_vaddr.read()& K_PAGE_OFFSET_MASK) );
    11281376       
    11291377        // update TLB for a PTE2
     
    11311379                       pte_flags,
    11321380                       pte_ppn,
    1133                        r_dma_cmd_vaddr.read(),   
     1381                       r_dma_cmd_to_tlb_vaddr.read(),   
    11341382                       r_tlb_way.read(),
    11351383                       r_tlb_set.read(),
     
    11421390if ( m_debug_activated )
    11431391{
    1144         std::cout << "  <IOB TLB_PTE2_UPDT> write PTE2 in IOTLB";
    1145         std::cout << " / set = " << std::dec << r_tlb_set.read()
    1146                   << " / way = " << r_tlb_way.read() << std::endl;
    1147         r_iotlb.printTrace();
     1392std::cout << "  <IOB TLB_PTE2_UPDT> write PTE2 in IOTLB"
     1393          << " / set = " << std::dec << r_tlb_set.read()
     1394          << " / way = " << r_tlb_way.read() << std::endl;
     1395r_iotlb.printTrace();
    11481396}
    11491397#endif
     
    11561404                     // PTE inval request are handled as unmaskable interrupts
    11571405    {
    1158         if ( r_config_tlb_req ) // Request from CONFIG FSM for a PTE invalidation
     1406        if ( r_config_cmd_to_tlb_req.read() ) // Request for a PTE invalidation
    11591407        {
    1160             r_config_tlb_req = false;
    1161             r_waiting_transaction = true;
    1162             r_tlb_fsm = TLB_INVAL_CHECK;
     1408            r_config_cmd_to_tlb_req = false;
     1409            r_waiting_transaction   = true;
     1410            r_tlb_fsm               = TLB_INVAL_CHECK;
    11631411        }
    11641412
     
    11661414m_cost_iotlbmiss_transaction++;
    11671415#endif
    1168         if ( not r_tlb_miss_req )       //  Miss transaction is done
     1416        if ( not r_tlb_to_miss_wti_cmd_req.read() )     //  Miss transaction completed
    11691417        {
    1170                 if ( r_miss_wti_rsp_error.read() ) // bus error
     1418                if ( r_miss_wti_rsp_error_miss.read() ) // bus error reported
    11711419                {
    1172                 r_miss_wti_rsp_error = false;
    1173                 r_tlb_miss_error     = true;
    1174                 r_dma_tlb_req        = false;
    1175                 r_tlb_fsm            = TLB_IDLE;
     1420                r_miss_wti_rsp_error_miss = false;
     1421                r_tlb_miss_error          = true;
     1422                r_dma_cmd_to_tlb_req      = false;
     1423                r_tlb_fsm                 = TLB_IDLE;
    11761424            }
    11771425            else if(r_tlb_miss_type == PTE1_MISS)
     
    11871435    }
    11881436    ////////////////
    1189     case TLB_RETURN:            // reset r_dma_tlb_req flip-flop to signal TLB miss completion
    1190                             // possible errors are signaled through r_tlb_miss_error
     1437    case TLB_RETURN:   // reset r_dma_cmd_to_tlb_req to signal TLB miss completion
     1438                       // possible errors are signaled through r_tlb_miss_error
    11911439    {
    11921440#if DEBUG_TLB_MISS
     
    11941442std::cout << "  <IOB TLB_RETURN> IOTLB MISS completed" << std::endl;
    11951443#endif
    1196         r_dma_tlb_req  = false;
     1444        r_dma_cmd_to_tlb_req  = false;
    11971445        r_tlb_fsm = TLB_IDLE;
    11981446        break;
     
    12101458            {
    12111459               if( r_tlb_buf_vaddr.read() ==
    1212                    (r_config_cmd_inval_vaddr.read()& ~PTE2_LINE_OFFSET) )
     1460                   (r_config_cmd_to_tlb_vaddr.read()& ~PTE2_LINE_OFFSET) )
    12131461                // The virtual address corresponds to one entry on the buffer line
    12141462                {
     
    12191467            {
    12201468               if( r_tlb_buf_vaddr.read() ==
    1221                    (r_config_cmd_inval_vaddr.read()& ~PTE1_LINE_OFFSET) )
     1469                   (r_config_cmd_to_tlb_vaddr.read()& ~PTE1_LINE_OFFSET) )
    12221470                // The virtual address corresponds to one entry on the buffer line
    12231471                {
     
    12291477        // Invalidation on IOTLB
    12301478        bool    ok;
    1231         ok = r_iotlb.inval(r_config_cmd_inval_vaddr.read());
     1479        ok = r_iotlb.inval(r_config_cmd_to_tlb_vaddr.read());
    12321480         
    12331481        if(r_waiting_transaction.read()) r_tlb_fsm =TLB_WAIT;
     
    12391487    ////////////////////////////////////////////////////////////////////////////////
    12401488    // The CONFIG_CMD_FSM handles the VCI commands from the INT network.
    1241     // This FSM can handle single flit config transactions, but it can also handle
    1242     // software driven, multi-flits data transactions to ROM (read) or FBF (write).
     1489    // - it can be single flit config transactions
     1490    // - it can be multi-flits data transactions to ROM (read) or FBF (write).
    12431491    // The write burst transactions must be serialised from 32 to 64 bits width.
    12441492    // The configuration requests can be local (IO_BRIDGE config registers)
    12451493    // or remote (config registers of peripherals on IOX network).
    1246     // - The local configuration segment is identified by the "special" atribute.
     1494    // - The local configuration segment is identified by the "special" atribute
     1495    //   in the mapping table.
    12471496    // - All configuration requests are checkeg against segmentation violation.
    12481497    // - In case of local config request, or in case of segmentation violation,
    1249     //   the FSM put a VCI response request in CONFIG_RSP fifo.
     1498    //   the FSM send a response request to CONFIG_RSP FSM.
    12501499    // - In case of remote transaction, it put the VCI command in CONFIG_CMD fifo,
    12511500    //   and this require two cycles per IOX flit in case of write burst.
     
    12961545
    12971546                assert( (p_vci_tgt_int.be.read() == 0xF) and
    1298                 "ERROR in vci_io_bridge : BE != 0xF for a config access");
     1547                "ERROR in vci_io_bridge : BE must be 0xF for a config access");
    12991548
    13001549                assert( ( eop ) and
     
    13071556                else if ( read && (cell == IOB_IOMMU_PTPR) )      // READ PTPR
    13081557                {
    1309                     r_config_cmd_rdata = r_iommu_ptpr.read();
     1558                    r_config_cmd_to_config_rsp_rdata = r_iommu_ptpr.read();
    13101559                }
    13111560                else if( not read && (cell == IOB_WTI_ENABLE))  // WRITE WTI_ENABLE
     
    13151564                else if( read && (cell == IOB_WTI_ENABLE))       // READ WTI ENABLE
    13161565                {
    1317                     r_config_cmd_rdata = r_iommu_wti_enable.read();
     1566                    r_config_cmd_to_config_rsp_rdata = r_iommu_wti_enable.read();
    13181567                }
    13191568                else if( read && (cell == IOB_IOMMU_BVAR))        // READ BVAR
    13201569                {
    1321                     r_config_cmd_rdata = r_iommu_bvar.read();
     1570                    r_config_cmd_to_config_rsp_rdata = r_iommu_bvar.read();
    13221571                }
    13231572                else if( read && (cell == IOB_IOMMU_ETR))          // READ ETR
    13241573                {
    1325                     r_config_cmd_rdata = r_iommu_etr.read();
     1574                    r_config_cmd_to_config_rsp_rdata = r_iommu_etr.read();
    13261575                }
    13271576                else if( read && (cell == IOB_IOMMU_BAD_ID))      // READ BAD_ID
    13281577                {
    1329                     r_config_cmd_rdata = r_iommu_bad_id.read();
     1578                    r_config_cmd_to_config_rsp_rdata = r_iommu_bad_id.read();
    13301579                }
    13311580                else if( not read && (cell == IOB_INVAL_PTE))     // WRITE INVAL_PTE
    13321581                {
    1333                     r_config_tlb_req         = true;
    1334                     r_config_cmd_inval_vaddr = (uint32_t)p_vci_tgt_int.wdata.read();
     1582                    r_config_cmd_to_tlb_req   = true;
     1583                    r_config_cmd_to_tlb_vaddr = (uint32_t)p_vci_tgt_int.wdata.read();
    13351584                }
    13361585                else if( not read && (cell == IOB_WTI_ADDR_LO)) // WRITE WTI_PADDR_LO
    13371586                {
    1338                     r_iommu_wti_paddr = (vci_addr_t)p_vci_tgt_int.wdata.read();
     1587                    r_iommu_wti_addr_lo = (vci_addr_t)p_vci_tgt_int.wdata.read();
    13391588                }
    13401589                else if( read && (cell == IOB_WTI_ADDR_LO))    // READ WTI_PADDR_LO
    13411590                {
    1342                     r_config_cmd_rdata = (uint32_t)r_iommu_wti_paddr.read();
     1591                    r_config_cmd_to_config_rsp_rdata = r_iommu_wti_addr_lo.read();
    13431592                }
    13441593                else if( not read && (cell == IOB_WTI_ADDR_HI)) // WRITE WTI_PADDR_HI
    13451594                {
    1346                     r_iommu_wti_paddr = (r_iommu_wti_paddr.read() & 0x00000000FFFFFFFFLL) |
    1347                                         ((vci_addr_t)p_vci_tgt_int.wdata.read())<<32;
     1595                    r_iommu_wti_addr_hi = (vci_addr_t)p_vci_tgt_int.wdata.read();
    13481596                }
    13491597                else if( read && (cell == IOB_WTI_ADDR_HI))    // READ WTI_PADDR_HI
    13501598                {
    1351                     r_config_cmd_rdata = (uint32_t)(r_iommu_wti_paddr.read()>>32);
    1352                 }
    1353                 else if( not read && ((cell >= IOB_PERI_WTI_BEGIN)  // WRITE PERI WTI
    1354                           && (cell< (IOB_PERI_WTI_BEGIN + 64))) )
    1355                 {
    1356                     size_t  index = (cell - IOB_PERI_WTI_BEGIN)/2;
    1357                     bool    high  = (cell - IOB_PERI_WTI_BEGIN)%2;
    1358                     if ( high ) r_iommu_peri_wti[index] =          // set 32 MSB bits
    1359                         (r_iommu_peri_wti[index].read() & 0x00000000FFFFFFFFLL) |
    1360                         ((vci_addr_t)p_vci_tgt_int.wdata.read())<<32;
    1361                     else        r_iommu_peri_wti[index] =          // set 32 LSB bits
    1362                          (vci_addr_t)p_vci_tgt_int.wdata.read();
    1363                 }
    1364                 else if( read && ((cell >= IOB_PERI_WTI_BEGIN)      // READ PERI WTI   
    1365                          && (cell< (IOB_PERI_WTI_BEGIN + 64))) )
    1366                 {
    1367                     size_t  index = (cell - IOB_PERI_WTI_BEGIN)/2;
    1368                     bool    high  = (cell - IOB_PERI_WTI_BEGIN)%2;
    1369                     if ( high ) r_config_cmd_rdata =
    1370                                     (uint32_t)(r_iommu_peri_wti[index].read()>>32);
    1371                     else        r_config_cmd_rdata =
    1372                                     (uint32_t)(r_iommu_peri_wti[index].read());
     1599                    r_config_cmd_to_config_rsp_rdata = r_iommu_wti_addr_hi.read();
     1600                }
     1601                else if( not read && (cell == IOB_XICU_BASE)) // WRITE XICU_BASE   
     1602                {
     1603                    r_xicu_base = (vci_addr_t)p_vci_tgt_int.wdata.read();
     1604                }
     1605                else if( read && (cell == IOB_XICU_BASE))    // READ XICU_BASE   
     1606                {
     1607                    r_config_cmd_to_config_rsp_rdata = r_xicu_base.read();
     1608                }
     1609                else if( not read && (cell == IOB_XICU_SIZE)) // WRITE XICU_SIZE   
     1610                {
     1611                    r_xicu_size = (vci_addr_t)p_vci_tgt_int.wdata.read();
     1612                }
     1613                else if( read && (cell == IOB_XICU_SIZE))    // READ XICU_SIZE   
     1614                {
     1615                    r_config_cmd_to_config_rsp_rdata = r_xicu_size.read();
    13731616                }
    13741617                else   // Error: Wrong address, or invalid operation.
     
    13761619                    rerror = true;
    13771620                }
    1378                 r_config_cmd_error = rerror;
    1379                 r_config_cmd_fsm   = CONFIG_CMD_RSP;
     1621                r_config_cmd_to_config_rsp_rerror = rerror;
     1622                r_config_cmd_fsm                 = CONFIG_CMD_RSP;
    13801623            }
    13811624            else if ( found )                            // remote peripheral
     
    14311674            else                                         // out of segment address
    14321675            {
    1433                 r_config_cmd_rdata  = 0;
    1434                 r_config_cmd_error = true;
    1435                 if( eop ) r_config_cmd_fsm = CONFIG_CMD_RSP;
     1676                r_config_cmd_to_config_rsp_rdata  = 0;
     1677                r_config_cmd_to_config_rsp_rerror = true;
     1678                if( eop ) r_config_cmd_fsm        = CONFIG_CMD_RSP;
    14361679            }
    14371680        } // end if cmdval
     
    14601703    }
    14611704    ////////////////////
    1462     case CONFIG_CMD_PUT:   // try to post a command to CONFIG_CMD fifo (to IOX network)
     1705    case CONFIG_CMD_PUT:   // post a command to CONFIG_CMD fifo (to IOX network)
    14631706    {
    14641707        config_cmd_fifo_put = true;
     
    14801723    }
    14811724    ////////////////////
    1482     case CONFIG_CMD_RSP:   // Try to put a response in CONFIG_RSP fifo, for
    1483                            // a local configuration transaction or a segment error.
    1484                            // The FIFO is shared with CONFIG_RSP FSM
    1485                            // and must we wait for allocation...
    1486     {
    1487         if ( r_alloc_fifo_config_rsp_local.read() )
     1725    case CONFIG_CMD_RSP:   // Post a request to CONFIG_RSP FSM,
     1726                           // if no previous pending request.
     1727                           // r_config_cmd_to_config_rsp_rerror
     1728                           // has been set in IDLE state.
     1729    {
     1730        if ( not r_config_cmd_to_config_rsp_req.read() )
    14881731        {
    1489             config_rsp_fifo_put = true;
    1490 
    1491             if ( m_config_rsp_data_fifo.wok() ) 
    1492             {
     1732            r_config_cmd_to_config_rsp_req = true;
    14931733
    14941734#if DEBUG_CONFIG_CMD
    14951735if( m_debug_activated )
    1496 std::cout << "  <IOB CONFIG_CMD_RSP> Response to a local configuration request"
    1497           << std::endl;
    1498 #endif
    1499                 r_config_cmd_fsm = CONFIG_CMD_IDLE;
    1500             }
     1736std::cout << "  <IOB CONFIG_CMD_RSP> Request a response to CONFIG_RSP FSM"
     1737          << " / error = " << r_config_cmd_to_config_rsp_rerror.read() << std::endl;
     1738#endif
     1739            r_config_cmd_fsm = CONFIG_CMD_IDLE;
    15011740        }
    15021741        break;
     
    15051744
    15061745    //////////////////////////////////////////////////////////////////////////////
    1507     // The CONFIG_RSP_FSM handles the 64 bits VCI responses from the periherals
    1508     // on the IOX network and  writes the responses in the CONFIG_RSP fifo.
    1509     // This FSM handle both single flit config responses, and multi-flits
    1510     // read responses (ROM), where data must be serialised (64 bits -> 32 bits).
     1746    // The CONFIG_RSP_FSM controls access to the CONFIG_RSP FIFO to INT network.
     1747    // It implements a round robin priority between 2 clients FSMs :
     1748    // - CONFIG_CMD : response to a local config command.
     1749    // - CONFIG_RSP : responses from peripherals on IOX network
     1750    // Regarding the responses from IOX network it handles both single flit
     1751    // config responses, and multi-flits read responses (ROM), where data must
     1752    // be serialised (64 bits -> 32 bits).
    15111753    // Note: We use the VCI RPKTID field to distinguish between read cached
    15121754    // (multi-flits response) and others (single flit response).
     
    15141756    //////////////////////////////////////////////////////////////////////////////
    15151757
    1516     switch( r_config_rsp_fsm.read() )
    1517     {
    1518     /////////////////////
    1519     case CONFIG_RSP_IDLE:  // waiting a VCI response from IOX network
    1520                            // flit on IOX network is not consumed
    1521     {           
    1522         if ( p_vci_ini_iox.rspval.read() )
    1523                 {
    1524             if ( (p_vci_ini_iox.rpktid.read() & 0x5) == 0x1 )   // multi-flits response
     1758    // does nothing if FIFO full
     1759    if ( m_config_rsp_rerror_fifo.wok() )
     1760    {
     1761        switch( r_config_rsp_fsm.read() )
     1762        {
     1763            /////////////////////////
     1764            case CONFIG_RSP_IDLE_IOX:  // IOX requests have highest priority
     1765                                       // no flit on IOX network is consumed
     1766            {           
     1767                if ( p_vci_ini_iox.rspval.read() )  // IOX request
     1768                    {
     1769                    if ( (p_vci_ini_iox.rpktid.read() & 0x5) == 0x1 )   // multi-flits
     1770                    {
     1771                        r_config_rsp_fsm   = CONFIG_RSP_PUT_LOW;
     1772                    }
     1773                    else                                                // single flit   
     1774                    {
     1775                        r_config_rsp_fsm   = CONFIG_RSP_PUT_UNC;
     1776                    }
     1777                    }
     1778                else if ( r_config_cmd_to_config_rsp_req.read() ) // LOC request
     1779                {
     1780                    r_config_rsp_fsm = CONFIG_RSP_PUT_LOC;
     1781                }
     1782                    break;
     1783            }
     1784            /////////////////////////
     1785            case CONFIG_RSP_IDLE_LOC:  // LOC requests have highest priority
     1786                                       // no flit on IOX network is consumed
     1787            {           
     1788                if ( r_config_cmd_to_config_rsp_req.read() ) // LOC request
     1789                {
     1790                    r_config_rsp_fsm = CONFIG_RSP_PUT_LOC;
     1791                }
     1792                else if ( p_vci_ini_iox.rspval.read() ) // IOX request
     1793                    {
     1794                    if ( (p_vci_ini_iox.rpktid.read() & 0x5) == 0x1 )   // multi-flits
     1795                    {
     1796                        r_config_rsp_fsm   = CONFIG_RSP_PUT_LOW;
     1797                    }
     1798                    else                                                // single flit   
     1799                    {
     1800                        r_config_rsp_fsm   = CONFIG_RSP_PUT_UNC;
     1801                    }
     1802                    }
     1803                break;
     1804            }
     1805            ////////////////////////
     1806            case CONFIG_RSP_PUT_LOW:   // put 32 low bits into CONFIG_RSP fifo
     1807                                       // no flit on IOX network is consumed
    15251808            {
    1526                 r_config_rsp_fsm   = CONFIG_RSP_PUT_LO;
    1527             }
    1528             else                                                // single flit response
    1529             {
    1530                 r_config_rsp_fsm   = CONFIG_RSP_PUT_UNC;
    1531                
    1532                 assert(  p_vci_ini_iox.reop.read() and
    1533                 "ERROR in vci_io_bridge : a remote config response should be one flit");
    1534             }
    1535                 }
    1536                 break;
    1537     }
    1538     ///////////////////////
    1539     case CONFIG_RSP_PUT_LO:   // try to write 32 low bits into CONFIG_RSP fifo
    1540                               // flit on IOX network is not consumed
    1541     {
    1542         if ( not r_alloc_fifo_config_rsp_local.read() and  m_config_rsp_data_fifo.wok() )       
    1543         {
    1544             r_config_rsp_fsm   = CONFIG_RSP_PUT_HI;
     1809                config_rsp_fifo_put    = true;
     1810                config_rsp_fifo_rerror = p_vci_ini_iox.rerror.read();
     1811                config_rsp_fifo_rdata  = (uint32_t)p_vci_ini_iox.rdata.read();
     1812                config_rsp_fifo_rsrcid = p_vci_ini_iox.rsrcid.read();
     1813                config_rsp_fifo_rtrdid = p_vci_ini_iox.rtrdid.read();
     1814                config_rsp_fifo_rpktid = p_vci_ini_iox.rpktid.read();
     1815                config_rsp_fifo_reop   = false;
     1816
     1817                r_config_rsp_fsm   = CONFIG_RSP_PUT_HI;
    15451818
    15461819#if DEBUG_CONFIG_RSP
    15471820if( m_debug_activated )
    1548 std::cout << "  <IOB CONFIG_RSP_PUT_LO> Push multi-flit response into CONFIG_RSP fifo:"
     1821std::cout << "  <IOB CONFIG_RSP_PUT_LOW> Push multi-flit response into CONFIG_RSP FIFO"
    15491822          << " / rsrcid = " << std::hex << p_vci_ini_iox.rsrcid.read()
    15501823          << " / rtrdid = " << p_vci_ini_iox.rtrdid.read()
     
    15541827          << " / rerror = " << p_vci_ini_iox.rerror.read() << std::endl;
    15551828#endif
    1556         }
    1557         break;
    1558     }
    1559     ///////////////////////
    1560     case CONFIG_RSP_PUT_HI:    // try to write 32 high bits into CONFIG_RSP fifo
    1561                                // flit on IOX network is consumed if success
    1562     {
    1563         if ( not r_alloc_fifo_config_rsp_local.read() and  m_config_rsp_data_fifo.wok() )       
    1564         {
    1565             if( p_vci_ini_iox.reop.read() )    r_config_rsp_fsm = CONFIG_RSP_IDLE;
    1566             else                               r_config_rsp_fsm = CONFIG_RSP_PUT_LO;
     1829                break;
     1830            }
     1831            ///////////////////////
     1832            case CONFIG_RSP_PUT_HI:    // put 32 high bits into CONFIG_RSP fifo
     1833                                   // flit on IOX network is consumed
     1834            {
     1835                config_rsp_fifo_put    = true;
     1836                config_rsp_fifo_rerror = p_vci_ini_iox.rerror.read();
     1837                config_rsp_fifo_rdata  = (uint32_t)(p_vci_ini_iox.rdata.read() >> 32);
     1838                config_rsp_fifo_rsrcid = p_vci_ini_iox.rsrcid.read();
     1839                config_rsp_fifo_rtrdid = p_vci_ini_iox.rtrdid.read();
     1840                config_rsp_fifo_rpktid = p_vci_ini_iox.rpktid.read();
     1841                config_rsp_fifo_reop   = p_vci_ini_iox.reop.read();
     1842
     1843                if( p_vci_ini_iox.reop.read() ) r_config_rsp_fsm = CONFIG_RSP_IDLE_LOC;
     1844                else                            r_config_rsp_fsm = CONFIG_RSP_PUT_LOW;
    15671845
    15681846#if DEBUG_CONFIG_RSP
    15691847if( m_debug_activated )
    1570 std::cout << "  <IOB CONFIG_RSP_PUT_HI> Push multi-flit response into CONFIG_RSP fifo:"
     1848std::cout << "  <IOB CONFIG_RSP_PUT_HI> Push multi-flit response into CONFIG_RSP FIFO"
    15711849          << " / rsrcid = " << std::hex << p_vci_ini_iox.rsrcid.read()
    15721850          << " / rtrdid = " << p_vci_ini_iox.rtrdid.read()
    15731851          << " / rpktid = " << p_vci_ini_iox.rpktid.read()
    1574           << " / rdata = " << (uint32_t)(p_vci_ini_iox.rdata.read()>>32)
     1852          << " / rdata = " << (uint32_t)(p_vci_ini_iox.rdata.read() >> 32)
    15751853          << " / reop  = " << p_vci_ini_iox.reop.read()
    15761854          << " / rerror = " << p_vci_ini_iox.rerror.read() << std::endl;
    15771855#endif
    1578         }
    1579         break;
    1580     }
    1581     ////////////////////////
    1582     case CONFIG_RSP_PUT_UNC:   // try to write single flit into CONFIG_RSP fifo
    1583                                // flit on IOX network is consumed if success
    1584     {
    1585         if ( not r_alloc_fifo_config_rsp_local.read() and  m_config_rsp_data_fifo.wok() )       
    1586         {
    1587             r_config_rsp_fsm   = CONFIG_RSP_IDLE;
     1856                break;
     1857            }
     1858            ////////////////////////
     1859            case CONFIG_RSP_PUT_UNC:   // put single flit into CONFIG_RSP fifo
     1860                                       // flit on IOX network is consumed
     1861            {
     1862                assert(  p_vci_ini_iox.reop.read() and
     1863                "ERROR in vci_io_bridge : a remote config response should be one flit");
     1864
     1865                config_rsp_fifo_put    = true;
     1866                config_rsp_fifo_rerror = p_vci_ini_iox.rerror.read();
     1867                config_rsp_fifo_rdata  = (uint32_t)p_vci_ini_iox.rdata.read();
     1868                config_rsp_fifo_rsrcid = p_vci_ini_iox.rsrcid.read();
     1869                config_rsp_fifo_rtrdid = p_vci_ini_iox.rtrdid.read();
     1870                config_rsp_fifo_rpktid = p_vci_ini_iox.rpktid.read();
     1871                config_rsp_fifo_reop   = true;
     1872
     1873                // update priority
     1874                r_config_rsp_fsm   = CONFIG_RSP_IDLE_LOC;
    15881875
    15891876#if DEBUG_CONFIG_RSP
    15901877if( m_debug_activated )
    1591 std::cout << "  <IOB CONFIG_RSP_PUT_UNC> Push single flit response into CONFIG_RSP fifo:"
     1878std::cout << "  <IOB CONFIG_RSP_PUT_UNC> Push single flit response into CONFIG_RSP FIFO"
    15921879          << " / rsrcid = " << std::hex << p_vci_ini_iox.rsrcid.read()
    15931880          << " / rtrdid = " << p_vci_ini_iox.rtrdid.read()
     
    15971884          << " / rerror = " << p_vci_ini_iox.rerror.read() << std::endl;
    15981885#endif
    1599         }
    1600         break;
    1601     }
    1602     } // end switch CONFIG_RSP FSM
    1603 
    1604     /////////////////////////////////////////////////////////////////////////////////
    1605     // If the IOB component has IRQ ports, the IRQ FSM detects all changes
    1606     // on the 32 p_irq[i] ports and request a VCI write transaction to the
    1607     // MISS_INIT FSM, using the 64 r_irq_request[i] and r_irq_pending[i] flip-flops.
    1608     /////////////////////////////////////////////////////////////////////////////////
    1609 
    1610     if ( m_has_irqs )
    1611     {
    1612         for ( size_t i = 0; i<32; ++i )
    1613         {
    1614             r_irq_request[i] = ( p_irq[i]->read() == not r_irq_pending[i].read() );
    1615             r_irq_pending[i] = p_irq[i]->read();
    1616         }
    1617     }
    1618        
     1886                break;
     1887            }
     1888            ////////////////////////
     1889            case CONFIG_RSP_PUT_LOC:   // put single flit into CONFIG_RSP fifo
     1890                                       // no flit on IOX network is consumed
     1891            {
     1892                config_rsp_fifo_put    = true;
     1893                config_rsp_fifo_rerror = r_config_cmd_to_config_rsp_rerror.read();
     1894                config_rsp_fifo_rdata  = r_config_cmd_to_config_rsp_rdata.read();
     1895                config_rsp_fifo_rsrcid = r_config_cmd_srcid.read();
     1896                config_rsp_fifo_rtrdid = r_config_cmd_trdid.read();
     1897                config_rsp_fifo_rpktid = r_config_cmd_pktid.read();
     1898                config_rsp_fifo_reop   = true;
     1899
     1900                // acknowledge request
     1901                r_config_cmd_to_config_rsp_req = false;
     1902
     1903                // update priority
     1904                r_config_rsp_fsm   = CONFIG_RSP_IDLE_IOX;
     1905
     1906#if DEBUG_CONFIG_RSP
     1907if( m_debug_activated )
     1908std::cout << "  <IOB CONFIG_RSP_PUT_UNC> Push single flit response into CONFIG_RSP FIFO"
     1909          << " / rsrcid = " << std::hex << r_config_cmd_srcid.read()
     1910          << " / rtrdid = " << r_config_cmd_trdid.read()
     1911          << " / rpktid = " << r_config_cmd_pktid.read()
     1912          << " / rdata = "  << r_config_cmd_to_config_rsp_rdata.read()
     1913          << " / reop  = "  << true
     1914          << " / rerror = " << r_config_cmd_to_config_rsp_rerror.read() << std::endl;
     1915#endif
     1916                break;
     1917            }
     1918        } // end switch CONFIG_RSP FSM
     1919    } // end if FIFO full
     1920
    16191921    ///////////////////////////////////////////////////////////////////////////////////
    1620     // The MISS_WTI_CMD FSM send VCI commands on the Internal Network.
    1621     // It handles PTE MISS requests from TLB_MISS FSM and software IRQs.
    1622     // It supports several simultaneous VCI transactions.
     1922    // The MISS_WTI_CMD component is a combinational switch that push one single flit
     1923    // VCI command in the MISS_WTI FIFO to INT Network, depending on two clients :
     1924    // 1. MISS requests from TLB_MISS FSM :
     1925    //    These requests have highest priority because a TLB MISS is a blocking event
     1926    //    for the DMA FSM. The r_tlb_to_miss_wti_cmd_req flip-flop is reset by the
     1927    //    MISS_WTI_RSP FSM only when the response is received.
     1928    // 2. WTI requests from DMA_CMD FSM :
     1929    //    These requestsare non blocking events, and the r_dma_cmd_to_miss_wti_cmd_req
     1930    //    flip-flop is reset as soon as the WTI command has been sent.
     1931    //    There is two types of WTI requests:
     1932    //    - external WTI from peripherals on IOX network.
     1933    //    - internal WTI caused by illegal DMA requests.
    16231934    ////////////////////////////////////////////////////////////////////////////////////
    16241935 
    1625     switch ( r_miss_wti_cmd_fsm.read() )
     1936    if ( r_tlb_to_miss_wti_cmd_req.read() and 
     1937         m_miss_wti_cmd_addr_fifo.wok() )                   // put MISS READ
     1938    {
     1939        miss_wti_cmd_fifo_put     = true;
     1940        miss_wti_cmd_fifo_address = r_tlb_paddr.read();     
     1941        miss_wti_cmd_fifo_wdata   = 0;                 
     1942        miss_wti_cmd_fifo_cmd     = vci_param_int::CMD_READ;
     1943        miss_wti_cmd_fifo_pktid   = PKTID_MISS;
     1944        miss_wti_cmd_fifo_srcid   = m_int_srcid;
     1945        miss_wti_cmd_fifo_trdid   = 0;
     1946
     1947#if DEBUG_MISS_WTI_CMD
     1948if( m_debug_activated )
     1949std::cout << "  <IOB MISS_WTI_CMD_WTI> push MISS TLB command into MISS_WTI FIFO"
     1950          << " / PADDR = " << miss_wti_cmd_fifo_address << std::endl;
     1951#endif
     1952
     1953    }
     1954    else if ( r_dma_cmd_to_miss_wti_cmd_req.read() and 
     1955              m_miss_wti_cmd_addr_fifo.wok() )               // put WTI READ / WRITE
     1956    {
     1957        r_dma_cmd_to_miss_wti_cmd_req = false;
     1958
     1959        miss_wti_cmd_fifo_put     = true;
     1960        miss_wti_cmd_fifo_cmd     = r_dma_cmd_to_miss_wti_cmd_cmd.read();
     1961        miss_wti_cmd_fifo_address = r_dma_cmd_to_miss_wti_cmd_addr.read();
     1962        miss_wti_cmd_fifo_wdata   = r_dma_cmd_to_miss_wti_cmd_wdata.read();
     1963        miss_wti_cmd_fifo_srcid   = r_dma_cmd_to_miss_wti_cmd_srcid.read();
     1964        miss_wti_cmd_fifo_trdid   = r_dma_cmd_to_miss_wti_cmd_trdid.read();
     1965        miss_wti_cmd_fifo_pktid   = r_dma_cmd_to_miss_wti_cmd_pktid.read();
     1966
     1967#if DEBUG_MISS_WTI_CMD
     1968if( m_debug_activated )
     1969std::cout << "  <IOB MISS_WTI_CMD_WTI> push WTI command into MISS_WTI FIFO"
     1970          << " / CMD = " << miss_wti_cmd_fifo_cmd
     1971          << " / PADDR = " << miss_wti_cmd_fifo_address << std::endl;
     1972#endif
     1973
     1974    }     
     1975
     1976    ///////////////////////////////////////////////////////////////////////////////////
     1977    // The MISS_WTI_RSP FSM handles VCI responses from the INT network:
     1978    // - for a TLB MISS (multi-flits read transaction), the cache line
     1979    //   is written in r_tlb_buf_data[], and r_tlb_to_miss_wti_cmd_req flip-flop is reset. 
     1980    // - for a WTI_IOX (single flit write transaction), the response must be
     1981    //   forwarded to the source peripheral on the INT network
     1982    // - for a WTI_MMU (single flit write transaction), there is nothing to do.
     1983    //
     1984    // TODO VCI addressing errors for TLB MISS or for WTI_MMU (i.e. kernel errors...)
     1985    // are registered in the r_miss_wti_rsp_error_miss & r_miss_wti_rsp_error_wti
     1986    // flip-flops, and simulation stops... They could be signaled to OS by a WTI.
     1987    ////////////////////////////////////////////////////////////////////////////////////
     1988 
     1989    switch ( r_miss_wti_rsp_fsm.read() )
    16261990    {
    16271991        ///////////////////////
    1628         case MISS_WTI_CMD_IDLE:   // TLB MISS have highest priority
     1992        case MISS_WTI_RSP_IDLE:   // waiting a VCI response
     1993                                  // no VCI flit is consumed
    16291994        {
    1630             if ( r_tlb_miss_req.read() )
     1995            if ( p_vci_ini_int.rspval.read() )
    16311996            {
    1632                 r_miss_wti_cmd_fsm = MISS_WTI_CMD_MISS;
    1633             }
    1634             else if ( r_iommu_wti_enable.read() )
     1997                if ( p_vci_ini_int.rpktid.read() == PKTID_WTI_IOX )
     1998                {
     1999                    r_miss_wti_rsp_fsm   = MISS_WTI_RSP_WTI_IOX;
     2000                }
     2001                else if ( p_vci_ini_int.rpktid.read() == PKTID_WTI_MMU )
     2002                {
     2003                    r_miss_wti_rsp_fsm   = MISS_WTI_RSP_WTI_MMU;
     2004                }
     2005                else if ( p_vci_ini_int.rpktid.read() == PKTID_MISS )
     2006                {
     2007                    r_miss_wti_rsp_fsm   = MISS_WTI_RSP_MISS;
     2008                    r_miss_wti_rsp_count = 0;
     2009                }
     2010                else
     2011                {
     2012                    assert ( false and
     2013                    "VCI_IO_BRIDGE ERROR : illegal response type on INT network");
     2014                }
     2015            }
     2016            break;
     2017        }
     2018        //////////////////////////
     2019        case MISS_WTI_RSP_WTI_IOX:   // Handling response to a peripheral WTI
     2020                                     // consume VCI flit and transfer response
     2021                                     // to DMA_RSP FSM in dedicated registers
     2022                                     // if no pending previous request.
     2023        {
     2024            assert( p_vci_ini_int.reop.read() and
     2025            "VCI_IO_BRIDGE ERROR: WTI_IOX response should have one single flit" );
     2026                   
     2027            if ( not r_miss_wti_rsp_to_dma_rsp_req.read() ) // no previous pending request
    16352028            {
    1636                 // checking if there is a new pending interrupt
    1637                 bool found = false;
    1638                 size_t n;
    1639                 for ( n = 0 ; (n < 32) and not found ; n++ )
    1640                 {
    1641                     if ( r_irq_request[n] ) found = true;
    1642                 }
    1643                 if ( found )
    1644                 {
    1645                     r_miss_wti_cmd_index = n;
    1646                     r_miss_wti_cmd_fsm   = MISS_WTI_CMD_WTI;
    1647                 }
    1648             }
    1649                         break;
     2029                r_miss_wti_rsp_to_dma_rsp_req    = true;
     2030                r_miss_wti_rsp_to_dma_rsp_rerror = p_vci_ini_int.rerror.read();
     2031                r_miss_wti_rsp_to_dma_rsp_rsrcid = p_vci_ini_int.rsrcid.read();
     2032                r_miss_wti_rsp_to_dma_rsp_rtrdid = p_vci_ini_int.rtrdid.read();
     2033                r_miss_wti_rsp_to_dma_rsp_rpktid = p_vci_ini_int.rpktid.read();
     2034
     2035                r_miss_wti_rsp_fsm = MISS_WTI_RSP_IDLE;
     2036
     2037#if DEBUG_MISS_WTI_RSP
     2038if( m_debug_activated )
     2039std::cout << "  <IOB MISS_WTI_RSP_WTI_IOX> Transfer response to a WTI_IOX" << std::endl;
     2040#endif
     2041            }
     2042            break;
    16502043        }
    1651         //////////////////////     
    1652         case MISS_WTI_CMD_WTI:   // send a single flit IRQ WRITE on INT Network
    1653                                  // address is defined by IRQ_VECTOR[r_miss_wti_index]
    1654                                  // data is defined by r_irq_pending[r_miss_wti_index]
     2044        ////////////////////////// 
     2045        case MISS_WTI_RSP_WTI_MMU:   // Handling response to an iommu WTI
     2046                                     // consume VCI flit and test VCI error.
    16552047        {
    1656             if ( p_vci_ini_int.cmdack )
     2048            assert( p_vci_ini_int.reop.read() and
     2049            "VCI_IO_BRIDGE ERROR: WTI_MMU response should have one single flit" );
     2050                 
     2051            if ( (p_vci_ini_int.rerror.read()&0x1) != 0 )  // error reported
    16572052            {
    1658                 // reset the request
    1659                 r_irq_request[r_miss_wti_cmd_index.read()] = false;
    1660                 r_miss_wti_cmd_fsm = MISS_WTI_RSP_WTI;         
    1661 
    1662 #if DEBUG_MISS_WTI
    1663 if( m_debug_activated )
    1664 std::cout << "  <IOB MISS_WTI_CMD_WTI> Send WTI write command on Internal Network"
    1665           << " / IRQID = " << std::dec << r_miss_wti_cmd_index.read() << std::endl;
    1666 #endif
    1667             }
     2053                // set the specific error flip-flop
     2054                r_miss_wti_rsp_error_wti = true;
     2055                assert( false and
     2056                "VCI_IO_BRIDGE ERROR: VCI error response for a WTI_MMU transaction");
     2057            }
     2058
     2059#if DEBUG_MISS_WTI_RSP
     2060if( m_debug_activated )
     2061std::cout << " <IOB MISS_WTI_RSP_WTI_MMU> Receive response to a WTI_MMU" << std::endl;
     2062#endif
    16682063            break;
    16692064        }
    16702065        ///////////////////////
    1671         case MISS_WTI_CMD_MISS:   // send a TLB MISS request on INT Network
    1672         {
    1673             if ( p_vci_ini_int.cmdack )
    1674             {
    1675                 r_tlb_buf_tag     = ( (r_tlb_paddr.read()) & CACHE_LINE_MASK );
    1676                 r_tlb_buf_valid   = true;
    1677            
    1678                 if( r_tlb_miss_type.read() == PTE1_MISS )
    1679                     r_tlb_buf_vaddr = (r_dma_cmd_vaddr.read() &
    1680                                         ~M_PAGE_OFFSET_MASK & ~PTE1_LINE_OFFSET);
    1681                 else
    1682                     r_tlb_buf_vaddr = (r_dma_cmd_vaddr.read() &
    1683                                         ~K_PAGE_OFFSET_MASK & ~PTE2_LINE_OFFSET);
    1684                
    1685                 r_miss_wti_cmd_fsm = MISS_WTI_RSP_MISS;         
    1686 
    1687 #if DEBUG_MISS_WTI
    1688 if( m_debug_activated )
    1689 std::cout << "  <IOB MISS_WTI_CMD_MISS> Send TLB MISS command on Internal Network" << std::hex
    1690           << " / address = " <<(vci_addr_t)((r_tlb_paddr.read())& CACHE_LINE_MASK) << std::endl;
    1691 #endif
    1692             }
    1693             break;
    1694         }
    1695     } // end switch r_miss_wti_cmd_fsm
    1696 
    1697     ///////////////////////////////////////////////////////////////////////////////////
    1698     // The MISS_WTI_RSP FSM handles VCI responses on the Internal Network.
    1699     // it can be response to TLB MISS (read transaction) or WTI (write transaction).
    1700     // It supports several simultaneous VCI transactions.
    1701     ////////////////////////////////////////////////////////////////////////////////////
    1702  
    1703     switch ( r_miss_wti_rsp_fsm.read() )
    1704     {
    1705         case MISS_WTI_RSP_IDLE:   // waiting a VCI response
    1706         {
    1707             if ( p_vci_ini_int.rspval.read() )
    1708             {
    1709                 if ( p_vci_ini_int.rpktid.read() == PKTID_READ )  // it's a TLB MISS response
    1710                 {
    1711                     r_miss_wti_rsp_fsm   = MISS_WTI_RSP_MISS;
    1712                     r_miss_wti_rsp_count = 0;
    1713                 }
    1714                 else                                       // it's a WTI WRITE response
    1715                 {
    1716                     r_miss_wti_rsp_fsm   = MISS_WTI_RSP_WTI;
    1717 
    1718                 }
    1719             }
    1720             break;
    1721         }
    1722         //////////////////////
    1723         case MISS_WTI_RSP_WTI:   // Handling response to a WTI transaction
    1724         {
    1725             assert( p_vci_ini_int.reop.read() and
    1726             "VCI_IO_BRIDGE ERROR: IRQ Write response should have one single flit" );
    1727 
    1728             assert( ( (p_vci_ini_int.rerror.read()&0x1) == 0 ) and
    1729             "VCI_IO_BRIDGE ERROR: IRQ Write response error !!!" );
    1730              // TODO handling error when using the IOMMU IRQ
    1731 
    1732 #if DEBUG_MISS_WTI
    1733 if( m_debug_activated )
    1734 std::cout << "  <IOB MISS_WTI_RSP_WTI> Response to WTI write" << std::endl;
    1735 #endif
    1736             r_miss_wti_rsp_fsm = MISS_WTI_RSP_IDLE;
    1737             break;
    1738         }
    1739         ///////////////////////
    1740         case MISS_WTI_RSP_MISS:   // Handling response to a TLB MISS transaction
     2066        case MISS_WTI_RSP_MISS:   // Handling response to a TLB MISS
     2067                                  // write cache line in r_tlb_buf buffer
     2068                                  // and analyse possible VCI error
     2069                                  // VCI flit is consumed.
    17412070        {
    17422071            if ( p_vci_ini_int.rspval.read() )
     
    17442073                if ( (p_vci_ini_int.rerror.read()&0x1) != 0 )  // error reported
    17452074                {
    1746                     r_miss_wti_rsp_error = true;
    1747                     if ( p_vci_ini_int.reop.read() )
    1748                     {   
    1749                         r_miss_wti_cmd_fsm = MISS_WTI_RSP_IDLE;
    1750                         r_tlb_miss_req = false;
    1751                     }
    1752 #if DEBUG_MISS_WTI
     2075                    // set the specific error flip-flop
     2076                    r_miss_wti_rsp_error_miss = true;
     2077                    assert( false and
     2078                    "VCI_IO_BRIDGE ERROR: VCI error response for a TLB MISS transaction");
     2079
     2080                }
     2081                else                                           // no error
     2082                {
     2083
     2084#if DEBUG_MISS_WTI_CMD
    17532085if( m_debug_activated )
    1754 std::cout << " <IOB MISS_WTI_RSP_MISS> ERROR " << std::endl;
    1755 #endif
    1756                 }
    1757                 else                                           // no error
    1758                 {
    1759                     bool   eop          = p_vci_ini_int.reop.read();
    1760 
    1761 #if DEBUG_MISS_WTI
    1762 if( m_debug_activated )
    1763 std::cout << "  <IOB MISS_WTI_RSP_MISS> Response to a tlb miss transaction"
     2086std::cout << "  <IOB MISS_WTI_RSP_MISS> Receive response to a TLB MISS"
    17642087          << " / Count = " << r_miss_wti_rsp_count.read()
    17652088          << " / Data = " << std::hex << p_vci_ini_int.rdata.read() << std::endl;
    17662089#endif
     2090                    r_tlb_buf_data[r_miss_wti_rsp_count.read()] = p_vci_ini_int.rdata.read();
     2091                }
     2092                   
     2093                if ( p_vci_ini_int.reop.read() )               // last flit
     2094                {   
     2095                    bool eop = p_vci_ini_int.eop.read();
    17672096                    assert(((eop == (r_miss_wti_rsp_count.read() == (m_words-1)))) and
    17682097                    "VCI_IO_BRIDGE ERROR: invalid length for a TLB MISS response");
    17692098
    1770                     r_tlb_buf_data[r_miss_wti_rsp_count.read()] = p_vci_ini_int.rdata.read();
     2099                    r_miss_wti_rsp_count      = 0;
     2100                    r_miss_wti_rsp_fsm        = MISS_WTI_RSP_IDLE;
     2101                    r_tlb_to_miss_wti_cmd_req = false;
     2102                }
     2103                else                                           // not the last flit
     2104                {
    17712105                    r_miss_wti_rsp_count = r_miss_wti_rsp_count.read() + 1;
    1772                    
    1773                     if ( eop )
    1774                     {
    1775                         r_tlb_miss_req = false;     //reset the request flip-flop
    1776                         r_miss_wti_cmd_fsm = MISS_WTI_RSP_IDLE;         
    1777                     }
    17782106                }
    17792107            }
     
    17822110    } // end  switch r_miss_wti_rsp_fsm
    17832111
    1784     /////////////////////////////////////////////////////////////////////////
    1785     // This flip-flop allocates the access to the CONFIG_RSP fifo
    1786     // with a round robin priority between 2 clients FSMs :
    1787     // - CONFIG_CMD : to put a response to a local config command.
    1788     // - CONFIG_RSP : to put a response to a peripheral config command.
    1789     // The ressource is always allocated.
    1790     // A new allocation occurs when the owner FSM is not using it,
    1791     // and the other FSM is requiring it.
    1792     /////////////////////////////////////////////////////////////////////////
    1793    
    1794     if ( r_alloc_fifo_config_rsp_local.read() )
    1795     {
    1796         if ( (r_config_rsp_fsm.read() != CONFIG_RSP_IDLE) and   // config_rsp_fsm requiring
    1797              (r_config_cmd_fsm.read() != CONFIG_CMD_RSP) )      // config_cmd_fsm not requiring
    1798         r_alloc_fifo_config_rsp_local = false;
    1799     }
    1800     else
    1801     {
    1802         if ( (r_config_cmd_fsm.read() == CONFIG_CMD_RSP) and    // config_cmd_fsm requiring
    1803              (r_config_rsp_fsm.read() == CONFIG_RSP_IDLE) )     // config_rsp_fsm not requiring
    1804         r_alloc_fifo_config_rsp_local = true;
    1805     }
    1806 
    1807     /////////////////////////////////////////////////////////////////////////
    1808     // This flip-flop allocates the access to the DMA_RSP fifo
    1809     // with a round robin priority between 2 clients FSMs :
    1810     // - DMA_CMD : to put a error response in case of bad address translation
    1811     // - DMA_RSP : to put a normal response to a DMA transaction.
    1812     // The ressource is always allocated.
    1813     // A new allocation occurs when the owner FSM is not using it,
    1814     // and the other FSM is requiring it.
    1815     /////////////////////////////////////////////////////////////////////////
    1816    
    1817     if ( r_alloc_fifo_dma_rsp_local.read() )
    1818     {
    1819         if ( (r_dma_rsp_fsm.read() == DMA_RSP_FIFO_PUT) and
    1820              (r_dma_cmd_fsm.read() != DMA_CMD_FIFO_PUT_RSP) )
    1821         r_alloc_fifo_dma_rsp_local = false;
    1822     }
    1823     else
    1824     {
    1825         if ( (r_dma_cmd_fsm.read() == DMA_CMD_FIFO_PUT_RSP) and
    1826              (r_dma_rsp_fsm.read() != DMA_RSP_FIFO_PUT) )
    1827         r_alloc_fifo_dma_rsp_local = true;
    1828     }
    1829 
    1830     // Define GET signals for all output FIFOs
    1831     dma_cmd_fifo_get    = p_vci_ini_ram.cmdack.read();
    1832     dma_rsp_fifo_get    = p_vci_tgt_iox.rspack.read();
    1833     config_cmd_fifo_get = p_vci_ini_iox.cmdack.read();
    1834     config_rsp_fifo_get = p_vci_tgt_int.rspack.read();
    18352112
    18362113    ///////////////////////////////////////////////////////////
    18372114    // DMA_CMD fifo update
    1838     // One writer : DMA_CMD FSM
     2115    // writer : DMA_CMD FSM
    18392116    ///////////////////////////////////////////////////////////
    18402117
     
    18842161    //////////////////////////////////////////////////////////////
    18852162    // DMA_RSP fifo update
    1886     // Two writers : DMA_CMD FSM & DMA_RSP FSM
     2163    // writer : DMA_RSP FSM
    18872164    //////////////////////////////////////////////////////////////
    18882165
    1889     if (r_alloc_fifo_dma_rsp_local.read() )  // owner is DMA_CMD FSM
    1890                                              // local response for a translation error
    1891     {
    1892         m_dma_rsp_data_fifo.update(   dma_rsp_fifo_get,
    1893                                       dma_rsp_fifo_put,
    1894                                       0 );                      // no data if error
    1895         m_dma_rsp_rsrcid_fifo.update( dma_rsp_fifo_get,
    1896                                       dma_rsp_fifo_put,
    1897                                       p_vci_tgt_iox.rsrcid.read() );
    1898         m_dma_rsp_rtrdid_fifo.update( dma_rsp_fifo_get,
    1899                                       dma_rsp_fifo_put,
    1900                                       p_vci_tgt_iox.rtrdid.read() );
    1901         m_dma_rsp_rpktid_fifo.update( dma_rsp_fifo_get,
    1902                                       dma_rsp_fifo_put,
    1903                                       p_vci_tgt_iox.rpktid.read() );
    1904         m_dma_rsp_reop_fifo.update(   dma_rsp_fifo_get,
    1905                                       dma_rsp_fifo_put,
    1906                                       true );                    // single flit response
    1907         m_dma_rsp_rerror_fifo.update( dma_rsp_fifo_get,
    1908                                       dma_rsp_fifo_put,
    1909                                       1 );                        // error
    1910     }
    1911     else                                   // owner is DMA_RSP FSM
    1912                                            // normal response to a DMA transaction
    1913     {
    1914         m_dma_rsp_data_fifo.update(   dma_rsp_fifo_get,
    1915                                       dma_rsp_fifo_put,
    1916                                       p_vci_ini_ram.rdata.read() );
    1917         m_dma_rsp_rsrcid_fifo.update( dma_rsp_fifo_get,
    1918                                       dma_rsp_fifo_put,
    1919                                       p_vci_ini_ram.rsrcid.read() );
    1920         m_dma_rsp_rtrdid_fifo.update( dma_rsp_fifo_get,
    1921                                       dma_rsp_fifo_put,
    1922                                       p_vci_ini_ram.rtrdid.read() );
    1923         m_dma_rsp_rpktid_fifo.update( dma_rsp_fifo_get,
    1924                                       dma_rsp_fifo_put,
    1925                                       p_vci_ini_ram.rpktid.read() );
    1926         m_dma_rsp_reop_fifo.update(   dma_rsp_fifo_get,
    1927                                       dma_rsp_fifo_put,
    1928                                       p_vci_ini_ram.reop.read() );
    1929         m_dma_rsp_rerror_fifo.update( dma_rsp_fifo_get,
    1930                                       dma_rsp_fifo_put,
    1931                                       p_vci_ini_ram.rerror.read() );
    1932     }
     2166    m_dma_rsp_data_fifo.update(   dma_rsp_fifo_get,
     2167                                  dma_rsp_fifo_put,
     2168                                  dma_rsp_fifo_rdata );
     2169    m_dma_rsp_rsrcid_fifo.update( dma_rsp_fifo_get,
     2170                                  dma_rsp_fifo_put,
     2171                                  dma_rsp_fifo_rsrcid );
     2172    m_dma_rsp_rtrdid_fifo.update( dma_rsp_fifo_get,
     2173                                  dma_rsp_fifo_put,
     2174                                  dma_rsp_fifo_rtrdid );
     2175    m_dma_rsp_rpktid_fifo.update( dma_rsp_fifo_get,
     2176                                  dma_rsp_fifo_put,
     2177                                  dma_rsp_fifo_rpktid );
     2178    m_dma_rsp_reop_fifo.update(   dma_rsp_fifo_get,
     2179                                  dma_rsp_fifo_put,
     2180                                  dma_rsp_fifo_reop );     
     2181    m_dma_rsp_rerror_fifo.update( dma_rsp_fifo_get,
     2182                                  dma_rsp_fifo_put,
     2183                                  dma_rsp_fifo_rerror );
    19332184
    19342185    ////////////////////////////////////////////////////////////////
    19352186    // CONFIG_CMD fifo update
    1936     // One writer : CONFIG_CMD FSM
     2187    // writer : CONFIG_CMD FSM
    19372188    ////////////////////////////////////////////////////////////////
    19382189
     
    19822233    //////////////////////////////////////////////////////////////////////////
    19832234    // CONFIG_RSP fifo update
    1984     // There is two writers : CONFIG_CMD FSM & CONFIG_RSP FSM
     2235    // writer : CONFIG_RSP FSM
    19852236    //////////////////////////////////////////////////////////////////////////
    19862237
    1987     if ( r_alloc_fifo_config_rsp_local.read() )  // owner is CONFIG_CMD FSM
    1988                                                  // response for a local config transaction
    1989     {
    1990         m_config_rsp_data_fifo.update(   config_rsp_fifo_get,
    1991                                          config_rsp_fifo_put,
    1992                                          r_config_cmd_rdata.read() );
    1993         m_config_rsp_rsrcid_fifo.update( config_rsp_fifo_get,
    1994                                          config_rsp_fifo_put,
    1995                                          p_vci_tgt_int.srcid.read() );
    1996         m_config_rsp_rtrdid_fifo.update( config_rsp_fifo_get,
    1997                                          config_rsp_fifo_put,
    1998                                          p_vci_tgt_int.trdid.read() );
    1999         m_config_rsp_rpktid_fifo.update( config_rsp_fifo_get,
    2000                                          config_rsp_fifo_put,
    2001                                          p_vci_tgt_int.pktid.read() );
    2002         m_config_rsp_reop_fifo.update(   config_rsp_fifo_get,
    2003                                          config_rsp_fifo_put,
    2004                                          true );                // local config are one flit
    2005         m_config_rsp_rerror_fifo.update( config_rsp_fifo_get,
    2006                                          config_rsp_fifo_put,
    2007                                          r_config_cmd_error.read() );
    2008     }
    2009     else                                         // owner is CONFIG_RSP FSM
    2010                                                  // response for a remote transaction
    2011     {
    2012         // PUT  depends on CONFIG_RSP FSM state
    2013         uint32_t rdata;
    2014         bool     reop;
    2015         if ( r_config_rsp_fsm.read() == CONFIG_RSP_PUT_HI )
    2016         {
    2017             config_rsp_fifo_put = true;
    2018             rdata               = (uint32_t)(p_vci_ini_iox.rdata.read()>>32);
    2019             reop                = p_vci_ini_iox.reop.read();
    2020         }
    2021         else if ( r_config_rsp_fsm.read() == CONFIG_RSP_PUT_LO )
    2022         {
    2023             config_rsp_fifo_put = true;
    2024             rdata               = (uint32_t)(p_vci_ini_iox.rdata.read());
    2025             reop                = false;
    2026         }
    2027         else if ( r_config_rsp_fsm.read() == CONFIG_RSP_PUT_UNC )
    2028         {
    2029             config_rsp_fifo_put = true;
    2030             rdata               = (uint32_t)(p_vci_ini_iox.rdata.read());
    2031             reop                = true;
    2032         }
    2033         else
    2034         {
    2035             config_rsp_fifo_put = false;
    2036             rdata               = 0;
    2037             reop                = false;;
    2038         }
    2039 
    2040         m_config_rsp_data_fifo.update(   config_rsp_fifo_get,
    2041                                          config_rsp_fifo_put,
    2042                                          rdata );
    2043         m_config_rsp_rsrcid_fifo.update( config_rsp_fifo_get,
    2044                                          config_rsp_fifo_put,
    2045                                          p_vci_ini_iox.rsrcid.read() );
    2046         m_config_rsp_rtrdid_fifo.update( config_rsp_fifo_get,
    2047                                          config_rsp_fifo_put,
    2048                                          p_vci_ini_iox.rtrdid.read() );
    2049         m_config_rsp_rpktid_fifo.update( config_rsp_fifo_get,
    2050                                          config_rsp_fifo_put,
    2051                                          p_vci_ini_iox.rpktid.read() );
    2052         m_config_rsp_reop_fifo.update(   config_rsp_fifo_get,
    2053                                          config_rsp_fifo_put,
    2054                                          reop );
    2055         m_config_rsp_rerror_fifo.update( config_rsp_fifo_get,
    2056                                          config_rsp_fifo_put,
    2057                                          p_vci_ini_iox.rerror.read() );
    2058     }
     2238    m_config_rsp_data_fifo.update(   config_rsp_fifo_get,
     2239                                     config_rsp_fifo_put,
     2240                                     config_rsp_fifo_rdata );
     2241    m_config_rsp_rsrcid_fifo.update( config_rsp_fifo_get,
     2242                                     config_rsp_fifo_put,
     2243                                     config_rsp_fifo_rsrcid );
     2244    m_config_rsp_rtrdid_fifo.update( config_rsp_fifo_get,
     2245                                     config_rsp_fifo_put,
     2246                                     config_rsp_fifo_rtrdid );
     2247    m_config_rsp_rpktid_fifo.update( config_rsp_fifo_get,
     2248                                     config_rsp_fifo_put,
     2249                                     config_rsp_fifo_rpktid );
     2250    m_config_rsp_reop_fifo.update(   config_rsp_fifo_get,
     2251                                     config_rsp_fifo_put,
     2252                                     config_rsp_fifo_reop );
     2253    m_config_rsp_rerror_fifo.update( config_rsp_fifo_get,
     2254                                     config_rsp_fifo_put,
     2255                                     config_rsp_fifo_rerror );
     2256     
     2257    ////////////////////////////////////////////////////////////////
     2258    // MISS_WTI_CMD fifo update
     2259    // One writer : MISS_WTI switch
     2260    ////////////////////////////////////////////////////////////////
     2261
     2262    m_miss_wti_cmd_addr_fifo.update(   miss_wti_cmd_fifo_get,
     2263                                       miss_wti_cmd_fifo_put,
     2264                                       miss_wti_cmd_fifo_address );
     2265    m_miss_wti_cmd_cmd_fifo.update(    miss_wti_cmd_fifo_get,
     2266                                       miss_wti_cmd_fifo_put,
     2267                                       miss_wti_cmd_fifo_cmd );
     2268    m_miss_wti_cmd_contig_fifo.update( config_cmd_fifo_get,
     2269                                       miss_wti_cmd_fifo_put,
     2270                                       true );
     2271    m_miss_wti_cmd_cons_fifo.update(   miss_wti_cmd_fifo_get,
     2272                                       miss_wti_cmd_fifo_put,
     2273                                       false );
     2274    m_miss_wti_cmd_plen_fifo.update(   miss_wti_cmd_fifo_get,
     2275                                       miss_wti_cmd_fifo_put,
     2276                                       4 );
     2277    m_miss_wti_cmd_wrap_fifo.update(   miss_wti_cmd_fifo_get,
     2278                                       miss_wti_cmd_fifo_put,
     2279                                       false );
     2280    m_miss_wti_cmd_cfixed_fifo.update( config_cmd_fifo_get,
     2281                                       miss_wti_cmd_fifo_put,
     2282                                       false );
     2283    m_miss_wti_cmd_clen_fifo.update(   miss_wti_cmd_fifo_get,
     2284                                       miss_wti_cmd_fifo_put,
     2285                                       0 );
     2286    m_miss_wti_cmd_srcid_fifo.update(  miss_wti_cmd_fifo_get,
     2287                                       miss_wti_cmd_fifo_put,
     2288                                       miss_wti_cmd_fifo_srcid );
     2289    m_miss_wti_cmd_trdid_fifo.update(  miss_wti_cmd_fifo_get,
     2290                                       miss_wti_cmd_fifo_put,
     2291                                       miss_wti_cmd_fifo_trdid );
     2292    m_miss_wti_cmd_pktid_fifo.update(  miss_wti_cmd_fifo_get,
     2293                                       miss_wti_cmd_fifo_put,
     2294                                       miss_wti_cmd_fifo_pktid );
     2295    m_miss_wti_cmd_data_fifo.update(   miss_wti_cmd_fifo_get,
     2296                                       miss_wti_cmd_fifo_put,
     2297                                       miss_wti_cmd_fifo_wdata );
     2298    m_miss_wti_cmd_be_fifo.update(     miss_wti_cmd_fifo_get,
     2299                                       miss_wti_cmd_fifo_put,
     2300                                       0xF );
     2301    m_miss_wti_cmd_eop_fifo.update(    miss_wti_cmd_fifo_get,
     2302                                       miss_wti_cmd_fifo_put,
     2303                                       true );
    20592304   
    20602305} // end transition()
    20612306
    2062 ///////////////////////
     2307//////////////////////////////////////////////////////////////////////////
    20632308tmpl(void)::genMoore()
    2064 ///////////////////////
     2309//////////////////////////////////////////////////////////////////////////
    20652310{
     2311    /////////////////  p_vci_ini_ram  /////////////////////////////
     2312
    20662313    // VCI initiator command on RAM network
    20672314    // directly the content of the dma_cmd FIFO
    2068 
    20692315    p_vci_ini_ram.cmdval  = m_dma_cmd_addr_fifo.rok();
    20702316    p_vci_ini_ram.address = m_dma_cmd_addr_fifo.read();
     
    20832329    p_vci_ini_ram.srcid   = m_dma_cmd_srcid_fifo.read();
    20842330   
    2085     // VCI target command ack on IOX network
    2086     // depends on the DMA_CMD FSM state
    2087 
    2088     switch ( r_dma_cmd_fsm.read() )
    2089     {
    2090     case DMA_CMD_IDLE:
    2091     case DMA_CMD_MISS_WAIT:
    2092         p_vci_tgt_iox.cmdack  = false;
    2093         break;
    2094     case DMA_CMD_WAIT_EOP:
    2095         p_vci_tgt_iox.cmdack  = true;
    2096         break;
    2097     case DMA_CMD_FIFO_PUT_CMD:
    2098         p_vci_tgt_iox.cmdack  = m_dma_cmd_addr_fifo.wok();
    2099         break;
    2100     case DMA_CMD_FIFO_PUT_RSP:
    2101         p_vci_tgt_iox.cmdack  = m_dma_rsp_data_fifo.wok();
    2102         break;
    2103     }
    2104 
    2105     // VCI target response on IOX network
     2331    // VCI initiator response on the RAM Network
     2332    // depends on the DMA_RSP FSM state
     2333        p_vci_ini_ram.rspack = m_dma_rsp_data_fifo.wok() and
     2334                           (r_dma_rsp_fsm.read() == DMA_RSP_PUT_DMA);
     2335
     2336    /////////////////  p_vci_tgt_iox  /////////////////////////////
     2337
     2338    // VCI target response on IOX network is
    21062339    // directly the content of the DMA_RSP FIFO
    2107 
    21082340    p_vci_tgt_iox.rspval  = m_dma_rsp_data_fifo.rok();
    21092341    p_vci_tgt_iox.rsrcid  = m_dma_rsp_rsrcid_fifo.read();
     
    21142346    p_vci_tgt_iox.reop    = m_dma_rsp_reop_fifo.read();
    21152347
    2116     // VCI initiator response on the RAM Network
    2117     // depends on the DMA_RSP FSM state
    2118 
    2119         p_vci_ini_ram.rspack = m_dma_rsp_data_fifo.wok() and
    2120                            (r_dma_rsp_fsm.read() == DMA_RSP_FIFO_PUT) and
    2121                            not r_alloc_fifo_dma_rsp_local.read();
    2122 
    2123     // VCI initiator command on IOX network
     2348    // VCI target command ack on IOX network
     2349    // depends on the DMA_CMD FSM state
     2350    switch ( r_dma_cmd_fsm.read() )
     2351    {
     2352        case DMA_CMD_IDLE:             
     2353             p_vci_tgt_iox.cmdack  = false;
     2354             break;
     2355        case DMA_CMD_DMA_REQ:
     2356             p_vci_tgt_iox.cmdack  = m_dma_cmd_addr_fifo.wok();
     2357             break;
     2358        case DMA_CMD_WTI_IOX_REQ:
     2359             p_vci_tgt_iox.cmdack  = not r_dma_cmd_to_miss_wti_cmd_req.read();
     2360             break;
     2361        case DMA_CMD_ERR_WTI_REQ:
     2362             p_vci_tgt_iox.cmdack  = false;
     2363             break;
     2364        case DMA_CMD_ERR_WAIT_EOP:
     2365             p_vci_tgt_iox.cmdack  = true; 
     2366             break;
     2367        case DMA_CMD_ERR_RSP_REQ:
     2368             p_vci_tgt_iox.cmdack  = false; 
     2369             break;
     2370        case DMA_CMD_TLB_MISS_WAIT:
     2371             p_vci_tgt_iox.cmdack  = false; 
     2372             break;
     2373    }
     2374
     2375    //////////////////  p_vci_ini_iox  /////////////////////////////
     2376
     2377    // VCI initiator command on IOX network is
    21242378    // directly the content of the CONFIG_CMD FIFO
    2125 
    21262379    p_vci_ini_iox.cmdval  = m_config_cmd_addr_fifo.rok();
    21272380    p_vci_ini_iox.address = m_config_cmd_addr_fifo.read();
     
    21402393    p_vci_ini_iox.srcid   = m_config_cmd_srcid_fifo.read();
    21412394   
     2395    // VCI initiator response on IOX Network
     2396    // it depends on the CONFIG_RSP FSM state
     2397        p_vci_ini_iox.rspack = m_config_rsp_data_fifo.wok() and
     2398                           ( (r_config_rsp_fsm.read() == CONFIG_RSP_PUT_UNC) or
     2399                             (r_config_rsp_fsm.read() == CONFIG_RSP_PUT_HI) );
     2400
     2401    /////////////////  p_vci_tgt_int  ////////////////////////////////
     2402
     2403    // VCI target response on INT network
     2404    // directly the content of the CONFIG_RSP FIFO
     2405    p_vci_tgt_int.rspval  = m_config_rsp_data_fifo.rok();
     2406        p_vci_tgt_int.rsrcid  = m_config_rsp_rsrcid_fifo.read();
     2407    p_vci_tgt_int.rtrdid  = m_config_rsp_rtrdid_fifo.read();
     2408    p_vci_tgt_int.rpktid  = m_config_rsp_rpktid_fifo.read();
     2409    p_vci_tgt_int.rdata   = m_config_rsp_data_fifo.read();
     2410    p_vci_tgt_int.rerror  = m_config_rsp_rerror_fifo.read();
     2411    p_vci_tgt_int.reop    = m_config_rsp_reop_fifo.read();
     2412   
    21422413    // VCI target command ack on INT network
    21432414    // it depends on the CONFIG_CMD FSM state
    2144 
    21452415    switch ( r_config_cmd_fsm.read() )
    21462416    {
     
    21592429    }
    21602430
    2161     // VCI target response on INT network
    2162     // directly the content of the CONFIG_RSP FIFO
    2163 
    2164     p_vci_tgt_int.rspval  = m_config_rsp_data_fifo.rok();
    2165         p_vci_tgt_int.rsrcid  = m_config_rsp_rsrcid_fifo.read();
    2166     p_vci_tgt_int.rtrdid  = m_config_rsp_rtrdid_fifo.read();
    2167     p_vci_tgt_int.rpktid  = m_config_rsp_rpktid_fifo.read();
    2168     p_vci_tgt_int.rdata   = m_config_rsp_data_fifo.read();
    2169     p_vci_tgt_int.rerror  = m_config_rsp_rerror_fifo.read();
    2170     p_vci_tgt_int.reop    = m_config_rsp_reop_fifo.read();
    2171    
    2172     // VCI initiator response on IOX Network
    2173     // it depends on the CONFIG_RSP FSM state
    2174 
    2175         p_vci_ini_iox.rspack = m_config_rsp_data_fifo.wok() and
    2176                            not r_alloc_fifo_config_rsp_local.read() and
    2177                            ( (r_config_rsp_fsm.read() == CONFIG_RSP_PUT_UNC) or
    2178                              (r_config_rsp_fsm.read() == CONFIG_RSP_PUT_HI) );
     2431    /////////////////  p_vci_ini_int  ////////////////////////////////
    21792432
    21802433    // VCI initiator command  on INT network
    2181     // it depends on the MISS_WTI_CMD FSM state   
    2182     // - WTI : single flit WRITE
    2183     // - MISS TLB : multi-flit READ for a complete cache line
    2184 
    2185     // default values
    2186     p_vci_ini_int.srcid   = m_int_srcid;
    2187     p_vci_ini_int.trdid   = 0;
    2188     p_vci_ini_int.cfixed  = false;
    2189     p_vci_ini_int.eop     = true;
    2190     p_vci_ini_int.wrap    = false;
    2191     p_vci_ini_int.clen    = 0;
    2192     p_vci_ini_int.contig  = true;
    2193     p_vci_ini_int.cons    = false;
    2194     p_vci_ini_int.be      = 0xF;
    2195    
    2196     switch ( r_miss_wti_cmd_fsm.read() )
    2197     {   
    2198     case MISS_WTI_CMD_IDLE:
    2199                 p_vci_ini_int.cmdval  = false;
    2200         p_vci_ini_int.address = 0;
    2201         p_vci_ini_int.cmd     = vci_param_int::CMD_NOP;
    2202         p_vci_ini_int.pktid   = PKTID_READ;
    2203         p_vci_ini_int.wdata   = 0;
    2204         p_vci_ini_int.plen    = 0;
    2205         break;
    2206    
    2207     case MISS_WTI_CMD_WTI:
    2208         p_vci_ini_int.cmdval  = true;
    2209         p_vci_ini_int.address = r_iommu_peri_wti[r_miss_wti_cmd_index.read()].read();
    2210         p_vci_ini_int.cmd     = vci_param_int::CMD_WRITE;
    2211         p_vci_ini_int.pktid   = PKTID_WRITE;
    2212         p_vci_ini_int.wdata   = (int_data_t)r_irq_pending[r_miss_wti_cmd_index.read()].read();
    2213         p_vci_ini_int.plen    = vci_param_int::B;
    2214         break;
    2215    
    2216     case MISS_WTI_CMD_MISS:
    2217         p_vci_ini_int.cmdval  = true;
    2218         p_vci_ini_int.address = r_tlb_paddr.read() & CACHE_LINE_MASK;
    2219         p_vci_ini_int.cmd     = vci_param_int::CMD_READ;
    2220         p_vci_ini_int.pktid   = PKTID_READ;
    2221         p_vci_ini_int.wdata   = 0;
    2222         p_vci_ini_int.plen    = m_words*(vci_param_int::B);
    2223         break;
    2224     }
     2434    // directly the content of the MISS_WTI_CMD FIFO 
     2435    p_vci_ini_int.cmdval  = m_miss_wti_cmd_addr_fifo.rok();
     2436    p_vci_ini_int.address = m_miss_wti_cmd_addr_fifo.read();
     2437    p_vci_ini_int.be      = m_miss_wti_cmd_be_fifo.read();
     2438    p_vci_ini_int.cmd     = m_miss_wti_cmd_cmd_fifo.read();
     2439    p_vci_ini_int.contig  = m_miss_wti_cmd_contig_fifo.read();
     2440    p_vci_ini_int.wdata   = m_miss_wti_cmd_data_fifo.read();
     2441    p_vci_ini_int.eop     = m_miss_wti_cmd_eop_fifo.read();
     2442    p_vci_ini_int.cons    = m_miss_wti_cmd_cons_fifo.read();
     2443    p_vci_ini_int.plen    = m_miss_wti_cmd_plen_fifo.read();
     2444    p_vci_ini_int.wrap    = m_miss_wti_cmd_wrap_fifo.read();
     2445    p_vci_ini_int.cfixed  = m_miss_wti_cmd_cfixed_fifo.read();
     2446    p_vci_ini_int.clen    = m_miss_wti_cmd_clen_fifo.read();
     2447    p_vci_ini_int.trdid   = m_miss_wti_cmd_trdid_fifo.read();
     2448    p_vci_ini_int.pktid   = m_miss_wti_cmd_pktid_fifo.read();
     2449    p_vci_ini_int.srcid   = m_miss_wti_cmd_srcid_fifo.read();
    22252450
    22262451    // VCI initiator response on INT network
    22272452    // It depends on the MISS_WTI_RSP FSM state
    22282453
    2229     if ( r_miss_wti_rsp_fsm.read() == MISS_WTI_RSP_IDLE ) p_vci_ini_int.rspack  = false;
    2230     else                                                  p_vci_ini_int.rspack  = true;
     2454    if ( r_miss_wti_rsp_fsm.read() == MISS_WTI_RSP_IDLE )
     2455    {
     2456        p_vci_ini_int.rspack = false;
     2457    }
     2458    else if ( r_miss_wti_rsp_fsm.read() == MISS_WTI_RSP_WTI_IOX )
     2459    {
     2460        p_vci_ini_int.rspack = not r_miss_wti_rsp_to_dma_rsp_req.read();
     2461    }
     2462    else  //  MISS_WTI_RSP_MISS or MISS_WTI_RESP_WTI_MMU
     2463    {
     2464        p_vci_ini_int.rspack = true;
     2465    }
    22312466
    22322467} // end genMoore
  • trunk/modules/vci_io_bridge/include/soclib/io_bridge.h

    r434 r712  
    2929
    3030// IOB Configuration registers
    31 // Minimal required segment size = 512 bytes (128 words)
     31// Minimal required segment size = 64 bytes (16 words)
    3232enum
    3333{
     
    3939    IOB_INVAL_PTE        = 5,     // W    : Invalidate PTE (using virtual address)
    4040    IOB_WTI_ENABLE       = 6,     // R/W  : Enable WTI (both IOB and external IRQs)
    41     IOB_WTI_ADDR_LO      = 7,     // R/W  : WTI for IOB itself (32 LSB address bits)
    42     IOB_WTI_ADDR_HI      = 8,     // R/W  : WTI for IOB itself (32 MSB address bits)
    43     IOB_PERI_WTI_BEGIN   = 64,    // R/W  : two 32 bits words per IRQ
     41    IOB_WTI_ADDR_LO      = 7,     // R/W  : IOB WTI address (32 LSB bits)
     42    IOB_WTI_ADDR_HI      = 8,     // R/W  : IOB WTI address (32 MSB bits)
     43    IOB_XICU_BASE        = 9,     // R/W  : XICU pbase address in cluster 0
     44    IOB_XICU_SIZE        = 10,    // R/W  : XICU segment size
    4445    /**/
    45     IOB_SPAN             = 128,                               
     46    IOB_SPAN             = 16,                               
    4647};
    4748
     
    5152{
    5253    MMU_NONE                      = 0x0000, // None
    53     MMU_WRITE_ACCES_VIOLATION     = 0x0008, // Write access to a non writable page
    54     MMU_WRITE_PT1_ILLEGAL_ACCESS  = 0x0040, // Write Bus Error accessing Table 1       
    55     MMU_READ_PT1_UNMAPPED             = 0x1001, // Read  Page fault on Page Table 1    
    56     MMU_READ_PT2_UNMAPPED             = 0x1002, // Read  Page fault on Page Table 2  
    57     MMU_READ_PT1_ILLEGAL_ACCESS   = 0x1040, // Read  Bus Error in Table1 access      
    58     MMU_READ_PT2_ILLEGAL_ACCESS   = 0x1080, // Read  Bus Error in Table2 access         
     54    MMU_WRITE_ACCES_VIOLATION     = 0x0008, // Write access to non writable page
     55    MMU_WRITE_PT1_ILLEGAL_ACCESS  = 0x0040, // Write Bus Error accessing Table 1
     56    MMU_READ_PT1_UNMAPPED             = 0x1001, // Read  Page fault on Page Table 1
     57    MMU_READ_PT2_UNMAPPED             = 0x1002, // Read  Page fault on Page Table 2
     58    MMU_READ_PT1_ILLEGAL_ACCESS   = 0x1040, // Read  Bus Error in Table1 access
     59    MMU_READ_PT2_ILLEGAL_ACCESS   = 0x1080, // Read  Bus Error in Table2 access
    5960    MMU_READ_DATA_ILLEGAL_ACCESS  = 0x1100, // Read  Bus Error in cache access
    6061};
Note: See TracChangeset for help on using the changeset viewer.