source: trunk/modules/vci_cc_vcache_wrapper2/caba/source/include/vci_cc_vcache_wrapper2.h @ 2

Last change on this file since 2 was 2, checked in by nipo, 14 years ago

Import TSAR modules in TSAR's own svn

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Rev URL Revision"
  • Property svn:mime-type set to text/plain
File size: 25.1 KB
Line 
1/* -*- c++ -*-
2 * File : vci_cc_vcache_wrapper2.h
3 * Copyright (c) UPMC, Lip6, SoC
4 * Authors : Alain GREINER, Yang GAO
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#ifndef SOCLIB_CABA_VCI_CC_VCACHE_WRAPPER2_H
28#define SOCLIB_CABA_VCI_CC_VCACHE_WRAPPER2_H
29
30#include <inttypes.h>
31#include <systemc>
32#include "caba_base_module.h"
33#include "write_buffer.h"
34#include "generic_cache.h"
35#include "vci_initiator.h"
36#include "vci_target.h"
37#include "mapping_table.h"
38#include "generic_tlb.h"
39#include "static_assert.h"
40
41namespace soclib {
42namespace caba {
43
44using namespace sc_core;
45
46////////////////////////////////////////////
47template<typename vci_param, typename iss_t>
48class VciCcVCacheWrapper2
49////////////////////////////////////////////
50    : public soclib::caba::BaseModule
51{
52    typedef uint32_t vaddr_t;
53    typedef uint32_t data_t;
54    typedef uint32_t tag_t;
55    typedef uint32_t type_t;
56    typedef typename iss_t::DataOperationType data_op_t;
57
58    typedef typename vci_param::addr_t  paddr_t;
59    typedef typename vci_param::be_t    vci_be_t;
60        typedef typename vci_param::srcid_t vci_srcid_t;
61        typedef typename vci_param::trdid_t vci_trdid_t;
62        typedef typename vci_param::pktid_t vci_pktid_t;
63        typedef typename vci_param::plen_t  vci_plen_t;
64
65    enum icache_fsm_state_e { 
66        ICACHE_IDLE,                // 00
67        ICACHE_BIS,                 // 01
68        ICACHE_TLB1_READ,           // 02
69        ICACHE_TLB1_WRITE,          // 03
70        ICACHE_TLB1_UPDT,           // 04
71        ICACHE_TLB2_READ,           // 05
72        ICACHE_TLB2_WRITE,          // 06
73        ICACHE_TLB2_UPDT,           // 07
74        ICACHE_SW_FLUSH,            // 08
75        ICACHE_CACHE_FLUSH,         // 09
76        ICACHE_TLB_INVAL,           // 0a
77        ICACHE_CACHE_INVAL,         // 0b
78        ICACHE_MISS_WAIT,           // 0c
79        ICACHE_UNC_WAIT,            // 0d
80        ICACHE_MISS_UPDT,           // 0e
81        ICACHE_ERROR,               // 0f
82        ICACHE_CC_INVAL,            // 10
83        ICACHE_TLB_CC_INVAL,        // 11
84        ICACHE_TLB_FLUSH,           // 12
85    };
86
87    enum dcache_fsm_state_e { 
88        DCACHE_IDLE,                // 00
89        DCACHE_BIS,                 // 01
90        DCACHE_DTLB1_READ_CACHE,    // 02
91        DCACHE_TLB1_LL_WAIT,        // 03
92        DCACHE_TLB1_SC_WAIT,        // 04
93        DCACHE_TLB1_READ,           // 05
94        DCACHE_TLB1_READ_UPDT,      // 06
95        DCACHE_TLB1_UPDT,           // 07
96        DCACHE_DTLB2_READ_CACHE,    // 08
97        DCACHE_TLB2_LL_WAIT,        // 09
98        DCACHE_TLB2_SC_WAIT,        // 0a
99        DCACHE_TLB2_READ,           // 0b
100        DCACHE_TLB2_READ_UPDT,      // 0c
101        DCACHE_TLB2_UPDT,           // 0d
102        DCACHE_CTXT_SWITCH,         // 0e
103        DCACHE_ICACHE_FLUSH,        // 0f
104        DCACHE_DCACHE_FLUSH,        // 10
105        DCACHE_ITLB_INVAL,          // 11
106        DCACHE_DTLB_INVAL,          // 12
107        DCACHE_ICACHE_INVAL,        // 13
108        DCACHE_DCACHE_INVAL,        // 14
109        DCACHE_DCACHE_SYNC,         // 15
110        DCACHE_LL_DIRTY_WAIT,       // 16
111        DCACHE_SC_DIRTY_WAIT,       // 17
112        DCACHE_WRITE_UPDT,          // 18
113        DCACHE_WRITE_DIRTY,         // 19
114        DCACHE_WRITE_REQ,           // 1a
115        DCACHE_MISS_WAIT,           // 1b
116        DCACHE_MISS_UPDT,           // 1c
117        DCACHE_UNC_WAIT,            // 1d
118        DCACHE_ERROR,               // 1e
119        DCACHE_ITLB_READ,           // 1f
120        DCACHE_ITLB_UPDT,           // 20
121        DCACHE_ITLB_LL_WAIT,        // 21
122        DCACHE_ITLB_SC_WAIT,        // 22
123        DCACHE_CC_CHECK,            // 23
124        DCACHE_CC_INVAL,            // 24
125        DCACHE_CC_UPDT,             // 25
126        DCACHE_CC_NOP,              // 26
127        DCACHE_TLB_CC_INVAL,        // 27
128        DCACHE_ITLB_CLEANUP,        // 28
129    };
130
131    enum cmd_fsm_state_e {     
132        CMD_IDLE,                   // 00
133        CMD_ITLB_READ,              // 01
134        CMD_ITLB_ACC_LL,            // 02
135        CMD_ITLB_ACC_SC,            // 03
136        CMD_INS_MISS,               // 04
137        CMD_INS_UNC,                // 05
138        CMD_DTLB_READ,              // 06
139        CMD_DTLB_ACC_LL,            // 07
140        CMD_DTLB_ACC_SC,            // 08
141        CMD_DTLB_DIRTY_LL,          // 09
142        CMD_DTLB_DIRTY_SC,          // 0a
143        CMD_DATA_UNC,               // 0b
144        CMD_DATA_MISS,              // 0c
145        CMD_DATA_WRITE,             // 0d
146        CMD_INS_CLEANUP,            // 0e
147        CMD_DATA_CLEANUP,           // 0f
148    };
149
150    enum rsp_fsm_state_e {       
151        RSP_IDLE,                   // 00
152        RSP_ITLB_READ,              // 01
153        RSP_ITLB_ACC_LL,            // 02
154        RSP_ITLB_ACC_SC,            // 03
155        RSP_INS_MISS,               // 04
156        RSP_INS_UNC,                // 05
157        RSP_DTLB_READ,              // 06
158        RSP_DTLB_ACC_LL,            // 07
159        RSP_DTLB_ACC_SC,            // 08
160        RSP_DTLB_DIRTY_LL,          // 09
161        RSP_DTLB_DIRTY_SC,          // 0a
162        RSP_DATA_MISS,              // 0b
163        RSP_DATA_UNC,               // 0c
164        RSP_DATA_WRITE,             // 0d
165        RSP_INS_CLEANUP,            // 0e
166        RSP_DATA_CLEANUP,           // 0f
167    };
168
169    enum tgt_fsm_state_e { 
170        TGT_IDLE,                   // 00
171        TGT_UPDT_WORD,              // 01
172        TGT_UPDT_DATA,              // 02
173        TGT_REQ_BROADCAST,          // 03
174        TGT_REQ_DCACHE,             // 04
175        TGT_RSP_BROADCAST,          // 05
176        TGT_RSP_DCACHE,             // 06
177    };
178
179    enum inval_itlb_fsm_state_e {
180        INVAL_ITLB_IDLE,            // 00
181        INVAL_ITLB_CHECK,           // 01
182        INVAL_ITLB_INVAL,           // 02
183        INVAL_ITLB_CLEAR,           // 03
184    };
185
186    enum inval_dtlb_fsm_state_e {
187        INVAL_DTLB_IDLE,            // 00
188        INVAL_DTLB_CHECK,           // 01
189        INVAL_DTLB_INVAL,           // 02
190        INVAL_DTLB_CLEAR,           // 03
191    };
192
193    // TLB Mode ITLB / DTLB / ICACHE / DCACHE
194    enum {         
195        ALL_DEACTIVE = 0x0000,   // TLBs disactive caches disactive
196        INS_TLB_MASK    = 0x8,
197        DATA_TLB_MASK   = 0x4,
198        INS_CACHE_MASK  = 0x2,
199        DATA_CACHE_MASK = 0x1,
200    };
201
202    // Error Type
203    enum mmu_error_type_e {
204        MMU_NONE                      = 0x0000, // None
205        MMU_WRITE_PT1_UNMAPPED        = 0x0001, // Write access of Page fault on Page Table 1          (non fatal error)
206        MMU_WRITE_PT2_UNMAPPED        = 0x0002, // Write access of Page fault on Page Table 2          (non fatal error)
207        MMU_WRITE_PRIVILEGE_VIOLATION = 0x0004, // Write access of Protected access in user mode       (user error)
208        MMU_WRITE_ACCES_VIOLATION         = 0x0008, // Write access of write access to a non writable page (user error)
209        MMU_WRITE_UNDEFINED_XTN           = 0x0020, // Write access of undefined external access address   (user error)
210        MMU_WRITE_PT1_ILLEGAL_ACCESS  = 0x0040, // Write access of Bus Error accessing Table 1         (kernel error)
211        MMU_WRITE_PT2_ILLEGAL_ACCESS  = 0x0080, // Write access of Bus Error accessing Table 2         (kernel error)
212        MMU_WRITE_DATA_ILLEGAL_ACCESS = 0x0100, // Write access of Bus Error in cache access           (kernel error)
213        MMU_READ_PT1_UNMAPPED         = 0x1001, // Read access of Page fault on Page Table 1           (non fatal error)
214        MMU_READ_PT2_UNMAPPED         = 0x1002, // Read access of Page fault on Page Table 2           (non fatal error)
215        MMU_READ_PRIVILEGE_VIOLATION  = 0x1004, // Read access of Protected access in user mode            (user error)
216        MMU_READ_EXEC_VIOLATION           = 0x1010, // Exec access to a non exec page                      (user error)
217        MMU_READ_UNDEFINED_XTN        = 0x1020, // Read access of Undefined external access address    (user error)
218        MMU_READ_PT1_ILLEGAL_ACCESS   = 0x1040, // Read access of Bus Error in Table1 access           (kernel error)
219        MMU_READ_PT2_ILLEGAL_ACCESS   = 0x1080, // Read access of Bus Error in Table2 access           (kernel error)
220        MMU_READ_DATA_ILLEGAL_ACCESS  = 0x1100, // Read access of Bus Error in cache access            (kernel error)
221    };
222
223public:
224    sc_in<bool>                             p_clk;
225    sc_in<bool>                             p_resetn;
226    sc_in<bool>                             p_irq[iss_t::n_irq];
227    soclib::caba::VciInitiator<vci_param>   p_vci_ini;
228    soclib::caba::VciTarget<vci_param>      p_vci_tgt;
229
230private:
231    // STRUCTURAL PARAMETERS
232    soclib::common::AddressDecodingTable<uint32_t, bool>    m_cacheability_table;
233    const soclib::common::Segment                           m_segment;
234    iss_t                                                   m_iss;   
235    const vci_srcid_t                                       m_srcid;
236
237    const size_t  m_itlb_ways;
238    const size_t  m_itlb_sets;
239
240    const size_t  m_dtlb_ways;
241    const size_t  m_dtlb_sets;
242
243    const size_t  m_icache_ways;
244    const size_t  m_icache_sets;
245    const size_t  m_icache_yzmask;
246    const size_t  m_icache_words;
247
248    const size_t  m_dcache_ways;
249    const size_t  m_dcache_sets;
250    const size_t  m_dcache_yzmask;
251    const size_t  m_dcache_words;
252
253    const size_t  m_write_buf_size; 
254    const size_t  m_paddr_nbits; 
255
256    // instruction and data vcache tlb instances
257    soclib::caba::GenericCcTlb<paddr_t>    icache_tlb;
258    soclib::caba::GenericCcTlb<paddr_t>    dcache_tlb;
259
260    sc_signal<vaddr_t>      r_mmu_ptpr;             // page table pointer register
261    sc_signal<int>          r_mmu_mode;             // tlb mode register
262    sc_signal<int>          r_mmu_params;           // mmu parameters register
263    sc_signal<int>          r_mmu_release;          // mmu release register
264
265    // DCACHE FSM REGISTERS
266    sc_signal<int>          r_dcache_fsm;               // state register
267    sc_signal<paddr_t>      r_dcache_paddr_save;        // physical address
268    sc_signal<data_t>       r_dcache_wdata_save;        // write data
269    sc_signal<data_t>       r_dcache_rdata_save;        // read data
270    sc_signal<type_t>       r_dcache_type_save;         // access type
271    sc_signal<vci_be_t>     r_dcache_be_save;           // byte enable
272    sc_signal<bool>         r_dcache_cached_save;       // used by the write buffer
273    sc_signal<paddr_t>      r_dcache_tlb_paddr;         // physical address of tlb miss
274    sc_signal<bool>         r_dcache_dirty_save;        // used for TLB dirty bit update
275    sc_signal<size_t>       r_dcache_tlb_set_save;      // used for TLB dirty bit update
276    sc_signal<size_t>       r_dcache_tlb_way_save;      // used for TLB dirty bit update
277    sc_signal<vaddr_t>      r_dcache_id1_save;          // used by the PT1 bypass
278    sc_signal<paddr_t>      r_dcache_ptba_save;         // used by the PT1 bypass
279    sc_signal<bool>         r_dcache_ptba_ok;           // used by the PT1 bypass
280    sc_signal<data_t>       r_dcache_pte_update;        // used for page table update
281    sc_signal<data_t>       r_dcache_ppn_update;        // used for physical page number update
282    sc_signal<tag_t>        r_dcache_ppn_save;          // used for speculative cache access
283    sc_signal<tag_t>        r_dcache_vpn_save;          // used for speculative cache access
284    sc_signal<bool>         r_dtlb_translation_valid;   // used for speculative address
285    sc_signal<bool>         r_dcache_buf_unc_valid;     // used for uncached read
286    sc_signal<bool>         r_dcache_hit_p_save;        // used to save hit_p in case BIS
287
288    sc_signal<data_t>       r_dcache_error_type;        // software visible register
289    sc_signal<vaddr_t>      r_dcache_bad_vaddr;         // software visible register
290
291    sc_signal<bool>         r_dcache_miss_req;          // used for cached read miss
292    sc_signal<bool>         r_dcache_unc_req;           // used for uncached read miss
293    sc_signal<bool>         r_dcache_write_req;         // used for write
294    sc_signal<bool>         r_dcache_tlb_read_req;      // used for tlb ptba or pte read
295
296    sc_signal<bool>         r_dcache_llsc_reserved;     // used for check address reserved
297    sc_signal<paddr_t>      r_dcache_llsc_addr_save;    // used for save llsc address
298 
299    sc_signal<bool>         r_dcache_tlb_ll_acc_req;    // used for tlb access bit update
300    sc_signal<bool>         r_dcache_tlb_sc_acc_req;    // used for tlb access bit update
301    sc_signal<bool>         r_dcache_tlb_ll_dirty_req;  // used for tlb dirty bit update
302    sc_signal<bool>         r_dcache_tlb_sc_dirty_req;  // used for tlb dirty bit update
303    sc_signal<bool>         r_dcache_tlb_ptba_read;     // used for tlb ptba read when write dirty bit
304    sc_signal<bool>         r_dcache_xtn_req;           // used for xtn write for ICACHE
305
306    bool                    *r_dcache_in_itlb;          // indicates some words of dcache line in ins TLB
307    bool                    *r_dcache_in_dtlb;          // indicates some words of dcache line in data TLB
308
309    // coherence registers
310    sc_signal<int>          r_dcache_fsm_save;          // state save register
311    sc_signal<size_t>       r_dcache_way;
312    sc_signal<size_t>       r_dcache_set;
313    sc_signal<bool>         r_dcache_cleanup_req;       // data cleanup request
314    sc_signal<paddr_t>      r_dcache_cleanup_line;      // data cleanup NLINE
315    sc_signal<bool>         r_dcache_inval_rsp;         // data cache invalidate
316
317    // ICACHE FSM REGISTERS
318    sc_signal<int>          r_icache_fsm;               // state register
319    sc_signal<paddr_t>      r_icache_paddr_save;        // physical address
320    sc_signal<vaddr_t>      r_icache_id1_save;          // used by the PT1 bypass
321    sc_signal<paddr_t>      r_icache_ptba_save;         // used by the PT1 bypass
322    sc_signal<bool>         r_icache_ptba_ok;           // used by the PT1 bypass
323    sc_signal<data_t>       r_icache_pte_update;        // used for page table update
324    sc_signal<tag_t>        r_icache_ppn_save;          // used for speculative cache access
325    sc_signal<tag_t>        r_icache_vpn_save;          // used for speculative cache access
326    sc_signal<bool>         r_itlb_translation_valid;   // used for speculative physical address
327    sc_signal<bool>         r_icache_buf_unc_valid;     // used for uncached read
328
329    sc_signal<data_t>       r_icache_error_type;        // software visible registers
330    sc_signal<vaddr_t>      r_icache_bad_vaddr;         // software visible registers
331
332    sc_signal<bool>         r_icache_miss_req;          // used for cached read miss
333    sc_signal<bool>         r_icache_unc_req;           // used for uncached read miss
334    sc_signal<bool>         r_dcache_itlb_read_req;     // used for tlb ptba or pte read
335
336    sc_signal<bool>         r_dcache_itlb_ll_acc_req;   // used for tlb access bit update
337    sc_signal<bool>         r_dcache_itlb_sc_acc_req;   // used for tlb access bit update
338
339    sc_signal<bool>             r_itlb_read_dcache_req;     // used for instruction tlb miss, request in data cache
340    sc_signal<bool>             r_itlb_acc_dcache_req;          // used for itlb update access bit via dcache
341    sc_signal<bool>             r_dcache_rsp_itlb_error;        // used for data cache rsp error when itlb miss
342    sc_signal<data_t>       r_dcache_rsp_itlb_miss;             // used for dcache rsp data when itlb miss
343    sc_signal<data_t>       r_dcache_rsp_itlb_ppn;              // used for dcache rsp ppn when itlb miss
344
345    // coherence registers
346    sc_signal<int>          r_icache_fsm_save;          // state save register
347    sc_signal<size_t>       r_icache_way;
348    sc_signal<size_t>       r_icache_set;
349    sc_signal<bool>         r_icache_cleanup_req;       // ins cleanup request
350    sc_signal<paddr_t>      r_icache_cleanup_line;      // ins cleanup NLINE
351    sc_signal<bool>         r_icache_inval_rsp;         // ins cache invalidate
352
353    // VCI_CMD FSM REGISTERS
354    sc_signal<int>          r_vci_cmd_fsm;
355    sc_signal<size_t>       r_vci_cmd_min;       
356    sc_signal<size_t>       r_vci_cmd_max;       
357    sc_signal<size_t>       r_vci_cmd_cpt;     
358
359    // VCI_RSP FSM REGISTERS
360    sc_signal<int>          r_vci_rsp_fsm;
361    sc_signal<size_t>       r_vci_rsp_cpt;
362    sc_signal<bool>         r_vci_rsp_ins_error;
363    sc_signal<bool>         r_vci_rsp_data_error;
364
365    data_t                  *r_icache_miss_buf;   
366    data_t                  *r_dcache_miss_buf; 
367
368    // VCI_TGT FSM REGISTERS
369    data_t                  *r_tgt_buf;
370    bool                    *r_tgt_val;
371
372    sc_signal<int>          r_vci_tgt_fsm;
373    sc_signal<paddr_t>      r_tgt_addr;
374    sc_signal<size_t>       r_tgt_word;
375    sc_signal<bool>         r_tgt_update;
376    sc_signal<vci_srcid_t>  r_tgt_srcid;
377    sc_signal<vci_pktid_t>  r_tgt_pktid;
378    sc_signal<vci_trdid_t>  r_tgt_trdid;
379    sc_signal<vci_plen_t>   r_tgt_plen;
380    sc_signal<bool>         r_tgt_req;
381    sc_signal<bool>         r_tgt_icache_req;
382    sc_signal<bool>         r_tgt_dcache_req;
383    sc_signal<bool>         r_tgt_icache_rsp;
384    sc_signal<bool>         r_tgt_dcache_rsp;
385
386    // INVAL CHECK FSM
387    sc_signal<int>          r_inval_itlb_fsm;         
388    sc_signal<bool>         r_dcache_itlb_inval_req;
389    sc_signal<paddr_t>      r_dcache_itlb_inval_line;
390    sc_signal<bool>         r_itlb_cc_check_end;
391    sc_signal<size_t>       r_ccinval_itlb_way;
392    sc_signal<size_t>       r_ccinval_itlb_set;
393    sc_signal<bool>         r_icache_inval_tlb_rsp;
394    sc_signal<paddr_t>      r_icache_tlb_nline;
395
396    sc_signal<int>          r_inval_dtlb_fsm;         
397    sc_signal<bool>         r_dcache_dtlb_inval_req;
398    sc_signal<paddr_t>      r_dcache_dtlb_inval_line;
399    sc_signal<bool>         r_dtlb_cc_check_end;
400    sc_signal<size_t>       r_ccinval_dtlb_way;
401    sc_signal<size_t>       r_ccinval_dtlb_set;
402    sc_signal<bool>         r_dcache_inval_tlb_rsp;
403    sc_signal<paddr_t>      r_dcache_tlb_nline;
404
405    sc_signal<bool>         r_dcache_itlb_cleanup_req;
406    sc_signal<paddr_t>      r_dcache_itlb_cleanup_line;
407
408    sc_signal<bool>         r_dcache_dtlb_cleanup_req;
409    sc_signal<paddr_t>      r_dcache_dtlb_cleanup_line;
410
411    sc_signal<bool>         r_itlb_inval_req;
412    sc_signal<bool>         r_dcache_cc_check;
413
414    WriteBuffer<paddr_t>     r_wbuf;
415    GenericCache<paddr_t>    r_icache;
416    GenericCache<paddr_t>    r_dcache;
417
418    // Activity counters
419    uint32_t m_cpt_dcache_data_read;        // DCACHE DATA READ
420    uint32_t m_cpt_dcache_data_write;       // DCACHE DATA WRITE
421    uint32_t m_cpt_dcache_dir_read;         // DCACHE DIR READ
422    uint32_t m_cpt_dcache_dir_write;        // DCACHE DIR WRITE
423
424    uint32_t m_cpt_icache_data_read;        // ICACHE DATA READ
425    uint32_t m_cpt_icache_data_write;       // ICACHE DATA WRITE
426    uint32_t m_cpt_icache_dir_read;         // ICACHE DIR READ
427    uint32_t m_cpt_icache_dir_write;        // ICACHE DIR WRITE
428
429    uint32_t m_cpt_frz_cycles;              // number of cycles where the cpu is frozen
430    uint32_t m_cpt_total_cycles;                // total number of cycles
431
432    // Cache activity counters
433    uint32_t m_cpt_read;                    // total number of read data
434    uint32_t m_cpt_write;                   // total number of write data
435    uint32_t m_cpt_data_miss;               // number of read miss
436    uint32_t m_cpt_ins_miss;                // number of instruction miss
437    uint32_t m_cpt_unc_read;                // number of read uncached
438    uint32_t m_cpt_write_cached;            // number of cached write
439    uint32_t m_cpt_ins_read;                // number of instruction read
440
441    uint32_t m_cost_write_frz;              // number of frozen cycles related to write buffer         
442    uint32_t m_cost_data_miss_frz;          // number of frozen cycles related to data miss
443    uint32_t m_cost_unc_read_frz;           // number of frozen cycles related to uncached read
444    uint32_t m_cost_ins_miss_frz;           // number of frozen cycles related to ins miss
445
446    uint32_t m_cpt_imiss_transaction;       // number of VCI instruction miss transactions
447    uint32_t m_cpt_dmiss_transaction;       // number of VCI data miss transactions
448    uint32_t m_cpt_unc_transaction;         // number of VCI uncached read transactions
449    uint32_t m_cpt_write_transaction;       // number of VCI write transactions
450
451    uint32_t m_cost_imiss_transaction;      // cumulated duration for VCI IMISS transactions
452    uint32_t m_cost_dmiss_transaction;      // cumulated duration for VCI DMISS transactions
453    uint32_t m_cost_unc_transaction;        // cumulated duration for VCI UNC transactions
454    uint32_t m_cost_write_transaction;      // cumulated duration for VCI WRITE transactions
455    uint32_t m_length_write_transaction;    // cumulated length for VCI WRITE transactions
456
457    // TLB activity counters
458    uint32_t m_cpt_ins_tlb_read;            // number of instruction tlb read
459    uint32_t m_cpt_ins_tlb_miss;            // number of instruction tlb miss
460    uint32_t m_cpt_ins_tlb_write_et;        // number of instruction tlb write ET
461
462    uint32_t m_cpt_data_tlb_read;           // number of data tlb read
463    uint32_t m_cpt_data_tlb_miss;           // number of data tlb miss
464    uint32_t m_cpt_data_tlb_write_et;       // number of data tlb write ET
465    uint32_t m_cpt_data_tlb_write_dirty;    // number of data tlb write dirty
466   
467    uint32_t m_cost_ins_tlb_miss_frz;       // number of frozen cycles related to instruction tlb miss
468    uint32_t m_cost_data_tlb_miss_frz;      // number of frozen cycles related to data tlb miss
469
470    uint32_t m_cost_ins_waste_wait_frz;     // number of frozen cycles related to ins wait coherence operate
471    uint32_t m_cost_ins_tlb_sw_frz;         // number of frozen cycles related to ins context switch
472    uint32_t m_cost_ins_cache_flush_frz;    // number of frozen cycles related to ins cache flush
473
474    uint32_t m_cpt_ins_tlb_cleanup;         // number of ins tlb cleanup
475    uint32_t m_cost_data_waste_wait_frz;    // number of frozen cycles related to data wait coherence operate
476    uint32_t m_cost_data_tlb_sw_frz;        // number of frozen cycles related to data context switch
477    uint32_t m_cost_data_cache_flush_frz;   // number of frozen cycles related to data cache flush
478
479    uint32_t m_cpt_itlbmiss_transaction;    // number of itlb miss transactions
480    uint32_t m_cpt_itlb_write_transaction;  // number of itlb write ET transactions
481    uint32_t m_cpt_dtlbmiss_transaction;    // number of dtlb miss transactions
482    uint32_t m_cpt_dtlb_write_transaction;  // number of dtlb write ET and dirty transactions
483
484    uint32_t m_cost_itlbmiss_transaction;   // cumulated duration for VCI instruction TLB miss transactions
485    uint32_t m_cost_itlb_write_transaction; // cumulated duration for VCI instruction TLB write ET transactions
486    uint32_t m_cost_dtlbmiss_transaction;   // cumulated duration for VCI data TLB miss transactions
487    uint32_t m_cost_dtlb_write_transaction; // cumulated duration for VCI data TLB write transactions
488
489    uint32_t m_cpt_cc_update;               // number of coherence update packets
490    uint32_t m_cpt_cc_inval;                // number of coherence inval packets
491    uint32_t m_cpt_cc_broadcast;            // number of coherence broadcast packets
492
493    uint32_t m_cost_ins_tlb_inval_frz;      // number of frozen cycles related to checking ins tlb invalidate
494    uint32_t m_cpt_ins_tlb_inval;           // number of ins tlb invalidate
495
496    uint32_t m_cost_data_tlb_inval_frz;     // number of frozen cycles related to checking data tlb invalidate   
497    uint32_t m_cpt_data_tlb_inval;          // number of data tlb invalidate
498
499protected:
500    SC_HAS_PROCESS(VciCcVCacheWrapper2);
501
502public:
503    VciCcVCacheWrapper2(
504        sc_module_name insname,
505        int proc_id,
506        const soclib::common::MappingTable &mtp,
507        const soclib::common::MappingTable &mtc,
508        const soclib::common::IntTab &initiator_index,
509        const soclib::common::IntTab &target_index,
510        size_t itlb_ways,
511        size_t itlb_sets,
512        size_t dtlb_ways,
513        size_t dtlb_sets,
514        size_t icache_ways,
515        size_t icache_sets,
516        size_t icache_words,
517        size_t dcache_ways,
518        size_t dcache_sets,
519        size_t dcache_words,
520        size_t write_buf_size );
521
522    ~VciCcVCacheWrapper2();
523
524    void print_cpi();
525    void print_stats();
526
527private:
528    void transition();
529    void genMoore();
530
531    soclib_static_assert((int)iss_t::SC_ATOMIC == (int)vci_param::STORE_COND_ATOMIC);
532    soclib_static_assert((int)iss_t::SC_NOT_ATOMIC == (int)vci_param::STORE_COND_NOT_ATOMIC);
533};
534
535}}
536
537#endif /* SOCLIB_CABA_VCI_CC_VCACHE_WRAPPER2_H */
538
539// Local Variables:
540// tab-width: 4
541// c-basic-offset: 4
542// c-file-offsets:((innamespace . 0)(inline-open . 0))
543// indent-tabs-mode: nil
544// End:
545
546// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
547
548
549
Note: See TracBrowser for help on using the repository browser.