source: trunk/modules/vci_io_bridge/caba/source/include/vci_io_bridge.h @ 405

Last change on this file since 405 was 405, checked in by fraga, 11 years ago

VCI_IO_BRIDGE: Adding some casts to handle the different VCI fields sizes on
each network.

File size: 23.6 KB
Line 
1/* -*- c++ -*-
2 * File : vci_io_bridge.h
3 * Copyright (c) UPMC, Lip6, SoC
4 * Date : 16/04/2012
5 *
6 * SOCLIB_LGPL_HEADER_BEGIN
7 *
8 * This file is part of SoCLib, GNU LGPLv2.1.
9 *
10 * SoCLib is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published
12 * by the Free Software Foundation; version 2.1 of the License.
13 *
14 * SoCLib is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with SoCLib; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 *
24 * SOCLIB_LGPL_HEADER_END
25 */
26
27//////Utilisation Considerations////////////////////////////////////////////////
28//
29// - IOMMU PTPR pointer must fit in 32 bits (with a classical 2 level 4K page
30//   table in a 32 bit virtual space, it means a maximum of 45 bits in physical
31//   address)
32//
33// - Physical address must fit in two 32 bit words
34//
35// - Maximal number of flits in a write transaction cannot be bigger than (n° of
36//   words in a chache line)/2
37//
38// - Page Tables must have the format used in TSAR (compatible with component
39//   generic_tlb)
40//
41// - IO's segment size must be the same in both networks
42//
43// - Write operations on IOMMU configuration registers (PTPR, ACTIVE) can only
44//   be done when DMA_TLB FSM is IDLE. It should, preferably, be done before
45//   starting any transfers. Pseudo register INVAL may be modified any time.
46//
47// - Similarly, write operations on the interruptions registers can only be done
48//   when the dedicated FSM is IDLE.               
49////////////////////////////////////////////////////////////////////////////////
50
51 
52///////TODO List///////////////////////////////////////////////////////////////
53//
54// Tableau de correspondance d'adresses physique - IO (pour CONFIG_CMD)
55//
56// Conversion 32 (entree) à 64 (sortie) bits (champ data). Dans les deux senses (CMD et RSP)
57//
58// Ne pas garder tous les champs WRITE CMD dans les FIFO a chaque flit
59// (seulement 'data' et 'be')
60///////////////////////////////////////////////////////////////////////////////
61
62#ifndef SOCLIB_CABA_VCI_IO_BRIDGE_H
63#define SOCLIB_CABA_VCI_IO_BRIDGE_H
64
65#include <inttypes.h>
66#include <systemc>
67#include "caba_base_module.h"
68#include "generic_fifo.h"
69#include "generic_tlb.h"
70#include "mapping_table.h"
71#include "address_decoding_table.h"
72#include "static_assert.h"
73#include "transaction_tab_io.h"
74#include "vci_initiator.h"
75#include "vci_target.h"
76
77namespace soclib {
78namespace caba {
79
80using namespace soclib::common;
81
82////////////////////////////////////////////
83template<typename vci_param_d,typename vci_param_x, typename vci_param_io >
84class VciIoBridge
85////////////////////////////////////////////
86    : public soclib::caba::BaseModule
87{
88    typedef uint32_t tag_t;
89    typedef uint32_t type_t;
90   
91    // Address field may change between direct, extenal and IO network
92    typedef typename vci_param_d::addr_t        paddr_t; 
93    typedef typename vci_param_x::addr_t        paddr_t_x; // Just the cache line, for example
94    typedef typename vci_param_io::addr_t       vaddr_t;
95   
96    // Data field may change for external network
97    typedef typename vci_param_x::data_t      vci_data_t_x;
98    typedef typename vci_param_x::be_t        vci_be_t_x;
99    // Srcid field may change for external network
100    typedef typename vci_param_x::srcid_t     vci_srcid_t_x;
101   
102    // Other fields must coincide   
103    typedef typename vci_param_d::srcid_t     vci_srcid_t; 
104    typedef typename vci_param_d::data_t      vci_data_t;   
105    typedef typename vci_param_d::be_t        vci_be_t;
106    typedef typename vci_param_d::trdid_t     vci_trdid_t;
107    typedef typename vci_param_d::pktid_t     vci_pktid_t;
108    typedef typename vci_param_d::plen_t      vci_plen_t;
109    typedef typename vci_param_d::cmd_t       vci_cmd_t;
110    typedef typename vci_param_d::contig_t    vci_contig_t;
111    typedef typename vci_param_d::eop_t       vci_eop_t;
112    typedef typename vci_param_d::const_t     vci_cons_t;
113    typedef typename vci_param_d::wrap_t      vci_wrap_t;
114    typedef typename vci_param_d::clen_t      vci_clen_t;
115    typedef typename vci_param_d::cfixed_t    vci_cfixed_t;
116
117    typedef typename vci_param_d::rerror_t    vci_rerror_t;
118
119    enum {
120        CACHE_LINE_MASK = 0xFFFFFFFFC0, 
121        PPN1_MASK = 0x0007FFFF, 
122        PPN2_MASK = 0x0FFFFFFF, 
123        K_PAGE_OFFSET_MASK = 0x00000FFF, 
124        M_PAGE_OFFSET_MASK = 0x001FFFFF,
125        PTE2_LINE_OFFSET   = 0x00007000, // bits 12,13,14.
126        PTE1_LINE_OFFSET   = 0x01E00000, // bits 21,22,23,24
127    };
128 
129    //DMA (from Peripherals to XRAM)
130    enum dma_cmd_fsm_state { 
131        DMA_CMD_IDLE,
132        DMA_CMD_TRT_LOCK,
133        DMA_CMD_TRT_WAIT,
134        DMA_CMD_TRT_SET,
135        DMA_CMD_FIFO_PUT,
136        DMA_CMD_FIFO_MISS_PUT,
137        DMA_CMD_TLB_MISS_WAIT,
138        DMA_CMD_TLB_MISS_STORE,
139        DMA_CMD_ERROR,
140    };
141   
142    enum dma_rsp_fsm_state { 
143        DMA_RSP_IDLE,
144        DMA_RSP_TRT_LOCK,
145        DMA_RSP_FIFO_PUT, 
146        DMA_RSP_FIFO_ERROR_PUT,
147    };
148   
149    // Allocates the transaction_tab_dma
150    enum alloc_trt_dma_fsm_state {
151        ALLOC_TRT_DMA_CMD,
152        ALLOC_TRT_DMA_RSP
153    };
154     
155
156    enum dma_tlb_fsm_state {   
157        DMA_TLB_IDLE,
158        DMA_TLB_MISS,
159        DMA_TLB_PTE1_GET,
160        DMA_TLB_PTE1_SELECT,
161        DMA_TLB_PTE1_UPDT,
162        DMA_TLB_PTE2_GET,                                                 
163        DMA_TLB_PTE2_SELECT,
164        DMA_TLB_PTE2_UPDT,
165        DMA_TLB_WAIT_TRANSACTION,
166        DMA_TLB_RETURN,
167        // Treatment of CONFIG FSM request
168        DMA_TLB_INVAL_CHECK,
169        DMA_TLB_INVAL_SCAN
170        };
171   
172    //CONFIG (from Direct Network to Peripherals)
173    enum config_cmd_fsm_state { 
174        CONFIG_CMD_IDLE,
175        CONFIG_CMD_TRT_LOCK,
176        CONFIG_CMD_TRT_WAIT,
177        CONFIG_CMD_TRT_SET,
178        CONFIG_CMD_FIFO_PUT,
179       
180        // IOB private configuration segment
181        CONFIG_CMD_PTPR_WRITE,
182        CONFIG_CMD_PTPR_READ,
183        CONFIG_CMD_ACTIVE_WRITE,
184        CONFIG_CMD_ACTIVE_READ,
185        CONFIG_CMD_BVAR_READ,
186        CONFIG_CMD_ETR_READ,
187        CONFIG_CMD_BAD_ID_READ,
188        CONFIG_CMD_INVAL_REQ,
189        CONFIG_CMD_INVAL,
190        CONFIG_CMD_IT_ADDR_IOMMU_WRITE_1,
191        CONFIG_CMD_IT_ADDR_IOMMU_WRITE_2,
192        CONFIG_CMD_IT_ADDR_IOMMU_READ_1,
193        CONFIG_CMD_IT_ADDR_IOMMU_READ_2,
194        CONFIG_CMD_IT_ADDR_WRITE_1,
195        CONFIG_CMD_IT_ADDR_WRITE_2,
196        CONFIG_CMD_IT_ADDR_READ_1,
197        CONFIG_CMD_IT_ADDR_READ_2,
198        CONFIG_CMD_ERROR_WAIT,
199        CONFIG_CMD_ERROR_RSP
200        };
201   
202    enum config_rsp_fsm_state { 
203        CONFIG_RSP_IDLE,
204        CONFIG_RSP_TRT_LOCK,
205        CONFIG_RSP_FIFO_PUT
206    };
207   
208    // Allocates the transaction_tab_dma
209    enum alloc_trt_config_fsm_state {
210        ALLOC_TRT_CONFIG_CMD,
211        ALLOC_TRT_CONFIG_RSP
212        };
213   
214    //MISS TRANSACTIONS (to Direct Network)
215    enum miss_init_fsm_state { 
216        MISS_INIT_IDLE_MISS,
217        MISS_INIT_IDLE_IRQ,
218        MISS_INIT_IRQ_CMD,
219        MISS_INIT_IRQ_RSP,
220        MISS_INIT_TLB_MISS_CMD,
221        MISS_INIT_TLB_MISS_RSP
222        };
223   
224    /////////////////////////////////////////////////////////////////
225
226    // Configuration Error Type 
227    enum config_error_type {
228        READ_OK     = 0, 
229        READ_ERROR  = 1, 
230        WRITE_OK    = 2,
231        WRITE_ERROR = 3
232        };
233 
234    // Miss types for iotlb
235    enum tlb_miss_type_e
236    {
237        PTE1_MISS, 
238        PTE2_MISS
239        };
240   
241    // IOB Configuration registers
242    // Required segment size = (8 + 2*nb_periph) words
243    enum {
244        IOB_IOMMU_PTPR = 0,     // R/W  : Page Table Pointer Register
245        IOB_IOMMU_ACTIVE = 1,   // R/W  : IOMMU activated if not 0
246        IOB_IOMMU_BVAR = 2,     // R    : Bad Virtual Address
247        IOB_IOMMU_ETR = 3,      // R    : Error type
248        IOB_IOMMU_BAD_ID = 4,   // R    : Faulty peripheral Index
249        IOB_INVAL_PTE = 5,      //   W  : Invalidate PTE. Virtual Address
250        IOB_IT_ADDR_IOMMU_LO = 6,    // R/W
251        IOB_IT_ADDR_IOMMU_HI = 7,    // R/W
252        IOB_IT_ADDR_BEGIN = 8        // R/W : One register by IO
253                                     // Addressed by two 32-bit words each
254    };
255
256   
257    // Error Type
258    enum mmu_error_type_e
259    {
260        MMU_NONE                      = 0x0000, // None
261        MMU_WRITE_ACCES_VIOLATION     = 0x0008, // Write access of write access to a non writable page (bit W in flags)
262        MMU_WRITE_PT1_ILLEGAL_ACCESS  = 0x0040, // Write access of Bus Error accessing Table 1       
263        MMU_READ_PT1_UNMAPPED         = 0x1001, // Read access of Page fault on Page Table 1   
264        MMU_READ_PT2_UNMAPPED         = 0x1002, // Read access of Page fault on Page Table 2 
265        MMU_READ_PT1_ILLEGAL_ACCESS   = 0x1040, // Read access of Bus Error in Table1 access     
266        MMU_READ_PT2_ILLEGAL_ACCESS   = 0x1080, // Read access of Bus Error in Table2 access   
267        MMU_READ_DATA_ILLEGAL_ACCESS  = 0x1100, // Read access of Bus Error in cache access
268    };
269   
270
271public:
272    sc_in<bool>                             p_clk;
273    sc_in<bool>                             p_resetn;
274    sc_in<bool>                             *p_irq_in;     
275   
276    soclib::caba::VciInitiator<vci_param_x>     p_vci_ini_dma; // XRAM Noc
277    soclib::caba::VciTarget<vci_param_io>       p_vci_tgt_dma;
278   
279    soclib::caba::VciInitiator<vci_param_io>    p_vci_ini_config;
280    soclib::caba::VciTarget<vci_param_d>        p_vci_tgt_config;
281   
282    soclib::caba::VciInitiator<vci_param_d>     p_vci_ini_miss;
283
284private:
285    const size_t        m_words;
286    const size_t    m_nb_periph;
287
288    // STRUCTURAL PARAMETERS
289    // soclib::common::AddressDecodingTable<unsigned long, bool>   m_locality_table_config;
290    // soclib::common::AddressDecodingTable<unsigned long, int>    m_routing_table_config;
291    //const soclib::common::MappingTable&                   m_mtio;
292   
293    uint32_t                                    m_transaction_tab_dma_lines;
294    TransactionTabIO                            m_transaction_tab_dma;  // dma transaction table
295   
296    uint32_t                                    m_transaction_tab_config_lines;
297    TransactionTabIO                            m_transaction_tab_config;       // config transaction table
298   
299    // Direct Network
300    const soclib::common::Segment                               m_segment_config;
301    const vci_srcid_t                                           m_srcid_miss;
302    // XRAM Network
303    const vci_srcid_t_x                                         m_srcid_dma;
304    // IO Network
305    const soclib::common::Segment                               m_segment_io;
306    const vci_srcid_t                                           m_srcid_config;
307
308    const size_t                                                m_iotlb_ways;
309    const size_t                                                m_iotlb_sets;
310    const size_t                                                m_paddr_nbits; 
311
312
313    /////////////////////////////////////////////
314    // debug variables (for each FSM)
315    /////////////////////////////////////////////
316    uint32_t                            m_debug_start_cycle;
317    bool                                m_debug_ok;
318   
319    bool                                m_debug_dma_cmd_fsm;
320    bool                                m_debug_dma_rsp_fsm;
321    bool                                m_debug_dma_tlb_fsm;
322    bool                                m_debug_config_cmd_fsm;
323    bool                                m_debug_config_rsp_fsm;
324    bool                                m_debug_miss_init_fsm;
325
326    ///////////////////////////////
327    // MEMORY MAPPED REGISTERS
328    ///////////////////////////////
329    sc_signal<uint32_t>     r_iommu_ptpr;       // page table pointer register
330    sc_signal<bool>         r_iommu_active;         // iotlb mode
331    sc_signal<uint32_t>     r_iommu_bvar;       // iommu bad address
332    sc_signal<uint32_t>     r_iommu_etr;        // iommu error type
333    sc_signal<uint32_t>     r_iommu_bad_id;     // ID of the peripheral that tried bad operation
334   
335    sc_signal<paddr_t>     r_it_addr_iommu;        // iommu error type
336    paddr_t                *r_it_addr;        // iommu error type
337 
338        ///////////////////////////////////
339    // DMA_CMD FSM REGISTERS
340    ///////////////////////////////////
341    sc_signal<int>          r_dma_cmd_fsm;                              // state register
342    sc_signal<int>          r_dma_cmd_fsm_save; //saves current state when miss interruption happens
343    sc_signal<bool>         r_miss_interrupt;
344   
345    sc_signal<int>          r_dma_cmd_count;
346    sc_signal<vci_trdid_t>  r_dma_cmd_trt_index; 
347    sc_signal<paddr_t>      r_dma_paddr;
348   
349    GenericFifo<paddr_t>        m_dma_cmd_addr_fifo;
350    //GenericFifo<size_t>       m_dma_cmd_length_fifo;
351    GenericFifo<vci_srcid_t>    m_dma_cmd_srcid_fifo;
352    GenericFifo<vci_trdid_t>    m_dma_cmd_trdid_fifo;
353    GenericFifo<vci_pktid_t>    m_dma_cmd_pktid_fifo;
354    GenericFifo<vci_be_t>       m_dma_cmd_be_fifo;
355    GenericFifo<vci_cmd_t>      m_dma_cmd_cmd_fifo;
356    GenericFifo<vci_contig_t>   m_dma_cmd_contig_fifo;
357    GenericFifo<vci_data_t>     m_dma_cmd_data_fifo;
358    GenericFifo<vci_eop_t>      m_dma_cmd_eop_fifo;
359    GenericFifo<vci_cons_t>     m_dma_cmd_cons_fifo;
360    GenericFifo<vci_plen_t>     m_dma_cmd_plen_fifo;
361    GenericFifo<vci_wrap_t>     m_dma_cmd_wrap_fifo;
362    GenericFifo<vci_cfixed_t>   m_dma_cmd_cfixed_fifo;
363    GenericFifo<vci_clen_t>     m_dma_cmd_clen_fifo;
364
365    // Command storage registers (in case of miss tlb)
366    sc_signal<paddr_t>              r_miss_paddr; 
367    sc_signal<vci_cmd_t>            r_miss_cmd ;
368    sc_signal<vci_contig_t>         r_miss_contig; 
369    sc_signal<vci_cons_t>           r_miss_cons ;
370    sc_signal<vci_plen_t>           r_miss_plen ;
371    sc_signal<vci_wrap_t>           r_miss_wrap ;
372    sc_signal<vci_cfixed_t>         r_miss_cfixed; 
373    sc_signal<vci_clen_t>           r_miss_clen ;
374    sc_signal<vci_srcid_t>          r_miss_srcid ;
375    sc_signal<vci_trdid_t>          r_miss_trdid ;
376    sc_signal<vci_pktid_t>          r_miss_pktid ;
377    vci_data_t_x                    *r_miss_data ; 
378    vci_be_t                        *r_miss_be;
379   
380    // Error registers
381    sc_signal<int>          r_dma_error_type;   
382    sc_signal<vci_trdid_t>  r_dma_error_trdid; 
383    sc_signal<vci_pktid_t>  r_dma_error_pktid; 
384   
385    ///////////////////////////////////
386    // DMA_TLB FSM REGISTERS
387    ///////////////////////////////////
388    sc_signal<int>          r_dma_tlb_fsm;                  // state register
389    sc_signal<bool>         r_waiting_transaction;  // Flag for returning from
390                                                    // invalidation interruptions
391    sc_signal<int>          r_tlb_miss_type;
392
393    sc_signal<vaddr_t>      r_iotlb_vaddr;              // virtual address for a tlb miss
394    sc_signal<paddr_t>      r_iotlb_paddr;                  // physical address of pte
395    sc_signal<uint32_t>     r_iotlb_pte_flags;      // pte1 or first word of pte2
396    sc_signal<uint32_t>     r_iotlb_pte_ppn;        // second word of pte2
397    sc_signal<size_t>       r_iotlb_way;                    // selected way in tlb   
398    sc_signal<size_t>       r_iotlb_set;                    // selected set in tlb   
399   
400    //////////////////////////////////////////////////////////////////
401    // IOTLB 
402    //////////////////////////////////////////////////////////////////
403    GenericTlb<paddr_t>         r_iotlb;
404       
405    ///////////////////////////////////
406    // DMA_RSP FSM REGISTERS
407    ///////////////////////////////////
408    sc_signal<int>          r_dma_rsp_fsm;
409
410        sc_signal<vci_trdid_t>  r_dma_rtrdid; 
411        sc_signal<vci_srcid_t>  r_dma_rsrcid;   
412   
413    GenericFifo<vci_data_t>     m_dma_rsp_data_fifo;
414    GenericFifo<vci_srcid_t>    m_dma_rsp_rsrcid_fifo;
415    GenericFifo<vci_trdid_t>    m_dma_rsp_rtrdid_fifo;
416    GenericFifo<vci_pktid_t>    m_dma_rsp_rpktid_fifo;
417    GenericFifo<vci_eop_t>      m_dma_rsp_reop_fifo;
418    GenericFifo<vci_rerror_t>   m_dma_rsp_rerror_fifo;
419       
420    //Communication between DMA_CMD and DMA_RSP
421    sc_signal<bool>     r_dma_cmd_rsp_erase_req;
422        sc_signal<bool>     r_dma_cmd_error_req; 
423    //Communication between DMA_CMD and TLB
424    sc_signal<bool>     r_dma_tlb_req;
425    sc_signal<bool>     r_tlb_dma_untreated; 
426        sc_signal<bool>     r_dma_tlb_error_req; 
427    sc_signal<int>      r_tlb_error_type;   
428    //Communication betweeen TLB and CONFIG_CMD
429    sc_signal<bool>         r_config_tlb_req;
430    sc_signal<vaddr_t>      r_config_tlb_inval_vaddr;
431   
432    ///////////////////////////////////
433    // ALLOC_TRT_DMA FSM REGISTERS
434    ///////////////////////////////////
435    sc_signal<int>          r_alloc_trt_dma_fsm;                        // state register
436
437
438    ///////////////////////////////////
439    // CONFIG_CMD FSM REGISTERS
440    ///////////////////////////////////
441    sc_signal<int>          r_config_cmd_fsm;                   // state register
442   
443    sc_signal<vci_trdid_t>       r_config_cmd_trt_index; 
444   
445    GenericFifo<paddr_t>        m_config_cmd_addr_fifo;
446    //GenericFifo<size_t>       m_config_cmd_length_fifo;
447    GenericFifo<vci_srcid_t>    m_config_cmd_srcid_fifo;
448    GenericFifo<vci_trdid_t>    m_config_cmd_trdid_fifo;
449    GenericFifo<vci_pktid_t>    m_config_cmd_pktid_fifo;
450    GenericFifo<vci_be_t>       m_config_cmd_be_fifo;
451    GenericFifo<vci_cmd_t>      m_config_cmd_cmd_fifo;
452    GenericFifo<vci_contig_t>   m_config_cmd_contig_fifo;
453    GenericFifo<vci_data_t>     m_config_cmd_data_fifo;
454    GenericFifo<vci_eop_t>      m_config_cmd_eop_fifo;
455    GenericFifo<vci_cons_t>     m_config_cmd_cons_fifo;
456    GenericFifo<vci_plen_t>     m_config_cmd_plen_fifo;
457    GenericFifo<vci_wrap_t>     m_config_cmd_wrap_fifo;
458    GenericFifo<vci_cfixed_t>   m_config_cmd_cfixed_fifo;
459    GenericFifo<vci_clen_t>     m_config_cmd_clen_fifo;
460   
461   
462    // Private configuration registers
463    sc_signal<int>          r_config_error_type; // rerror field
464    sc_signal<vci_data_t>   r_config_first_word;   
465    sc_signal<int>          r_it_index;
466   
467    GenericFifo<vci_data_t>   m_config_local_data_fifo;
468    GenericFifo<vci_srcid_t>  m_config_local_rsrcid_fifo;
469    GenericFifo<vci_trdid_t>  m_config_local_rtrdid_fifo;
470    GenericFifo<vci_pktid_t>  m_config_local_rpktid_fifo;
471    GenericFifo<vci_eop_t>    m_config_local_reop_fifo;
472    GenericFifo<vci_rerror_t> m_config_local_rerror_fifo;
473    sc_signal<vaddr_t>      r_config_vaddr;
474   
475
476    ///////////////////////////////////
477    // CONFIG_RSP FSM REGISTERS
478    ///////////////////////////////////
479    sc_signal<int>          r_config_rsp_fsm;
480
481        sc_signal<vci_trdid_t>  r_config_rtrdid; 
482        sc_signal<vci_srcid_t>  r_config_rsrcid;
483   
484    GenericFifo<vci_data_t>   m_config_rsp_data_fifo;
485    GenericFifo<vci_srcid_t>  m_config_rsp_rsrcid_fifo;
486    GenericFifo<vci_trdid_t>  m_config_rsp_rtrdid_fifo;
487    GenericFifo<vci_pktid_t>  m_config_rsp_rpktid_fifo;
488    GenericFifo<vci_eop_t>    m_config_rsp_reop_fifo;
489    GenericFifo<vci_rerror_t> m_config_rsp_rerror_fifo;
490       
491    // Defines priority between the two response FIFOs (local and remote)
492    sc_signal<bool>         r_config_rsp_fifo_local_priority; 
493                                                           
494    //Communication between CONFIG_CMD and CONFIG_RSP
495    sc_signal<bool>     r_config_cmd_rsp_erase_req; // used to signal an erasing on TRT table
496   
497    ///////////////////////////////////
498    // ALLOC_TRT_CONFIG FSM REGISTERS
499    ///////////////////////////////////
500    sc_signal<int>          r_alloc_trt_config_fsm;                             // state register
501
502    ///////////////////////////////////
503    // MISS_INIT FSM REGISTERS
504    ///////////////////////////////////
505    sc_signal<int>          r_miss_init_fsm;
506
507        sc_signal<vci_data_t>   r_miss_rdata;
508        sc_signal<vci_pktid_t>  r_miss_rpktid; 
509        sc_signal<vci_trdid_t>  r_miss_rtrdid; 
510        sc_signal<vci_rerror_t> r_miss_rerror; 
511        sc_signal<vci_eop_t>    r_miss_reop; 
512        //sc_signal<vci_data_t> r_miss_rsrcid;
513       
514    sc_signal<size_t>   r_miss_rsp_cpt;
515   
516    //IRQ
517        sc_signal<uint32_t>     r_irq_pending; 
518        sc_signal<uint32_t>     r_irq_mask; 
519        sc_signal<uint32_t>     r_irq_chosen; 
520
521
522    //Communication between TLB and MISS_INIT
523    sc_signal<bool>         r_tlb_miss_init_req;
524    sc_signal<bool>         r_miss_init_error; 
525   
526    ////////////////////////////////////
527    // MISS PREFETCH BUFFER
528    ///////////////////////////////////
529    //DMA_TLB FSM is its owner.
530    //CONFIG FSM must set a request in order to access the resource (invalidation)
531
532    // Proposition : Buffer with some lines (4, for example). It could be
533    // indexed from the bit 20.
534 
535    vci_data_t                *r_miss_buf_data;     // cache line data buffer
536    bool                    r_miss_buf_valid;       // For individual invalidation,
537                                                    // we could rather use the Valid bit at each PTE
538    sc_signal<paddr_t>      r_miss_buf_tag;         // chache line number 
539    sc_signal<paddr_t>      r_miss_buf_vaddr_begin; // Virtual address of the first PTE on the line
540   
541    bool                    r_miss_buf_first_level; // useful only if using both types of pages
542   
543    ////////////////////////////////
544    // Activity counters
545    ////////////////////////////////
546   
547    uint32_t m_cpt_total_cycles;            // total number of cycles
548   
549    // TLB activity counters
550    uint32_t m_cpt_iotlb_read;              // number of iotlb read
551    uint32_t m_cpt_iotlb_miss;              // number of iotlb miss
552    uint32_t m_cost_iotlb_miss;             // number of blocking cycles (not the treatment cycles itself)
553    uint32_t m_cpt_iotlbmiss_transaction;   // number of iotlb miss transactions to Mem Cache
554    uint32_t m_cost_iotlbmiss_transaction;  // cumulated duration for iotlb miss transactions
555
556    //Transaction Tabs (TRTs) activity counters
557    uint32_t m_cpt_trt_dma_full;            // DMA TRT full when a new command arrives
558    uint32_t m_cpt_trt_dma_full_cost;       // total number of cycles blocked
559    uint32_t m_cpt_trt_config_full;         // Config TRT full when a new command arrives
560    uint32_t m_cpt_trt_config_full_cost;    // total number of cycles blocked
561
562    // FSM activity counters
563    // unused on print_stats
564    uint32_t m_cpt_fsm_dma_cmd          [32]; 
565    uint32_t m_cpt_fsm_dma_rsp          [32]; 
566    uint32_t m_cpt_fsm_dma_tlb          [32]; 
567    uint32_t m_cpt_fsm_alloc_trt_dma    [32]; 
568    uint32_t m_cpt_fsm_config_cmd       [32]; 
569    uint32_t m_cpt_fsm_config_rsp       [32]; 
570    uint32_t m_cpt_fsm_alloc_trt_config [32]; 
571    uint32_t m_cpt_fsm_miss_init        [32];
572 
573protected:
574    SC_HAS_PROCESS(VciIoBridge);
575
576public:
577    VciIoBridge(
578        sc_module_name insname,
579        size_t nb_periph,                               // maximun is 32
580        const soclib::common::MappingTable  &mtx,       //external network
581        const soclib::common::MappingTable  &mtd,       //direct network
582        const soclib::common::MappingTable  &mtio,      //io network
583        const soclib::common::Segment       &seg_config_iob,
584        const soclib::common::IntTab &tgt_index_iocluster,
585//        const soclib::common::IntTab &tgt_index_config,     // Direct Noc
586        const soclib::common::IntTab &init_index_direct,    // Direct Noc
587        const soclib::common::IntTab &tgt_index_iospace,    // IO Noc
588        const soclib::common::IntTab &init_index_iospace,   // IO Noc
589        const soclib::common::IntTab &init_index_dma,       // XRAM Noc
590        size_t dcache_words,
591        size_t   iotlb_ways,
592        size_t   iotlb_sets,
593        uint32_t debug_start_cycle,
594        bool     debug_ok);
595
596    ~VciIoBridge();
597
598    void print_stats();
599    void clear_stats();
600    void print_trace(size_t mode = 0);
601   
602
603private:
604    void transition();
605    void genMoore();
606};
607
608}}
609
610#endif /* SOCLIB_CABA_VCI_CC_VCACHE_WRAPPER_V4_H */
611
612// Local Variables:
613// tab-width: 4
614// c-basic-offset: 4
615// c-file-offsets:((innamespace . 0)(inline-open . 0))
616// indent-tabs-mode: nil
617// End:
618
619// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
620
621
622
623
Note: See TracBrowser for help on using the repository browser.