Ignore:
Timestamp:
Jun 23, 2014, 3:43:33 PM (10 years ago)
Author:
cfuguet
Message:

vci_io_bridge:

  • erasing XICU base and size registers. There registers are not used anymore because routing through INT network is done by using special attribute of IOX mapping segments.
  • bugfix: adding config_cmd_to_config_rsp registers for transmitting SRCID, TRDID and PKTID. Before, r_config_cmd registers were used for transmitting these informations to CONFIG_RSP FSM, but these registers can be simultaneously modified by the CONFIG_CMD FSM.
  • adding a masking table for SRCID in the DMA_CMD FSM. This masking table is used to replace SRCID global bits of commands coming from external DMA peripherals by the IOB cluster global bits. This way, the responses for DMA peripheral commands, will come through the same IOB. In the same manner, the DMA_RSP FSM masks the global bits of RSRCID before sending to DMA external peripherals.
  • introduction of an IO transaction table in the CONFIG_CMD FSM. This table is used to store SRCID and TRDID of incoming commands from the INT network. The SRCID and TRDID of these commands is replaced by the IOB IOX SRCID and table index respectively. The goal is to force that responses to these commands come back trough the same IOB. The CONFIG_RSP FSM restores both SRCID and TRDID by reading the table.
File:
1 edited

Legend:

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

    r712 r715  
    66 *
    77 * SOCLIB_LGPL_HEADER_BEGIN
    8  * 
     8 *
    99 * This file is part of SoCLib, GNU LGPLv2.1.
    10  * 
     10 *
    1111 * SoCLib is free software; you can redistribute it and/or modify it
    1212 * under the terms of the GNU Lesser General Public License as published
    1313 * by the Free Software Foundation; version 2.1 of the License.
    14  * 
     14 *
    1515 * SoCLib is distributed in the hope that it will be useful, but
    1616 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1717 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1818 * Lesser General Public License for more details.
    19  * 
     19 *
    2020 * You should have received a copy of the GNU Lesser General Public
    2121 * License along with SoCLib; if not, write to the Free Software
    2222 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    2323 * 02110-1301 USA
    24  * 
     24 *
    2525 * SOCLIB_LGPL_HEADER_END
    2626 */
     
    4444// to a (up to) 40 bits physical address by a standard SoCLib generic TLB.
    4545// In case of TLB MISS, the DMA transaction is stalled until the TLB is updated.
    46 // In case of page fault or read_only violation (illegal access), a VCI error 
     46// In case of page fault or read_only violation (illegal access), a VCI error
    4747// is returned to the faulty peripheral, and a IOMMU WTI is sent.
    4848/////////////////////////////////////////////////////////////////////////////////
     
    6262////////////////////////////////////////////////////////////////////////////////
    6363
    64  
     64
    6565///////TODO List///////////////////////////////////////////////////////////////
    6666// - Ne pas garder tous les champs WRITE CMD dans les FIFO a chaque flit
     
    7777#include "generic_tlb.h"
    7878#include "mapping_table.h"
    79 #include "address_decoding_table.h"
     79#include "address_decoding_table.h"
     80#include "address_masking_table.h"
    8081#include "static_assert.h"
    8182#include "vci_initiator.h"
    8283#include "vci_target.h"
     84#include "transaction_tab_io.h"
    8385#include "../../../include/soclib/io_bridge.h"
    8486
     
    101103    typedef typename vci_param_int::be_t            int_be_t;
    102104
    103     // Other fields must be equal   
    104     typedef typename vci_param_int::fast_addr_t     vci_addr_t; 
    105     typedef typename vci_param_int::srcid_t         vci_srcid_t; 
     105    // Other fields must be equal
     106    typedef typename vci_param_int::fast_addr_t     vci_addr_t;
     107    typedef typename vci_param_int::srcid_t         vci_srcid_t;
    106108    typedef typename vci_param_int::trdid_t         vci_trdid_t;
    107109    typedef typename vci_param_int::pktid_t         vci_pktid_t;
     
    116118    typedef typename vci_param_int::rerror_t        vci_rerror_t;
    117119
    118     enum 
    119     {
    120         CACHE_LINE_MASK    = 0xFFFFFFFFC0LL, 
    121         PPN1_MASK          = 0x0007FFFF, 
    122         PPN2_MASK          = 0x0FFFFFFF, 
    123         K_PAGE_OFFSET_MASK = 0x00000FFF, 
     120    enum
     121    {
     122        CACHE_LINE_MASK    = 0xFFFFFFFFC0LL,
     123        PPN1_MASK          = 0x0007FFFF,
     124        PPN2_MASK          = 0x0FFFFFFF,
     125        K_PAGE_OFFSET_MASK = 0x00000FFF,
    124126        M_PAGE_OFFSET_MASK = 0x001FFFFF,
    125127        PTE2_LINE_OFFSET   = 0x00007000, // bits 12,13,14.
    126         PTE1_LINE_OFFSET   = 0x01E00000, // bits 21,22,23,24 
    127     };
    128  
     128        PTE1_LINE_OFFSET   = 0x01E00000, // bits 21,22,23,24
     129    };
     130
    129131    // States for DMA_CMD FSM (from IOX to RAM)
    130     enum dma_cmd_fsm_state 
    131     { 
     132    enum dma_cmd_fsm_state
     133    {
    132134        DMA_CMD_IDLE,
    133135        DMA_CMD_DMA_REQ,
     
    138140        DMA_CMD_TLB_MISS_WAIT,
    139141    };
    140    
    141     // States for DMA_RSP FSM 
    142     enum dma_rsp_fsm_state 
    143     { 
     142
     143    // States for DMA_RSP FSM
     144    enum dma_rsp_fsm_state
     145    {
    144146        DMA_RSP_IDLE_DMA,
    145147        DMA_RSP_IDLE_WTI,
     
    149151        DMA_RSP_PUT_ERR,
    150152    };
    151    
     153
    152154    // States for TLB_MISS FSM
    153     enum dma_tlb_fsm_state 
    154     {   
     155    enum dma_tlb_fsm_state
     156    {
    155157        TLB_IDLE,
    156158        TLB_MISS,
     
    158160        TLB_PTE1_SELECT,
    159161        TLB_PTE1_UPDT,
    160         TLB_PTE2_GET,                                                 
     162        TLB_PTE2_GET,
    161163        TLB_PTE2_SELECT,
    162164        TLB_PTE2_UPDT,
     
    164166        TLB_RETURN,
    165167        TLB_INVAL_CHECK,
    166         };
    167    
    168     // States for CONFIG_CMD FSM 
    169     enum config_cmd_fsm_state 
    170     { 
     168    };
     169
     170    // States for CONFIG_CMD FSM
     171    enum config_cmd_fsm_state
     172    {
    171173        CONFIG_CMD_IDLE,
    172         CONFIG_CMD_NEXT,
     174        CONFIG_CMD_WAIT,
     175        CONFIG_CMD_HI,
     176        CONFIG_CMD_LO,
    173177        CONFIG_CMD_PUT,
    174178        CONFIG_CMD_RSP,
    175         };
    176    
    177     // states for CONFIG_RSP FSM 
    178     enum config_rsp_fsm_state 
    179     { 
     179    };
     180
     181    // states for CONFIG_RSP FSM
     182    enum config_rsp_fsm_state
     183    {
    180184        CONFIG_RSP_IDLE_IOX,
    181185        CONFIG_RSP_IDLE_LOC,
    182         CONFIG_RSP_PUT_LOW,
     186        CONFIG_RSP_PUT_LO,
    183187        CONFIG_RSP_PUT_HI,
    184188        CONFIG_RSP_PUT_UNC,
     
    186190
    187191    };
    188    
    189     // States for MISS_WTI_RSP FSM 
    190     enum miss_wti_rsp_state 
    191     { 
     192
     193    // States for MISS_WTI_RSP FSM
     194    enum miss_wti_rsp_state
     195    {
    192196        MISS_WTI_RSP_IDLE,
    193197        MISS_WTI_RSP_WTI_IOX,
    194198        MISS_WTI_RSP_WTI_MMU,
    195199        MISS_WTI_RSP_MISS,
    196         };
     200    };
    197201
    198202    // PKTID values for TLB MISS and WTI transactions
     
    203207        PKTID_WTI_MMU = 0xC,  // TSAR code for write
    204208    };
    205    
     209
    206210    // Miss types for iotlb
    207211    enum tlb_miss_type_e
    208212    {
    209         PTE1_MISS, 
     213        PTE1_MISS,
    210214        PTE2_MISS,
    211         };
    212    
     215    };
     216
    213217public:
    214218    sc_in<bool>                               p_clk;
    215219    sc_in<bool>                               p_resetn;
    216    
    217     soclib::caba::VciInitiator<vci_param_ext> p_vci_ini_ram; 
     220
     221    soclib::caba::VciInitiator<vci_param_ext> p_vci_ini_ram;
    218222
    219223    soclib::caba::VciTarget<vci_param_ext>    p_vci_tgt_iox;
     
    224228
    225229private:
    226     const size_t                                  m_words;
     230    const size_t                              m_words;
    227231
    228232    // INT & IOX Networks
    229233    std::list<soclib::common::Segment>        m_int_seglist;
    230     const vci_srcid_t                             m_int_srcid;      // SRCID on INT network
     234    const vci_srcid_t                         m_int_srcid;      // SRCID on INT network
    231235    std::list<soclib::common::Segment>        m_iox_seglist;
     236    const vci_srcid_t                         m_iox_srcid;      // SRCID on IOX network
     237
     238    // INT & RAM srcid masking table
     239    const AddressMaskingTable<uint32_t>       m_srcid_gid_mask;
     240    const AddressMaskingTable<uint32_t>       m_srcid_lid_mask;
    232241
    233242    // TLB parameters
    234     const size_t                                                  m_iotlb_ways;
    235     const size_t                                                  m_iotlb_sets;
    236 
    237     // debug variables 
     243    const size_t                              m_iotlb_ways;
     244    const size_t                              m_iotlb_sets;
     245
     246    // debug variables
    238247    uint32_t                                  m_debug_start_cycle;
    239248    bool                                      m_debug_ok;
     
    247256    sc_signal<uint32_t>         r_iommu_bvar;           // bad vaddr
    248257    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 
     258    sc_signal<uint32_t>         r_iommu_bad_id;         // faulty srcid
     259    sc_signal<bool>             r_iommu_wti_enable;     // enable IOB WTI
    251260    sc_signal<uint32_t>         r_iommu_wti_addr_lo;    // IOMMU WTI paddr (32 lsb)
    252261    sc_signal<uint32_t>         r_iommu_wti_addr_hi;    // IOMMU WTI paddr (32 msb)
    253262
    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)
    256  
    257         ///////////////////////////////////
     263    ///////////////////////////////////
    258264    // DMA_CMD FSM REGISTERS
    259265    ///////////////////////////////////
    260     sc_signal<int>              r_dma_cmd_fsm;         
     266    sc_signal<int>              r_dma_cmd_fsm;
    261267    sc_signal<vci_addr_t>       r_dma_cmd_paddr;                // output paddr
    262268
     
    275281    sc_signal<vci_rerror_t>     r_dma_cmd_to_dma_rsp_rerror;
    276282    sc_signal<ext_data_t>       r_dma_cmd_to_dma_rsp_rdata;
    277      
     283
    278284    sc_signal<bool>             r_dma_cmd_to_tlb_req;
    279     sc_signal<uint32_t>         r_dma_cmd_to_tlb_vaddr;         // input vaddr 
     285    sc_signal<uint32_t>         r_dma_cmd_to_tlb_vaddr;         // input vaddr
    280286
    281287    ///////////////////////////////////
     
    283289    ///////////////////////////////////
    284290    sc_signal<int>              r_dma_rsp_fsm;
    285    
     291
    286292    ///////////////////////////////////
    287293    // CONFIG_CMD FSM REGISTERS
     
    294300    sc_signal<bool>             r_config_cmd_to_config_rsp_req;
    295301    sc_signal<bool>             r_config_cmd_to_config_rsp_rerror;
    296     sc_signal<uint32_t>         r_config_cmd_to_config_rsp_rdata;
     302    sc_signal<int_data_t>       r_config_cmd_to_config_rsp_rdata;
     303    sc_signal<vci_srcid_t>      r_config_cmd_to_config_rsp_rsrcid;
     304    sc_signal<vci_trdid_t>      r_config_cmd_to_config_rsp_rtrdid;
     305    sc_signal<vci_pktid_t>      r_config_cmd_to_config_rsp_rpktid;
    297306
    298307    sc_signal<ext_data_t>       r_config_cmd_wdata;
     
    301310    sc_signal<vci_addr_t>       r_config_cmd_address;
    302311    sc_signal<vci_srcid_t>      r_config_cmd_srcid;
     312    sc_signal<vci_trdid_t>      r_config_cmd_trdid;
    303313    sc_signal<vci_pktid_t>      r_config_cmd_pktid;
    304     sc_signal<vci_trdid_t>      r_config_cmd_trdid;
    305314    sc_signal<vci_plen_t>       r_config_cmd_plen;
    306315    sc_signal<vci_clen_t>       r_config_cmd_clen;
     
    311320    sc_signal<vci_eop_t>        r_config_cmd_eop;
    312321
     322    TransactionTabIO            m_iox_transaction_tab;
     323
    313324    ///////////////////////////////////
    314325    // CONFIG_RSP FSM REGISTERS
    315326    ///////////////////////////////////
    316327    sc_signal<int>              r_config_rsp_fsm;
     328    sc_signal<vci_srcid_t>      r_config_rsp_rsrcid;
     329    sc_signal<vci_trdid_t>      r_config_rsp_rtrdid;
    317330
    318331    ///////////////////////////////////
    319332    // TLB FSM REGISTERS
    320333    ///////////////////////////////////
    321     sc_signal<int>              r_tlb_fsm;                          // state register
     334    sc_signal<int>              r_tlb_fsm;                  // state register
    322335    sc_signal<bool>             r_waiting_transaction;      // Flag for returning from
    323336    sc_signal<int>              r_tlb_miss_type;
    324         sc_signal<bool>             r_tlb_miss_error;
    325 
    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   
     337    sc_signal<bool>             r_tlb_miss_error;
     338
     339    sc_signal<vci_addr_t>       r_tlb_paddr;                // physical address of pte
     340    sc_signal<uint32_t>         r_tlb_pte_flags;            // pte1 or first word of pte2
     341    sc_signal<uint32_t>         r_tlb_pte_ppn;              // second word of pte2
     342    sc_signal<size_t>           r_tlb_way;                  // selected way in tlb
     343    sc_signal<size_t>           r_tlb_set;                  // selected set in tlb
    331344
    332345    uint32_t*                   r_tlb_buf_data;             // prefetch buffer for PTEs
    333346    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 
     347    sc_signal<vci_addr_t>       r_tlb_buf_tag;              // cache line number
     348    sc_signal<vci_addr_t>       r_tlb_buf_vaddr;            // vaddr for first PTE
    336349    sc_signal<bool>             r_tlb_buf_big_page;         // ???
    337350
     
    352365    sc_signal<vci_pktid_t>      r_miss_wti_rsp_to_dma_rsp_rpktid;
    353366
    354    
     367
    355368    /////////////////////////////////////////////////////
    356369    //  ALLOCATORS for CONFIG_RSP fifo & DMA_RSP fifo
    357370    /////////////////////////////////////////////////////
    358     sc_signal<bool>             r_alloc_fifo_config_rsp_local; 
    359 
    360    
     371    sc_signal<bool>             r_alloc_fifo_config_rsp_local;
     372
     373
    361374    //////////////////////////////////////////////////////////////////
    362     // IOTLB 
     375    // IOTLB
    363376    //////////////////////////////////////////////////////////////////
    364377    GenericTlb<vci_addr_t>      r_iotlb;
    365        
    366    
     378
     379
    367380    /////////////////////////
    368381    // FIFOs
     
    392405    GenericFifo<vci_eop_t>      m_dma_rsp_reop_fifo;
    393406    GenericFifo<vci_rerror_t>   m_dma_rsp_rerror_fifo;
    394        
     407
    395408    // output FIFO to VCI INI port on IOX network (VCI command)
    396409    GenericFifo<vci_addr_t>     m_config_cmd_addr_fifo;
     
    408421    GenericFifo<vci_cfixed_t>   m_config_cmd_cfixed_fifo;
    409422    GenericFifo<vci_clen_t>     m_config_cmd_clen_fifo;
    410    
    411     // output FIFO to VCI TGT port on INT network (VCI response) 
     423
     424    // output FIFO to VCI TGT port on INT network (VCI response)
    412425    GenericFifo<int_data_t>     m_config_rsp_data_fifo;
    413426    GenericFifo<vci_srcid_t>    m_config_rsp_rsrcid_fifo;
     
    416429    GenericFifo<vci_eop_t>      m_config_rsp_reop_fifo;
    417430    GenericFifo<vci_rerror_t>   m_config_rsp_rerror_fifo;
    418        
     431
    419432    // output FIFO to VCI_INI port on INT network (VCI command)
    420433    GenericFifo<vci_addr_t>     m_miss_wti_cmd_addr_fifo;
     
    432445    GenericFifo<vci_cfixed_t>   m_miss_wti_cmd_cfixed_fifo;
    433446    GenericFifo<vci_clen_t>     m_miss_wti_cmd_clen_fifo;
    434    
     447
    435448    ////////////////////////////////
    436449    // Activity counters
    437450    ////////////////////////////////
    438    
     451
    439452    uint32_t m_cpt_total_cycles;            // total number of cycles
    440    
     453
    441454    // TLB activity counters
    442455    uint32_t m_cpt_iotlb_read;              // number of iotlb read
    443456    uint32_t m_cpt_iotlb_miss;              // number of iotlb miss
    444457    uint32_t m_cost_iotlb_miss;             // number of wait cycles (not treatment itself)
    445     uint32_t m_cpt_iotlbmiss_transaction;   // number of tlb miss transactions 
     458    uint32_t m_cpt_iotlbmiss_transaction;   // number of tlb miss transactions
    446459    uint32_t m_cost_iotlbmiss_transaction;  // cumulated duration tlb miss transactions
    447460
     
    454467    // FSM activity counters
    455468    // unused on print_stats
    456     uint32_t m_cpt_fsm_dma_cmd          [32]; 
    457     uint32_t m_cpt_fsm_dma_rsp          [32]; 
    458     uint32_t m_cpt_fsm_tlb              [32]; 
    459     uint32_t m_cpt_fsm_config_cmd       [32]; 
    460     uint32_t m_cpt_fsm_config_rsp       [32]; 
     469    uint32_t m_cpt_fsm_dma_cmd          [32];
     470    uint32_t m_cpt_fsm_dma_rsp          [32];
     471    uint32_t m_cpt_fsm_tlb              [32];
     472    uint32_t m_cpt_fsm_config_cmd       [32];
     473    uint32_t m_cpt_fsm_config_rsp       [32];
    461474    uint32_t m_cpt_fsm_miss_wti_rsp     [32];
    462  
     475
    463476protected:
    464477
     
    468481
    469482    VciIoBridge(
    470         sc_module_name insname,
    471         const    soclib::common::MappingTable  &mt_ext,      // external network
    472         const    soclib::common::MappingTable  &mt_int,      // internal network
    473         const    soclib::common::MappingTable  &mt_iox,      // iox network
    474         const    soclib::common::IntTab        &int_tgtid,   // INT network TGTID
    475         const    soclib::common::IntTab        &int_srcid,   // INT network SRCID
    476         const    soclib::common::IntTab        &iox_tgtid,   // IOX network TGTID
    477         const    size_t                        dcache_words,
    478         const    size_t                        iotlb_ways,
    479         const    size_t                        iotlb_sets,
    480         const    uint32_t                      debug_start_cycle,
    481         const    bool                          debug_ok );
     483        sc_module_name                      insname,
     484        const soclib::common::MappingTable  &mt_ext,      // external network
     485        const soclib::common::MappingTable  &mt_int,      // internal network
     486        const soclib::common::MappingTable  &mt_iox,      // iox network
     487        const soclib::common::IntTab        &int_tgtid,   // INT network TGTID
     488        const soclib::common::IntTab        &int_srcid,   // INT network SRCID
     489        const soclib::common::IntTab        &iox_tgtid,   // IOX network TGTID
     490        const soclib::common::IntTab        &iox_srcid,   // IOX network SRCID
     491        const size_t                        dcache_words,
     492        const size_t                        iotlb_ways,
     493        const size_t                        iotlb_sets,
     494        const uint32_t                      debug_start_cycle,
     495        const bool                          debug_ok );
    482496
    483497    ~VciIoBridge();
     
    486500    void clear_stats();
    487501    void print_trace(size_t mode = 0);
    488    
     502
    489503
    490504private:
Note: See TracChangeset for help on using the changeset viewer.