source: trunk/platforms/almos-tsarv3-platforms/common/vci_cc_vcache_wrapper2_v1/caba/source/include/vci_cc_vcache_wrapper2_v1.h @ 259

Last change on this file since 259 was 259, checked in by almaless, 12 years ago

Introduce ALMOS used platforms for TSAR.
See the package's README file for more information.

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