source: branches/RWT/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h @ 842

Last change on this file since 842 was 842, checked in by devigne, 10 years ago

RWT Commit : Fixing last commit.

File size: 48.3 KB
RevLine 
[331]1/* -*- c++ -*-
2 * File         : vci_mem_cache.h
3 * Date         : 26/10/2008
4 * Copyright    : UPMC / LIP6
5 * Authors      : Alain Greiner / Eric Guthmuller
6 *
7 * SOCLIB_LGPL_HEADER_BEGIN
8 *
9 * This file is part of SoCLib, GNU LGPLv2.1.
10 *
11 * SoCLib is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; version 2.1 of the License.
14 *
15 * SoCLib is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with SoCLib; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 *
25 * SOCLIB_LGPL_HEADER_END
26 *
[814]27 * Maintainers: alain.greiner@lip6.fr
[495]28 *              eric.guthmuller@polytechnique.edu
[331]29 *              cesar.fuguet-tortolero@lip6.fr
30 *              alexandre.joannou@lip6.fr
31 */
32
33#ifndef SOCLIB_CABA_MEM_CACHE_H
34#define SOCLIB_CABA_MEM_CACHE_H
35
36#include <inttypes.h>
37#include <systemc>
38#include <list>
39#include <cassert>
40#include "arithmetics.h"
41#include "alloc_elems.h"
42#include "caba_base_module.h"
43#include "vci_target.h"
44#include "vci_initiator.h"
45#include "generic_fifo.h"
46#include "mapping_table.h"
47#include "int_tab.h"
48#include "generic_llsc_global_table.h"
49#include "mem_cache_directory.h"
50#include "xram_transaction.h"
51#include "update_tab.h"
52#include "dspin_interface.h"
[771]53#include "dspin_rwt_param.h"
[331]54
[395]55#define TRT_ENTRIES      4      // Number of entries in TRT
56#define UPT_ENTRIES      4      // Number of entries in UPT
[468]57#define IVT_ENTRIES      4      // Number of entries in IVT
[395]58#define HEAP_ENTRIES     1024   // Number of entries in HEAP
[331]59
60namespace soclib {  namespace caba {
[395]61
[331]62  using namespace sc_core;
63
[814]64  template<typename vci_param_int,
[385]65           typename vci_param_ext,
[837]66           size_t   memc_dspin_in_width,
67           size_t   memc_dspin_out_width>
[331]68    class VciMemCache
69    : public soclib::caba::BaseModule
70    {
[823]71      typedef typename vci_param_int::fast_addr_t addr_t;
72      typedef typename sc_dt::sc_uint<64>         wide_data_t;
73      typedef uint32_t                            data_t;
74      typedef uint32_t                            tag_t;
75      typedef uint32_t                            be_t;
76      typedef uint32_t                            copy_t;
[385]77
[331]78      /* States of the TGT_CMD fsm */
[434]79      enum tgt_cmd_fsm_state_e
80      {
[331]81        TGT_CMD_IDLE,
82        TGT_CMD_READ,
83        TGT_CMD_WRITE,
[434]84        TGT_CMD_CAS,
[767]85        TGT_CMD_CONFIG,
86        TGT_CMD_ERROR
[331]87      };
88
89      /* States of the TGT_RSP fsm */
[395]90      enum tgt_rsp_fsm_state_e
91      {
[331]92        TGT_RSP_READ_IDLE,
93        TGT_RSP_WRITE_IDLE,
94        TGT_RSP_CAS_IDLE,
95        TGT_RSP_XRAM_IDLE,
[430]96        TGT_RSP_MULTI_ACK_IDLE,
[331]97        TGT_RSP_CLEANUP_IDLE,
[767]98        TGT_RSP_TGT_CMD_IDLE,
[545]99        TGT_RSP_CONFIG_IDLE,
[331]100        TGT_RSP_READ,
101        TGT_RSP_WRITE,
102        TGT_RSP_CAS,
103        TGT_RSP_XRAM,
[430]104        TGT_RSP_MULTI_ACK,
[545]105        TGT_RSP_CLEANUP,
[767]106        TGT_RSP_TGT_CMD,
107        TGT_RSP_CONFIG
[331]108      };
109
110      /* States of the DSPIN_TGT fsm */
[395]111      enum cc_receive_fsm_state_e
112      {
[331]113        CC_RECEIVE_IDLE,
114        CC_RECEIVE_CLEANUP,
115        CC_RECEIVE_MULTI_ACK
116      };
117
118      /* States of the CC_SEND fsm */
[395]119      enum cc_send_fsm_state_e
120      {
[331]121        CC_SEND_XRAM_RSP_IDLE,
122        CC_SEND_WRITE_IDLE,
[767]123        CC_SEND_READ_IDLE,
[331]124        CC_SEND_CAS_IDLE,
[545]125        CC_SEND_CONFIG_IDLE,
[331]126        CC_SEND_XRAM_RSP_BRDCAST_HEADER,
127        CC_SEND_XRAM_RSP_BRDCAST_NLINE,
128        CC_SEND_XRAM_RSP_INVAL_HEADER,
129        CC_SEND_XRAM_RSP_INVAL_NLINE,
[477]130        CC_SEND_READ_NCC_INVAL_HEADER,
131        CC_SEND_READ_NCC_INVAL_NLINE,
132        CC_SEND_WRITE_NCC_INVAL_HEADER,
133        CC_SEND_WRITE_NCC_INVAL_NLINE,
[331]134        CC_SEND_WRITE_BRDCAST_HEADER,
135        CC_SEND_WRITE_BRDCAST_NLINE,
136        CC_SEND_WRITE_UPDT_HEADER,
137        CC_SEND_WRITE_UPDT_NLINE,
138        CC_SEND_WRITE_UPDT_DATA,
139        CC_SEND_CAS_BRDCAST_HEADER,
140        CC_SEND_CAS_BRDCAST_NLINE,
141        CC_SEND_CAS_UPDT_HEADER,
142        CC_SEND_CAS_UPDT_NLINE,
143        CC_SEND_CAS_UPDT_DATA,
[545]144        CC_SEND_CAS_UPDT_DATA_HIGH,
145        CC_SEND_CONFIG_INVAL_HEADER,
146        CC_SEND_CONFIG_INVAL_NLINE,
147        CC_SEND_CONFIG_BRDCAST_HEADER,
148        CC_SEND_CONFIG_BRDCAST_NLINE
[331]149      };
150
151      /* States of the MULTI_ACK fsm */
[395]152      enum multi_ack_fsm_state_e
153      {
[331]154        MULTI_ACK_IDLE,
155        MULTI_ACK_UPT_LOCK,
156        MULTI_ACK_UPT_CLEAR,
[495]157        MULTI_ACK_WRITE_RSP
[331]158      };
159
[434]160      /* States of the CONFIG fsm */
161      enum config_fsm_state_e
162      {
163        CONFIG_IDLE,
164        CONFIG_LOOP,
[495]165        CONFIG_WAIT,
[434]166        CONFIG_RSP,
167        CONFIG_DIR_REQ,
168        CONFIG_DIR_ACCESS,
[495]169        CONFIG_IVT_LOCK,
[434]170        CONFIG_BC_SEND,
[495]171        CONFIG_INVAL_SEND,
[439]172        CONFIG_HEAP_REQ,
173        CONFIG_HEAP_SCAN,
174        CONFIG_HEAP_LAST,
[495]175        CONFIG_TRT_LOCK,
176        CONFIG_TRT_SET,
177        CONFIG_PUT_REQ
[434]178      };
179
[331]180      /* States of the READ fsm */
[395]181      enum read_fsm_state_e
182      {
[331]183        READ_IDLE,
184        READ_DIR_REQ,
185        READ_DIR_LOCK,
[477]186        READ_IVT_LOCK,
187        READ_WAIT,
[331]188        READ_DIR_HIT,
189        READ_HEAP_REQ,
190        READ_HEAP_LOCK,
191        READ_HEAP_WRITE,
192        READ_HEAP_ERASE,
193        READ_HEAP_LAST,
194        READ_RSP,
195        READ_TRT_LOCK,
196        READ_TRT_SET,
197        READ_TRT_REQ
198      };
199
200      /* States of the WRITE fsm */
[395]201      enum write_fsm_state_e
202      {
[331]203        WRITE_IDLE,
204        WRITE_NEXT,
205        WRITE_DIR_REQ,
206        WRITE_DIR_LOCK,
[477]207        WRITE_IVT_LOCK_HIT_WB,
[331]208        WRITE_DIR_HIT,
209        WRITE_UPT_LOCK,
210        WRITE_UPT_HEAP_LOCK,
211        WRITE_UPT_REQ,
212        WRITE_UPT_NEXT,
213        WRITE_UPT_DEC,
214        WRITE_RSP,
[477]215        WRITE_MISS_IVT_LOCK,
[331]216        WRITE_MISS_TRT_LOCK,
217        WRITE_MISS_TRT_DATA,
218        WRITE_MISS_TRT_SET,
219        WRITE_MISS_XRAM_REQ,
[495]220        WRITE_BC_DIR_READ,
[331]221        WRITE_BC_TRT_LOCK,
[468]222        WRITE_BC_IVT_LOCK,
[331]223        WRITE_BC_DIR_INVAL,
224        WRITE_BC_CC_SEND,
225        WRITE_BC_XRAM_REQ,
226        WRITE_WAIT
227      };
228
229      /* States of the IXR_RSP fsm */
[395]230      enum ixr_rsp_fsm_state_e
231      {
[331]232        IXR_RSP_IDLE,
233        IXR_RSP_TRT_ERASE,
234        IXR_RSP_TRT_READ
235      };
236
237      /* States of the XRAM_RSP fsm */
[395]238      enum xram_rsp_fsm_state_e
239      {
[331]240        XRAM_RSP_IDLE,
241        XRAM_RSP_TRT_COPY,
242        XRAM_RSP_TRT_DIRTY,
243        XRAM_RSP_DIR_LOCK,
244        XRAM_RSP_DIR_UPDT,
245        XRAM_RSP_DIR_RSP,
[495]246        XRAM_RSP_IVT_LOCK,
[331]247        XRAM_RSP_INVAL_WAIT,
248        XRAM_RSP_INVAL,
249        XRAM_RSP_WRITE_DIRTY,
250        XRAM_RSP_HEAP_REQ,
251        XRAM_RSP_HEAP_ERASE,
252        XRAM_RSP_HEAP_LAST,
253        XRAM_RSP_ERROR_ERASE,
254        XRAM_RSP_ERROR_RSP
255      };
256
257      /* States of the IXR_CMD fsm */
[395]258      enum ixr_cmd_fsm_state_e
259      {
[331]260        IXR_CMD_READ_IDLE,
261        IXR_CMD_WRITE_IDLE,
262        IXR_CMD_CAS_IDLE,
263        IXR_CMD_XRAM_IDLE,
[477]264        IXR_CMD_CLEANUP_IDLE,
[495]265        IXR_CMD_CONFIG_IDLE,
266        IXR_CMD_READ_TRT,
267        IXR_CMD_WRITE_TRT,
268        IXR_CMD_CAS_TRT,
269        IXR_CMD_XRAM_TRT,
270        IXR_CMD_CLEANUP_TRT,
271        IXR_CMD_CONFIG_TRT,
272        IXR_CMD_READ_SEND,
273        IXR_CMD_WRITE_SEND,
274        IXR_CMD_CAS_SEND,
275        IXR_CMD_XRAM_SEND,
276        IXR_CMD_CLEANUP_DATA_SEND,
277        IXR_CMD_CONFIG_SEND
[331]278      };
279
280      /* States of the CAS fsm */
[395]281      enum cas_fsm_state_e
282      {
[331]283        CAS_IDLE,
284        CAS_DIR_REQ,
285        CAS_DIR_LOCK,
286        CAS_DIR_HIT_READ,
287        CAS_DIR_HIT_COMPARE,
288        CAS_DIR_HIT_WRITE,
289        CAS_UPT_LOCK,
290        CAS_UPT_HEAP_LOCK,
291        CAS_UPT_REQ,
292        CAS_UPT_NEXT,
293        CAS_BC_TRT_LOCK,
[468]294        CAS_BC_IVT_LOCK,
[331]295        CAS_BC_DIR_INVAL,
296        CAS_BC_CC_SEND,
297        CAS_BC_XRAM_REQ,
298        CAS_RSP_FAIL,
299        CAS_RSP_SUCCESS,
300        CAS_MISS_TRT_LOCK,
301        CAS_MISS_TRT_SET,
302        CAS_MISS_XRAM_REQ,
303        CAS_WAIT
304      };
305
306      /* States of the CLEANUP fsm */
[395]307      enum cleanup_fsm_state_e
308      {
[331]309        CLEANUP_IDLE,
310        CLEANUP_GET_NLINE,
[477]311        CLEANUP_GET_DATA,
[331]312        CLEANUP_DIR_REQ,
313        CLEANUP_DIR_LOCK,
314        CLEANUP_DIR_WRITE,
[477]315        CLEANUP_IVT_LOCK_DATA,
316        CLEANUP_IVT_CLEAR_DATA,
317        CLEANUP_READ_RSP,
[331]318        CLEANUP_HEAP_REQ,
319        CLEANUP_HEAP_LOCK,
320        CLEANUP_HEAP_SEARCH,
321        CLEANUP_HEAP_CLEAN,
322        CLEANUP_HEAP_FREE,
[468]323        CLEANUP_IVT_LOCK,
324        CLEANUP_IVT_DECREMENT,
325        CLEANUP_IVT_CLEAR,
[331]326        CLEANUP_WRITE_RSP,
[477]327        CLEANUP_IXR_REQ,
328        CLEANUP_WAIT,
[434]329        CLEANUP_SEND_CLACK
[331]330      };
331
332      /* States of the ALLOC_DIR fsm */
[395]333      enum alloc_dir_fsm_state_e
334      {
[331]335        ALLOC_DIR_RESET,
336        ALLOC_DIR_READ,
337        ALLOC_DIR_WRITE,
338        ALLOC_DIR_CAS,
339        ALLOC_DIR_CLEANUP,
[545]340        ALLOC_DIR_XRAM_RSP,
341        ALLOC_DIR_CONFIG
[331]342      };
343
344      /* States of the ALLOC_TRT fsm */
[395]345      enum alloc_trt_fsm_state_e
346      {
[331]347        ALLOC_TRT_READ,
348        ALLOC_TRT_WRITE,
349        ALLOC_TRT_CAS,
350        ALLOC_TRT_XRAM_RSP,
[477]351        ALLOC_TRT_IXR_RSP,
[495]352        ALLOC_TRT_CLEANUP,
353        ALLOC_TRT_IXR_CMD,
354        ALLOC_TRT_CONFIG
[331]355      };
356
357      /* States of the ALLOC_UPT fsm */
[395]358      enum alloc_upt_fsm_state_e
359      {
[331]360        ALLOC_UPT_WRITE,
[468]361        ALLOC_UPT_CAS,
362        ALLOC_UPT_MULTI_ACK
[331]363      };
364
[468]365      /* States of the ALLOC_IVT fsm */
366      enum alloc_ivt_fsm_state_e
367      {
368        ALLOC_IVT_WRITE,
[477]369        ALLOC_IVT_READ,
[468]370        ALLOC_IVT_XRAM_RSP,
371        ALLOC_IVT_CLEANUP,
372        ALLOC_IVT_CAS,
373        ALLOC_IVT_CONFIG
374      };
375
[331]376      /* States of the ALLOC_HEAP fsm */
[395]377      enum alloc_heap_fsm_state_e
378      {
[331]379        ALLOC_HEAP_RESET,
380        ALLOC_HEAP_READ,
381        ALLOC_HEAP_WRITE,
382        ALLOC_HEAP_CAS,
383        ALLOC_HEAP_CLEANUP,
[439]384        ALLOC_HEAP_XRAM_RSP,
385        ALLOC_HEAP_CONFIG
[331]386      };
387
388      /* transaction type, pktid field */
389      enum transaction_type_e
390      {
391          // b3 unused
392          // b2 READ / NOT READ
393          // Si READ
394          //  b1 DATA / INS
395          //  b0 UNC / MISS
396          // Si NOT READ
397          //  b1 accÚs table llsc type SW / other
398          //  b2 WRITE/CAS/LL/SC
[823]399          TYPE_READ_DATA_UNC  = 0x0,
400          TYPE_READ_DATA_MISS = 0x1,
401          TYPE_READ_INS_UNC   = 0x2,
402          TYPE_READ_INS_MISS  = 0x3,
403          TYPE_WRITE          = 0x4,
404          TYPE_CAS            = 0x5,
405          TYPE_LL             = 0x6,
406          TYPE_SC             = 0x7
[331]407      };
408
409      /* SC return values */
410      enum sc_status_type_e
411      {
[783]412          SC_SUCCESS = 0x00000000,
413          SC_FAIL    = 0x00000001
[331]414      };
415
[814]416      // debug variables
[783]417      bool     m_debug;
418      bool     m_debug_previous_valid;
419      size_t   m_debug_previous_count;
420      bool     m_debug_previous_dirty;
421      data_t * m_debug_previous_data;
422      data_t * m_debug_data;
[331]423
424      // instrumentation counters
[823]425      uint32_t m_cpt_cycles;                  // Counter of cycles
[434]426
[783]427      // Counters accessible in software (not yet but eventually) and tagged
[823]428      uint32_t m_cpt_reset_count;             // Last cycle at which counters have been reset
429      uint32_t m_cpt_read_local;              // Number of local READ transactions
430      uint32_t m_cpt_read_remote;             // number of remote READ transactions
431      uint32_t m_cpt_read_cost;               // Number of (flits * distance) for READs
[434]432
[823]433      uint32_t m_cpt_write_local;             // Number of local WRITE transactions
434      uint32_t m_cpt_write_remote;            // number of remote WRITE transactions
435      uint32_t m_cpt_write_flits_local;       // number of flits for local WRITEs
436      uint32_t m_cpt_write_flits_remote;      // number of flits for remote WRITEs
437      uint32_t m_cpt_write_cost;              // Number of (flits * distance) for WRITEs
438      uint32_t m_cpt_write_ncc_miss;          // Number of write on ncc line
[434]439
[823]440      uint32_t m_cpt_ll_local;                // Number of local LL transactions
441      uint32_t m_cpt_ll_remote;               // number of remote LL transactions
442      uint32_t m_cpt_ll_cost;                 // Number of (flits * distance) for LLs
[545]443
[823]444      uint32_t m_cpt_sc_local;                // Number of local SC transactions
445      uint32_t m_cpt_sc_remote;               // number of remote SC transactions
446      uint32_t m_cpt_sc_cost;                 // Number of (flits * distance) for SCs
[545]447
[823]448      uint32_t m_cpt_cas_local;               // Number of local SC transactions
449      uint32_t m_cpt_cas_remote;              // number of remote SC transactions
450      uint32_t m_cpt_cas_cost;                // Number of (flits * distance) for SCs
[545]451
[823]452      uint32_t m_cpt_update;                  // Number of requests causing an UPDATE
453      uint32_t m_cpt_update_local;            // Number of local UPDATE transactions
454      uint32_t m_cpt_update_remote;           // Number of remote UPDATE transactions
455      uint32_t m_cpt_update_cost;             // Number of (flits * distance) for UPDT
[545]456
[823]457      uint32_t m_cpt_minval;                  // Number of requests causing M_INV
458      uint32_t m_cpt_minval_local;            // Number of local M_INV transactions
459      uint32_t m_cpt_minval_remote;           // Number of remote M_INV transactions
460      uint32_t m_cpt_minval_cost;             // Number of (flits * distance) for M_INV
[545]461
[823]462      uint32_t m_cpt_binval;                  // Number of BROADCAST INVAL
[545]463
[823]464      uint32_t m_cpt_cleanup_local;           // Number of local CLEANUP transactions (all cleanup types)
465      uint32_t m_cpt_cleanup_remote;          // Number of remote CLEANUP transactions (all cleanup types)
466      uint32_t m_cpt_cleanup_cost;            // Number of (flits * distance) for CLEANUPs (all types)
[545]467
[783]468      // Counters not accessible by software, but tagged
[823]469      uint32_t m_cpt_read_miss;               // Number of MISS READ
470      uint32_t m_cpt_write_miss;              // Number of MISS WRITE
471      uint32_t m_cpt_write_dirty;             // Cumulated length for WRITE transactions
472      uint32_t m_cpt_write_broadcast;         // Number of BROADCAST INVAL because write
[545]473
[823]474      uint32_t m_cpt_trt_rb;                  // Read blocked by a hit in trt
475      uint32_t m_cpt_trt_full;                // Transaction blocked due to a full trt
[783]476
477      uint32_t m_cpt_heap_unused;             // NB cycles HEAP LOCK unused
478      uint32_t m_cpt_heap_slot_available;     // NB HEAP slot available refresh at each cycles
[814]479      uint32_t m_cpt_heap_min_slot_available; // NB HEAP : Min of slot available
[783]480
[823]481      uint32_t m_cpt_ncc_to_cc_read;          // NB change from NCC to CC caused by a READ
482      uint32_t m_cpt_ncc_to_cc_write;         // NB change from NCC to CC caused by a WRITE
[783]483
[823]484      uint32_t m_cpt_cleanup_data_local;      // Number of local cleanups with data
485      uint32_t m_cpt_cleanup_data_remote;     // Number of remote cleanups with data
486      uint32_t m_cpt_cleanup_data_cost;       // Cost for cleanups with data
[783]487
[823]488      uint32_t m_cpt_update_flits;            // Number of flits for UPDATEs
489      uint32_t m_cpt_inval_cost;              // Number of (flits * distance) for INVALs
[783]490
491      uint32_t m_cpt_get;
492      uint32_t m_cpt_put;
493
[787]494      uint32_t m_cpt_dir_unused; // NB cycles DIR LOCK unused
495      uint32_t m_cpt_trt_unused; // NB cycles TRT LOCK unused
496      uint32_t m_cpt_ivt_unused; // NB cycles UPT LOCK unused
497      uint32_t m_cpt_upt_unused; // NB cycles UPT LOCK unused
[331]498
[783]499      size_t   m_prev_count;
[477]500
[331]501      protected:
502
503      SC_HAS_PROCESS(VciMemCache);
504
505      public:
[842]506      sc_in<bool>                                     p_clk;
507      sc_in<bool>                                     p_resetn;
508      sc_out<bool>                                    p_irq;
509      soclib::caba::VciTarget<vci_param_int>          p_vci_tgt;
510      soclib::caba::VciInitiator<vci_param_ext>       p_vci_ixr;
511      soclib::caba::DspinInput<memc_dspin_in_width>   p_dspin_p2m;
512      soclib::caba::DspinOutput<memc_dspin_out_width> p_dspin_m2p;
513      soclib::caba::DspinOutput<memc_dspin_out_width> p_dspin_clack;
[331]514
[545]515#if MONITOR_MEMCACHE_FSM == 1
[814]516      sc_out<int> p_read_fsm;
517      sc_out<int> p_write_fsm;
518      sc_out<int> p_xram_rsp_fsm;
519      sc_out<int> p_cas_fsm;
520      sc_out<int> p_cleanup_fsm;
521      sc_out<int> p_config_fsm;
522      sc_out<int> p_alloc_heap_fsm;
523      sc_out<int> p_alloc_dir_fsm;
524      sc_out<int> p_alloc_trt_fsm;
525      sc_out<int> p_alloc_upt_fsm;
526      sc_out<int> p_alloc_ivt_fsm;
527      sc_out<int> p_tgt_cmd_fsm;
528      sc_out<int> p_tgt_rsp_fsm;
529      sc_out<int> p_ixr_cmd_fsm;
530      sc_out<int> p_ixr_rsp_fsm;
531      sc_out<int> p_cc_send_fsm;
532      sc_out<int> p_cc_receive_fsm;
533      sc_out<int> p_multi_ack_fsm;
[545]534#endif
535
[331]536      VciMemCache(
537          sc_module_name name,                                // Instance Name
[434]538          const soclib::common::MappingTable &mtp,            // Mapping table INT network
539          const soclib::common::MappingTable &mtx,            // Mapping table RAM network
540          const soclib::common::IntTab       &srcid_x,        // global index RAM network
541          const soclib::common::IntTab       &tgtid_d,        // global index INT network
[545]542          const size_t                       x_width,         // X width in platform
543          const size_t                       y_width,         // Y width in platform
[346]544          const size_t                       nways,           // Number of ways per set
545          const size_t                       nsets,           // Number of sets
546          const size_t                       nwords,          // Number of words per line
[434]547          const size_t                       max_copies,      // max number of copies
[823]548          const size_t                       heap_size = HEAP_ENTRIES,
549          const size_t                       trt_lines = TRT_ENTRIES,
550          const size_t                       upt_lines = UPT_ENTRIES,
551          const size_t                       ivt_lines = IVT_ENTRIES,
552          const size_t                       debug_start_cycle = 0,
553          const bool                         debug_ok = false );
[331]554
555      ~VciMemCache();
556
[644]557      void reset_counters();
[767]558      void print_stats(bool activity_counters = true, bool stats = false);
[823]559      void print_trace(size_t detailled = 0);
[449]560      void cache_monitor(addr_t addr);
[385]561      void start_monitor(addr_t addr, addr_t length);
[331]562      void stop_monitor();
563
564      private:
565
566      void transition();
567      void genMoore();
[449]568      void check_monitor(addr_t addr, data_t data, bool read);
[545]569      uint32_t req_distance(uint32_t req_srcid);
[767]570      uint32_t min_value(uint32_t old_value, uint32_t new_value);
[545]571      bool is_local_req(uint32_t req_srcid);
[823]572      int read_instrumentation(uint32_t regr, uint32_t & rdata);
[331]573
574      // Component attributes
[814]575      std::list<soclib::common::Segment> m_seglist;          // segments allocated
[346]576      size_t                             m_nseg;             // number of segments
577      soclib::common::Segment            **m_seg;            // array of segments pointers
[434]578      size_t                             m_seg_config;       // config segment index
579      const size_t                       m_srcid_x;          // global index on RAM network
[346]580      const size_t                       m_initiators;       // Number of initiators
581      const size_t                       m_heap_size;        // Size of the heap
582      const size_t                       m_ways;             // Number of ways in a set
583      const size_t                       m_sets;             // Number of cache sets
584      const size_t                       m_words;            // Number of words in a line
[767]585      size_t                             m_x_self;           // X self coordinate
586      size_t                             m_y_self;           // Y self coordinate
587      const size_t                       m_x_width;          // number of x bits in platform
588      const size_t                       m_y_width;          // number of y bits in platform
[346]589      size_t                             m_debug_start_cycle;
590      bool                               m_debug_ok;
591      uint32_t                           m_trt_lines;
592      TransactionTab                     m_trt;              // xram transaction table
593      uint32_t                           m_upt_lines;
[468]594      UpdateTab                          m_upt;              // pending update
595      UpdateTab                          m_ivt;              // pending invalidate
[346]596      CacheDirectory                     m_cache_directory;  // data cache directory
597      CacheData                          m_cache_data;       // data array[set][way][word]
598      HeapDirectory                      m_heap;             // heap for copies
599      size_t                             m_max_copies;       // max number of copies in heap
[331]600      GenericLLSCGlobalTable
[434]601      < 32  ,    // number of slots
602        4096,    // number of processors in the system
603        8000,    // registration life (# of LL operations)
604        addr_t >                         m_llsc_table;       // ll/sc registration table
[331]605
606      // adress masks
[823]607      const soclib::common::AddressMaskingTable<addr_t> m_x;
608      const soclib::common::AddressMaskingTable<addr_t> m_y;
609      const soclib::common::AddressMaskingTable<addr_t> m_z;
610      const soclib::common::AddressMaskingTable<addr_t> m_nline;
[331]611
612      // broadcast address
[823]613      uint32_t m_broadcast_boundaries;
[331]614
[611]615      // configuration interface constants
616      const uint32_t m_config_addr_mask;
617      const uint32_t m_config_regr_width;
618      const uint32_t m_config_func_width;
619      const uint32_t m_config_regr_idx_mask;
620      const uint32_t m_config_func_idx_mask;
621
[331]622      // Fifo between TGT_CMD fsm and READ fsm
[823]623      GenericFifo<addr_t> m_cmd_read_addr_fifo;
624      GenericFifo<size_t> m_cmd_read_length_fifo;
625      GenericFifo<size_t> m_cmd_read_srcid_fifo;
626      GenericFifo<size_t> m_cmd_read_trdid_fifo;
627      GenericFifo<size_t> m_cmd_read_pktid_fifo;
[331]628
629      // Fifo between TGT_CMD fsm and WRITE fsm
[823]630      GenericFifo<addr_t> m_cmd_write_addr_fifo;
631      GenericFifo<bool>   m_cmd_write_eop_fifo;
632      GenericFifo<size_t> m_cmd_write_srcid_fifo;
633      GenericFifo<size_t> m_cmd_write_trdid_fifo;
634      GenericFifo<size_t> m_cmd_write_pktid_fifo;
635      GenericFifo<data_t> m_cmd_write_data_fifo;
636      GenericFifo<be_t>   m_cmd_write_be_fifo;
[331]637
638      // Fifo between TGT_CMD fsm and CAS fsm
[823]639      GenericFifo<addr_t> m_cmd_cas_addr_fifo;
640      GenericFifo<bool>   m_cmd_cas_eop_fifo;
641      GenericFifo<size_t> m_cmd_cas_srcid_fifo;
642      GenericFifo<size_t> m_cmd_cas_trdid_fifo;
643      GenericFifo<size_t> m_cmd_cas_pktid_fifo;
644      GenericFifo<data_t> m_cmd_cas_wdata_fifo;
[331]645
[403]646      // Fifo between CC_RECEIVE fsm and CLEANUP fsm
[823]647      GenericFifo<uint64_t> m_cc_receive_to_cleanup_fifo;
[814]648
[403]649      // Fifo between CC_RECEIVE fsm and MULTI_ACK fsm
[823]650      GenericFifo<uint64_t> m_cc_receive_to_multi_ack_fifo;
[331]651
[430]652      // Buffer between TGT_CMD fsm and TGT_RSP fsm
653      // (segmentation violation response request)
654      sc_signal<bool>     r_tgt_cmd_to_tgt_rsp_req;
[434]655
656      sc_signal<uint32_t> r_tgt_cmd_to_tgt_rsp_rdata;
657      sc_signal<size_t>   r_tgt_cmd_to_tgt_rsp_error;
[430]658      sc_signal<size_t>   r_tgt_cmd_to_tgt_rsp_srcid;
659      sc_signal<size_t>   r_tgt_cmd_to_tgt_rsp_trdid;
660      sc_signal<size_t>   r_tgt_cmd_to_tgt_rsp_pktid;
[331]661
[434]662      sc_signal<addr_t>   r_tgt_cmd_config_addr;
663      sc_signal<size_t>   r_tgt_cmd_config_cmd;
664
[495]665      //////////////////////////////////////////////////
666      // Registers controlled by the TGT_CMD fsm
667      //////////////////////////////////////////////////
668
[823]669      sc_signal<int> r_tgt_cmd_fsm;
[495]670
[331]671      ///////////////////////////////////////////////////////
[434]672      // Registers controlled by the CONFIG fsm
673      ///////////////////////////////////////////////////////
674
[823]675      sc_signal<int>    r_config_fsm;            // FSM state
676      sc_signal<bool>   r_config_lock;           // lock protecting exclusive access
677      sc_signal<int>    r_config_cmd;            // config request type
678      sc_signal<addr_t> r_config_address;        // target buffer physical address
679      sc_signal<size_t> r_config_srcid;          // config request srcid
680      sc_signal<size_t> r_config_trdid;          // config request trdid
681      sc_signal<size_t> r_config_pktid;          // config request pktid
682      sc_signal<size_t> r_config_cmd_lines;      // number of lines to be handled
683      sc_signal<size_t> r_config_rsp_lines;      // number of lines not completed
684      sc_signal<size_t> r_config_dir_way;        // DIR: selected way
685      sc_signal<bool>   r_config_dir_lock;       // DIR: locked entry
686      sc_signal<size_t> r_config_dir_count;      // DIR: number of copies
687      sc_signal<bool>   r_config_dir_is_cnt;     // DIR: counter mode (broadcast)
688      sc_signal<size_t> r_config_dir_copy_srcid; // DIR: first copy SRCID
689      sc_signal<bool>   r_config_dir_copy_inst;  // DIR: first copy L1 type
690      sc_signal<size_t> r_config_dir_ptr;        // DIR: index of next copy in HEAP
691      sc_signal<size_t> r_config_heap_next;      // current pointer to scan HEAP
692      sc_signal<size_t> r_config_trt_index;      // selected entry in TRT
693      sc_signal<size_t> r_config_ivt_index;      // selected entry in IVT
[439]694
[495]695      // Buffer between CONFIG fsm and IXR_CMD fsm
[823]696      sc_signal<bool>   r_config_to_ixr_cmd_req;   // valid request
697      sc_signal<size_t> r_config_to_ixr_cmd_index; // TRT index
[434]698
699      // Buffer between CONFIG fsm and TGT_RSP fsm (send a done response to L1 cache)
[823]700      sc_signal<bool>   r_config_to_tgt_rsp_req;   // valid request
701      sc_signal<bool>   r_config_to_tgt_rsp_error; // error response
702      sc_signal<size_t> r_config_to_tgt_rsp_srcid; // Transaction srcid
703      sc_signal<size_t> r_config_to_tgt_rsp_trdid; // Transaction trdid
704      sc_signal<size_t> r_config_to_tgt_rsp_pktid; // Transaction pktid
[434]705
706      // Buffer between CONFIG fsm and CC_SEND fsm (multi-inval / broadcast-inval)
[823]707      sc_signal<bool>     r_config_to_cc_send_multi_req;   // multi-inval request
708      sc_signal<bool>     r_config_to_cc_send_brdcast_req; // broadcast-inval request
709      sc_signal<addr_t>   r_config_to_cc_send_nline;       // line index
710      sc_signal<size_t>   r_config_to_cc_send_trdid;       // UPT index
711      GenericFifo<bool>   m_config_to_cc_send_inst_fifo;   // fifo for the L1 type
712      GenericFifo<size_t> m_config_to_cc_send_srcid_fifo;  // fifo for owners srcid
[434]713
714      ///////////////////////////////////////////////////////
[331]715      // Registers controlled by the READ fsm
716      ///////////////////////////////////////////////////////
717
[823]718      sc_signal<int>      r_read_fsm;        // FSM state
719      sc_signal<size_t>   r_read_copy;       // Srcid of the first copy
720      sc_signal<size_t>   r_read_copy_cache; // Srcid of the first copy
721      sc_signal<bool>     r_read_copy_inst;  // Type of the first copy
722      sc_signal<tag_t>    r_read_tag;        // cache line tag (in directory)
723      sc_signal<bool>     r_read_is_cnt;     // is_cnt bit (in directory)
724      sc_signal<bool>     r_read_lock;       // lock bit (in directory)
725      sc_signal<bool>     r_read_dirty;      // dirty bit (in directory)
726      sc_signal<size_t>   r_read_count;      // number of copies
727      sc_signal<size_t>   r_read_ptr;        // pointer to the heap
728      sc_signal<data_t> * r_read_data;       // data (one cache line)
729      sc_signal<size_t>   r_read_way;        // associative way (in cache)
730      sc_signal<size_t>   r_read_trt_index;  // Transaction Table index
731      sc_signal<size_t>   r_read_next_ptr;   // Next entry to point to
732      sc_signal<bool>     r_read_last_free;  // Last free entry
733      sc_signal<addr_t>   r_read_ll_key;     // LL key from llsc_global_table
[331]734
[814]735      // Buffer between READ fsm and IXR_CMD fsm
[823]736      sc_signal<bool>     r_read_to_ixr_cmd_req;   // valid request
737      sc_signal<size_t>   r_read_to_ixr_cmd_index; // TRT index
[331]738
739      // Buffer between READ fsm and TGT_RSP fsm (send a hit read response to L1 cache)
[823]740      sc_signal<bool>     r_read_to_tgt_rsp_req;    // valid request
741      sc_signal<size_t>   r_read_to_tgt_rsp_srcid;  // Transaction srcid
742      sc_signal<size_t>   r_read_to_tgt_rsp_trdid;  // Transaction trdid
743      sc_signal<size_t>   r_read_to_tgt_rsp_pktid;  // Transaction pktid
744      sc_signal<data_t> * r_read_to_tgt_rsp_data;   // data (one cache line)
745      sc_signal<size_t>   r_read_to_tgt_rsp_word;   // first word of the response
746      sc_signal<size_t>   r_read_to_tgt_rsp_length; // length of the response
747      sc_signal<addr_t>   r_read_to_tgt_rsp_ll_key; // LL key from llsc_global_table
[331]748
[477]749      //RWT: Buffer between READ fsm and CC_SEND fsm (send inval)
750      sc_signal<bool>     r_read_to_cc_send_req;
751      sc_signal<size_t>   r_read_to_cc_send_dest;
752      sc_signal<addr_t>   r_read_to_cc_send_nline;
753      sc_signal<bool>     r_read_to_cc_send_inst;
754
[814]755      //RWT: Buffer between READ fsm and CLEANUP fsm (wait for the data coming from L1 cache)
[477]756      sc_signal<bool>     r_read_to_cleanup_req;    // valid request
757      sc_signal<addr_t>   r_read_to_cleanup_nline;  // cache line index
758      sc_signal<size_t>   r_read_to_cleanup_srcid;
[767]759      sc_signal<size_t>   r_read_to_cleanup_inst;
[477]760      sc_signal<size_t>   r_read_to_cleanup_length;
761      sc_signal<size_t>   r_read_to_cleanup_first_word;
[814]762      sc_signal<bool>     r_read_to_cleanup_cached_read;
[477]763      sc_signal<bool>     r_read_to_cleanup_is_ll;
764      sc_signal<addr_t>   r_read_to_cleanup_addr;
765      sc_signal<addr_t>   r_read_to_cleanup_ll_key;
766
767      //RWT:
[823]768      sc_signal<bool>     r_read_coherent; // State of the cache slot after transaction
[477]769      sc_signal<bool>     r_read_ll_done;
770
[331]771      ///////////////////////////////////////////////////////////////
772      // Registers controlled by the WRITE fsm
773      ///////////////////////////////////////////////////////////////
774
[495]775      sc_signal<int>      r_write_fsm;                // FSM state
776      sc_signal<addr_t>   r_write_address;            // first word address
777      sc_signal<size_t>   r_write_word_index;         // first word index in line
778      sc_signal<size_t>   r_write_word_count;         // number of words in line
779      sc_signal<size_t>   r_write_srcid;              // transaction srcid
780      sc_signal<size_t>   r_write_trdid;              // transaction trdid
781      sc_signal<size_t>   r_write_pktid;              // transaction pktid
782      sc_signal<data_t> * r_write_data;               // data (one cache line)
783      sc_signal<be_t>   * r_write_be;                 // one byte enable per word
784      sc_signal<bool>     r_write_byte;               // (BE != 0X0) and (BE != 0xF)
785      sc_signal<bool>     r_write_is_cnt;             // is_cnt bit (in directory)
786      sc_signal<bool>     r_write_lock;               // lock bit (in directory)
787      sc_signal<tag_t>    r_write_tag;                // cache line tag (in directory)
788      sc_signal<size_t>   r_write_copy;               // first owner of the line
789      sc_signal<size_t>   r_write_copy_cache;         // first owner of the line
790      sc_signal<bool>     r_write_copy_inst;          // is this owner a ICache ?
791      sc_signal<size_t>   r_write_count;              // number of copies
792      sc_signal<size_t>   r_write_ptr;                // pointer to the heap
793      sc_signal<size_t>   r_write_next_ptr;           // next pointer to the heap
794      sc_signal<bool>     r_write_to_dec;             // need to decrement update counter
795      sc_signal<size_t>   r_write_way;                // way of the line
796      sc_signal<size_t>   r_write_trt_index;          // index in Transaction Table
797      sc_signal<size_t>   r_write_upt_index;          // index in Update Table
798      sc_signal<bool>     r_write_sc_fail;            // sc command failed
[545]799      sc_signal<data_t>   r_write_sc_key;             // sc command key
800      sc_signal<bool>     r_write_bc_data_we;         // Write enable for data buffer
[814]801
[331]802      // Buffer between WRITE fsm and TGT_RSP fsm (acknowledge a write command from L1)
803      sc_signal<bool>     r_write_to_tgt_rsp_req;     // valid request
804      sc_signal<size_t>   r_write_to_tgt_rsp_srcid;   // transaction srcid
805      sc_signal<size_t>   r_write_to_tgt_rsp_trdid;   // transaction trdid
806      sc_signal<size_t>   r_write_to_tgt_rsp_pktid;   // transaction pktid
807      sc_signal<bool>     r_write_to_tgt_rsp_sc_fail; // sc command failed
808
[814]809      // Buffer between WRITE fsm and IXR_CMD fsm
[495]810      sc_signal<bool>     r_write_to_ixr_cmd_req;     // valid request
[814]811      sc_signal<size_t>   r_write_to_ixr_cmd_index;   // TRT index
[331]812
813      // Buffer between WRITE fsm and CC_SEND fsm (Update/Invalidate L1 caches)
814      sc_signal<bool>     r_write_to_cc_send_multi_req;     // valid multicast request
815      sc_signal<bool>     r_write_to_cc_send_brdcast_req;   // valid brdcast request
816      sc_signal<addr_t>   r_write_to_cc_send_nline;         // cache line index
817      sc_signal<size_t>   r_write_to_cc_send_trdid;         // index in Update Table
818      sc_signal<data_t> * r_write_to_cc_send_data;          // data (one cache line)
819      sc_signal<be_t>   * r_write_to_cc_send_be;            // word enable
820      sc_signal<size_t>   r_write_to_cc_send_count;         // number of words in line
821      sc_signal<size_t>   r_write_to_cc_send_index;         // index of first word in line
822      GenericFifo<bool>   m_write_to_cc_send_inst_fifo;     // fifo for the L1 type
823      GenericFifo<size_t> m_write_to_cc_send_srcid_fifo;    // fifo for srcids
[385]824
[331]825      // Buffer between WRITE fsm and MULTI_ACK fsm (Decrement UPT entry)
826      sc_signal<bool>     r_write_to_multi_ack_req;       // valid request
827      sc_signal<size_t>   r_write_to_multi_ack_upt_index; // index in update table
828
[477]829      // RWT: Buffer between WRITE fsm and CLEANUP fsm (change slot state)
[823]830      sc_signal<bool>     r_write_to_cleanup_req;    // valid request
831      sc_signal<addr_t>   r_write_to_cleanup_nline;  // cache line index
[477]832
833      // RWT
[823]834      sc_signal<bool>     r_write_coherent;          // cache slot state after transaction
[477]835
836      //Buffer between WRITE fsm and CC_SEND fsm (INVAL for RWT)
837      sc_signal<bool>     r_write_to_cc_send_req;
838      sc_signal<size_t>   r_write_to_cc_send_dest;
839
840
[331]841      /////////////////////////////////////////////////////////
842      // Registers controlled by MULTI_ACK fsm
843      //////////////////////////////////////////////////////////
844
845      sc_signal<int>      r_multi_ack_fsm;       // FSM state
846      sc_signal<size_t>   r_multi_ack_upt_index; // index in the Update Table
847      sc_signal<size_t>   r_multi_ack_srcid;     // pending write srcid
848      sc_signal<size_t>   r_multi_ack_trdid;     // pending write trdid
849      sc_signal<size_t>   r_multi_ack_pktid;     // pending write pktid
850      sc_signal<addr_t>   r_multi_ack_nline;     // pending write nline
851
852      // Buffer between MULTI_ACK fsm and TGT_RSP fsm (complete write/update transaction)
853      sc_signal<bool>     r_multi_ack_to_tgt_rsp_req;   // valid request
854      sc_signal<size_t>   r_multi_ack_to_tgt_rsp_srcid; // Transaction srcid
855      sc_signal<size_t>   r_multi_ack_to_tgt_rsp_trdid; // Transaction trdid
856      sc_signal<size_t>   r_multi_ack_to_tgt_rsp_pktid; // Transaction pktid
857
858      ///////////////////////////////////////////////////////
859      // Registers controlled by CLEANUP fsm
860      ///////////////////////////////////////////////////////
861
862      sc_signal<int>      r_cleanup_fsm;           // FSM state
863      sc_signal<size_t>   r_cleanup_srcid;         // transaction srcid
864      sc_signal<bool>     r_cleanup_inst;          // Instruction or Data ?
865      sc_signal<size_t>   r_cleanup_way_index;     // L1 Cache Way index
866      sc_signal<addr_t>   r_cleanup_nline;         // cache line index
867
868
869      sc_signal<copy_t>   r_cleanup_copy;          // first copy
870      sc_signal<copy_t>   r_cleanup_copy_cache;    // first copy
871      sc_signal<size_t>   r_cleanup_copy_inst;     // type of the first copy
872      sc_signal<copy_t>   r_cleanup_count;         // number of copies
873      sc_signal<size_t>   r_cleanup_ptr;           // pointer to the heap
874      sc_signal<size_t>   r_cleanup_prev_ptr;      // previous pointer to the heap
875      sc_signal<size_t>   r_cleanup_prev_srcid;    // srcid of previous heap entry
876      sc_signal<size_t>   r_cleanup_prev_cache_id; // srcid of previous heap entry
877      sc_signal<bool>     r_cleanup_prev_inst;     // inst bit of previous heap entry
878      sc_signal<size_t>   r_cleanup_next_ptr;      // next pointer to the heap
879      sc_signal<tag_t>    r_cleanup_tag;           // cache line tag (in directory)
880      sc_signal<bool>     r_cleanup_is_cnt;        // inst bit (in directory)
881      sc_signal<bool>     r_cleanup_lock;          // lock bit (in directory)
882      sc_signal<bool>     r_cleanup_dirty;         // dirty bit (in directory)
883      sc_signal<size_t>   r_cleanup_way;           // associative way (in cache)
884
[434]885      sc_signal<size_t>   r_cleanup_write_srcid;   // srcid of write rsp
[331]886      sc_signal<size_t>   r_cleanup_write_trdid;   // trdid of write rsp
887      sc_signal<size_t>   r_cleanup_write_pktid;   // pktid of write rsp
888
[434]889      sc_signal<bool>     r_cleanup_need_rsp;      // write response required
890      sc_signal<bool>     r_cleanup_need_ack;      // config acknowledge required
891
[331]892      sc_signal<size_t>   r_cleanup_index;         // index of the INVAL line (in the UPT)
893
894      // Buffer between CLEANUP fsm and TGT_RSP fsm (acknowledge a write command from L1)
895      sc_signal<bool>     r_cleanup_to_tgt_rsp_req;   // valid request
896      sc_signal<size_t>   r_cleanup_to_tgt_rsp_srcid; // transaction srcid
897      sc_signal<size_t>   r_cleanup_to_tgt_rsp_trdid; // transaction trdid
898      sc_signal<size_t>   r_cleanup_to_tgt_rsp_pktid; // transaction pktid
[814]899      sc_signal<addr_t>   r_cleanup_to_tgt_rsp_ll_key;
[331]900
[477]901      //RWT
902      sc_signal<size_t>   r_cleanup_read_srcid;
903      sc_signal<size_t>   r_cleanup_read_trdid;
904      sc_signal<size_t>   r_cleanup_read_pktid;
905      sc_signal<bool>     r_cleanup_read_need_rsp;
906      sc_signal<bool>     r_cleanup_to_tgt_rsp_type;
907      sc_signal<data_t> * r_cleanup_to_tgt_rsp_data;
908      sc_signal<size_t>   r_cleanup_to_tgt_rsp_length;
909      sc_signal<size_t>   r_cleanup_to_tgt_rsp_first_word;
910
[331]911      ///////////////////////////////////////////////////////
912      // Registers controlled by CAS fsm
913      ///////////////////////////////////////////////////////
914
[495]915      sc_signal<int>      r_cas_fsm;              // FSM state
916      sc_signal<data_t>   r_cas_wdata;            // write data word
917      sc_signal<data_t> * r_cas_rdata;            // read data word
918      sc_signal<uint32_t> r_cas_lfsr;             // lfsr for random introducing
919      sc_signal<size_t>   r_cas_cpt;              // size of command
920      sc_signal<copy_t>   r_cas_copy;             // Srcid of the first copy
921      sc_signal<copy_t>   r_cas_copy_cache;       // Srcid of the first copy
922      sc_signal<bool>     r_cas_copy_inst;        // Type of the first copy
923      sc_signal<size_t>   r_cas_count;            // number of copies
924      sc_signal<size_t>   r_cas_ptr;              // pointer to the heap
925      sc_signal<size_t>   r_cas_next_ptr;         // next pointer to the heap
926      sc_signal<bool>     r_cas_is_cnt;           // is_cnt bit (in directory)
927      sc_signal<bool>     r_cas_dirty;            // dirty bit (in directory)
928      sc_signal<size_t>   r_cas_way;              // way in directory
929      sc_signal<size_t>   r_cas_set;              // set in directory
930      sc_signal<data_t>   r_cas_tag;              // cache line tag (in directory)
931      sc_signal<size_t>   r_cas_trt_index;        // Transaction Table index
932      sc_signal<size_t>   r_cas_upt_index;        // Update Table index
933      sc_signal<data_t> * r_cas_data;             // cache line data
[331]934
[477]935      sc_signal<bool>     r_cas_coherent;
936
[331]937      // Buffer between CAS fsm and IXR_CMD fsm (XRAM write)
938      sc_signal<bool>     r_cas_to_ixr_cmd_req;   // valid request
[814]939      sc_signal<size_t>   r_cas_to_ixr_cmd_index; // TRT index
[331]940
941      // Buffer between CAS fsm and TGT_RSP fsm
942      sc_signal<bool>     r_cas_to_tgt_rsp_req;   // valid request
943      sc_signal<data_t>   r_cas_to_tgt_rsp_data;  // read data word
944      sc_signal<size_t>   r_cas_to_tgt_rsp_srcid; // Transaction srcid
945      sc_signal<size_t>   r_cas_to_tgt_rsp_trdid; // Transaction trdid
946      sc_signal<size_t>   r_cas_to_tgt_rsp_pktid; // Transaction pktid
947
948      // Buffer between CAS fsm and CC_SEND fsm (Update/Invalidate L1 caches)
949      sc_signal<bool>     r_cas_to_cc_send_multi_req;     // valid request
950      sc_signal<bool>     r_cas_to_cc_send_brdcast_req;   // brdcast request
951      sc_signal<addr_t>   r_cas_to_cc_send_nline;         // cache line index
952      sc_signal<size_t>   r_cas_to_cc_send_trdid;         // index in Update Table
953      sc_signal<data_t>   r_cas_to_cc_send_wdata;         // data (one word)
954      sc_signal<bool>     r_cas_to_cc_send_is_long;       // it is a 64 bits CAS
955      sc_signal<data_t>   r_cas_to_cc_send_wdata_high;    // data high (one word)
956      sc_signal<size_t>   r_cas_to_cc_send_index;         // index of the word in line
957      GenericFifo<bool>   m_cas_to_cc_send_inst_fifo;     // fifo for the L1 type
958      GenericFifo<size_t> m_cas_to_cc_send_srcid_fifo;    // fifo for srcids
[385]959
[331]960      ////////////////////////////////////////////////////
961      // Registers controlled by the IXR_RSP fsm
962      ////////////////////////////////////////////////////
963
[495]964      sc_signal<int>      r_ixr_rsp_fsm;                // FSM state
965      sc_signal<size_t>   r_ixr_rsp_trt_index;          // TRT entry index
966      sc_signal<size_t>   r_ixr_rsp_cpt;                // word counter
[331]967
[495]968      // Buffer between IXR_RSP fsm and CONFIG fsm  (response from the XRAM)
[814]969      sc_signal<bool>     r_ixr_rsp_to_config_ack;      // one single bit
[495]970
[331]971      // Buffer between IXR_RSP fsm and XRAM_RSP fsm  (response from the XRAM)
[495]972      sc_signal<bool>   * r_ixr_rsp_to_xram_rsp_rok;    // one bit per TRT entry
[331]973
974      ////////////////////////////////////////////////////
975      // Registers controlled by the XRAM_RSP fsm
976      ////////////////////////////////////////////////////
977
978      sc_signal<int>      r_xram_rsp_fsm;               // FSM state
979      sc_signal<size_t>   r_xram_rsp_trt_index;         // TRT entry index
980      TransactionTabEntry r_xram_rsp_trt_buf;           // TRT entry local buffer
981      sc_signal<bool>     r_xram_rsp_victim_inval;      // victim line invalidate
982      sc_signal<bool>     r_xram_rsp_victim_is_cnt;     // victim line inst bit
983      sc_signal<bool>     r_xram_rsp_victim_dirty;      // victim line dirty bit
984      sc_signal<size_t>   r_xram_rsp_victim_way;        // victim line way
985      sc_signal<size_t>   r_xram_rsp_victim_set;        // victim line set
986      sc_signal<addr_t>   r_xram_rsp_victim_nline;      // victim line index
987      sc_signal<copy_t>   r_xram_rsp_victim_copy;       // victim line first copy
988      sc_signal<copy_t>   r_xram_rsp_victim_copy_cache; // victim line first copy
989      sc_signal<bool>     r_xram_rsp_victim_copy_inst;  // victim line type of first copy
990      sc_signal<size_t>   r_xram_rsp_victim_count;      // victim line number of copies
991      sc_signal<size_t>   r_xram_rsp_victim_ptr;        // victim line pointer to the heap
992      sc_signal<data_t> * r_xram_rsp_victim_data;       // victim line data
[468]993      sc_signal<size_t>   r_xram_rsp_ivt_index;         // IVT entry index
[331]994      sc_signal<size_t>   r_xram_rsp_next_ptr;          // Next pointer to the heap
[767]995      sc_signal<bool>     r_xram_rsp_rerror_irq;        // WRITE MISS rerror irq
996      sc_signal<bool>     r_xram_rsp_rerror_irq_enable; // WRITE MISS rerror irq enable
997      sc_signal<addr_t>   r_xram_rsp_rerror_address;    // WRITE MISS rerror address
998      sc_signal<size_t>   r_xram_rsp_rerror_rsrcid;     // WRITE MISS rerror srcid
[331]999
1000      // Buffer between XRAM_RSP fsm and TGT_RSP fsm  (response to L1 cache)
1001      sc_signal<bool>     r_xram_rsp_to_tgt_rsp_req;    // Valid request
1002      sc_signal<size_t>   r_xram_rsp_to_tgt_rsp_srcid;  // Transaction srcid
1003      sc_signal<size_t>   r_xram_rsp_to_tgt_rsp_trdid;  // Transaction trdid
1004      sc_signal<size_t>   r_xram_rsp_to_tgt_rsp_pktid;  // Transaction pktid
1005      sc_signal<data_t> * r_xram_rsp_to_tgt_rsp_data;   // data (one cache line)
1006      sc_signal<size_t>   r_xram_rsp_to_tgt_rsp_word;   // first word index
1007      sc_signal<size_t>   r_xram_rsp_to_tgt_rsp_length; // length of the response
1008      sc_signal<bool>     r_xram_rsp_to_tgt_rsp_rerror; // send error to requester
[385]1009      sc_signal<addr_t>   r_xram_rsp_to_tgt_rsp_ll_key; // LL key from llsc_global_table
[331]1010
1011      // Buffer between XRAM_RSP fsm and CC_SEND fsm (Inval L1 Caches)
1012      sc_signal<bool>     r_xram_rsp_to_cc_send_multi_req;     // Valid request
1013      sc_signal<bool>     r_xram_rsp_to_cc_send_brdcast_req;   // Broadcast request
1014      sc_signal<addr_t>   r_xram_rsp_to_cc_send_nline;         // cache line index;
1015      sc_signal<size_t>   r_xram_rsp_to_cc_send_trdid;         // index of UPT entry
1016      GenericFifo<bool>   m_xram_rsp_to_cc_send_inst_fifo;     // fifo for the L1 type
1017      GenericFifo<size_t> m_xram_rsp_to_cc_send_srcid_fifo;    // fifo for srcids
[385]1018
[814]1019      // Buffer between XRAM_RSP fsm and IXR_CMD fsm
[331]1020      sc_signal<bool>     r_xram_rsp_to_ixr_cmd_req;   // Valid request
[814]1021      sc_signal<size_t>   r_xram_rsp_to_ixr_cmd_index; // TRT index
[331]1022
[477]1023      //RWT
1024      sc_signal<bool>     r_xram_rsp_victim_coherent;      // victim's cache slot state
1025      sc_signal<bool>     r_xram_rsp_coherent;             // coherence of the read
[331]1026      ////////////////////////////////////////////////////
1027      // Registers controlled by the IXR_CMD fsm
1028      ////////////////////////////////////////////////////
1029
1030      sc_signal<int>      r_ixr_cmd_fsm;
[495]1031      sc_signal<size_t>   r_ixr_cmd_word;              // word index for a put
[814]1032      sc_signal<size_t>   r_ixr_cmd_trdid;             // TRT index value
[495]1033      sc_signal<addr_t>   r_ixr_cmd_address;           // address to XRAM
1034      sc_signal<data_t> * r_ixr_cmd_wdata;             // cache line buffer
1035      sc_signal<bool>     r_ixr_cmd_get;               // transaction type (PUT/GET)
[331]1036
1037      ////////////////////////////////////////////////////
1038      // Registers controlled by TGT_RSP fsm
1039      ////////////////////////////////////////////////////
1040
1041      sc_signal<int>      r_tgt_rsp_fsm;
1042      sc_signal<size_t>   r_tgt_rsp_cpt;
[362]1043      sc_signal<bool>     r_tgt_rsp_key_sent;
[331]1044
1045      ////////////////////////////////////////////////////
1046      // Registers controlled by CC_SEND fsm
1047      ////////////////////////////////////////////////////
1048
1049      sc_signal<int>      r_cc_send_fsm;
1050      sc_signal<size_t>   r_cc_send_cpt;
1051      sc_signal<bool>     r_cc_send_inst;
1052
1053      ////////////////////////////////////////////////////
1054      // Registers controlled by CC_RECEIVE fsm
1055      ////////////////////////////////////////////////////
1056
1057      sc_signal<int>      r_cc_receive_fsm;
1058
1059      ////////////////////////////////////////////////////
1060      // Registers controlled by ALLOC_DIR fsm
1061      ////////////////////////////////////////////////////
1062
1063      sc_signal<int>      r_alloc_dir_fsm;
1064      sc_signal<unsigned> r_alloc_dir_reset_cpt;
1065
1066      ////////////////////////////////////////////////////
1067      // Registers controlled by ALLOC_TRT fsm
1068      ////////////////////////////////////////////////////
1069
1070      sc_signal<int>      r_alloc_trt_fsm;
1071
1072      ////////////////////////////////////////////////////
1073      // Registers controlled by ALLOC_UPT fsm
1074      ////////////////////////////////////////////////////
1075
1076      sc_signal<int>      r_alloc_upt_fsm;
1077
1078      ////////////////////////////////////////////////////
[468]1079      // Registers controlled by ALLOC_IVT fsm
1080      ////////////////////////////////////////////////////
1081
1082      sc_signal<int>      r_alloc_ivt_fsm;
1083
1084      ////////////////////////////////////////////////////
[331]1085      // Registers controlled by ALLOC_HEAP fsm
1086      ////////////////////////////////////////////////////
1087
1088      sc_signal<int>      r_alloc_heap_fsm;
1089      sc_signal<unsigned> r_alloc_heap_reset_cpt;
[477]1090
1091
1092      ////////////////////////////////////////////////////
1093      // REGISTERS FOR ODCCP
1094      ////////////////////////////////////////////////////
1095
1096      sc_signal<uint32_t>  r_cleanup_data_index;
1097      sc_signal<uint32_t>  r_cleanup_trdid;
1098      sc_signal<uint32_t>  r_cleanup_pktid;
1099      sc_signal<bool>      r_cleanup_coherent;
1100      sc_signal<data_t>    *r_cleanup_data;
1101      sc_signal<data_t>    *r_cleanup_old_data;
1102      sc_signal<bool>      r_cleanup_contains_data;
[814]1103
[477]1104      sc_signal<bool>      r_cleanup_ncc;
[814]1105
[477]1106      sc_signal<bool>      r_cleanup_to_ixr_cmd_req;
1107      sc_signal<data_t>    *r_cleanup_to_ixr_cmd_data;
1108      sc_signal<uint32_t>  r_cleanup_to_ixr_cmd_srcid;
[495]1109      sc_signal<uint32_t>  r_cleanup_to_ixr_cmd_index;
[477]1110      sc_signal<uint32_t>  r_cleanup_to_ixr_cmd_pktid;
1111      sc_signal<addr_t>    r_cleanup_to_ixr_cmd_nline;
[331]1112    }; // end class VciMemCache
1113
1114}}
1115
1116#endif
1117
1118// Local Variables:
1119// tab-width: 2
1120// c-basic-offset: 2
1121// c-file-offsets:((innamespace . 0)(inline-open . 0))
1122// indent-tabs-mode: nil
1123// End:
1124
1125// vim: filetype=cpp:expandtab:shiftwidth=2:tabstop=2:softtabstop=2
1126
Note: See TracBrowser for help on using the repository browser.