source: branches/v4/platforms/almos-tsarv3-platforms/common/vci_mem_cache_v3/caba/source/include/vci_mem_cache_v3.h

Last change on this file 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: 31.3 KB
Line 
1/* -*- c++ -*-
2 * File         : vci_mem_cache_v3.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 *
27 * Maintainers: alain eric.guthmuller@polytechnique.edu
28 */
29/*
30 *
31 * Modifications done by Christophe Choichillon on the 7/04/2009:
32 * - Adding new states in the CLEANUP FSM : CLEANUP_UPT_LOCK and CLEANUP_UPT_WRITE
33 * - Adding a new VCI target port for the CLEANUP network
34 * - Adding new state in the ALLOC_UPT_FSM : ALLOC_UPT_CLEANUP
35 *
36 * Modifications to do :
37 * - Adding new variables used by the CLEANUP FSM
38 *
39 */
40
41#ifndef SOCLIB_CABA_MEM_CACHE_V3_H
42#define SOCLIB_CABA_MEM_CACHE_V3_H
43
44#include <inttypes.h>
45#include <systemc>
46#include <list>
47#include <cassert>
48#include <iostream>
49#include <fstream>
50#include "arithmetics.h"
51#include "alloc_elems.h"
52#include "caba_base_module.h"
53#include "vci_target.h"
54#include "vci_initiator.h"
55#include "generic_fifo.h"
56#include "mapping_table.h"
57#include "int_tab.h"
58#include "mem_cache_directory_v3.h"
59#include "xram_transaction_v3.h"
60#include "update_tab_v3.h"
61#include "atomic_tab_v3.h"
62#include "config.h"
63
64#define TRANSACTION_TAB_LINES   CONFIG_MEMC_TRANSACTION_TAB_LINES     // Number of lines in the transaction tab
65#define UPDATE_TAB_LINES        CONFIG_MEMC_UPDATE_TAB_LINES    // Number of lines in the update tab
66
67namespace soclib {  namespace caba {
68  using namespace sc_core;
69
70  template<typename vci_param>
71    class VciMemCacheV3
72    : public soclib::caba::BaseModule
73    {
74      typedef sc_dt::sc_uint<40> addr_t;
75      typedef typename vci_param::fast_addr_t vci_addr_t;
76      typedef uint32_t data_t;
77      typedef uint32_t tag_t;
78      typedef uint32_t size_t;
79      typedef uint32_t be_t;
80      typedef uint32_t copy_t;
81
82      /* States of the TGT_CMD fsm */
83      enum tgt_cmd_fsm_state_e{
84        TGT_CMD_IDLE,
85        TGT_CMD_READ,
86        TGT_CMD_READ_EOP,
87        TGT_CMD_WRITE,
88        TGT_CMD_ATOMIC,
89      };
90
91      /* States of the TGT_RSP fsm */
92      enum tgt_rsp_fsm_state_e{
93        TGT_RSP_READ_IDLE,
94        TGT_RSP_WRITE_IDLE,
95        TGT_RSP_LLSC_IDLE,
96        TGT_RSP_XRAM_IDLE,
97        TGT_RSP_INIT_IDLE,
98        TGT_RSP_CLEANUP_IDLE,
99        TGT_RSP_READ,
100        TGT_RSP_WRITE,
101        TGT_RSP_LLSC,
102        TGT_RSP_XRAM,
103        TGT_RSP_INIT,
104        TGT_RSP_CLEANUP,
105      };
106
107      /* States of the INIT_CMD fsm */
108      enum init_cmd_fsm_state_e{
109        INIT_CMD_INVAL_IDLE,
110        INIT_CMD_INVAL_NLINE,
111        INIT_CMD_XRAM_BRDCAST,
112        INIT_CMD_UPDT_IDLE,
113        INIT_CMD_WRITE_BRDCAST,
114        INIT_CMD_UPDT_NLINE,
115        INIT_CMD_UPDT_INDEX,
116        INIT_CMD_UPDT_DATA,
117        INIT_CMD_SC_UPDT_IDLE,
118        INIT_CMD_SC_BRDCAST,
119        INIT_CMD_SC_UPDT_NLINE,
120        INIT_CMD_SC_UPDT_INDEX,
121        INIT_CMD_SC_UPDT_DATA,
122      };
123
124      /* States of the INIT_RSP fsm */
125      enum init_rsp_fsm_state_e{
126        INIT_RSP_IDLE,
127        INIT_RSP_UPT_LOCK,
128        INIT_RSP_UPT_CLEAR,
129        INIT_RSP_END,
130      };
131
132      /* States of the READ fsm */
133      enum read_fsm_state_e{
134        READ_IDLE,
135        READ_DIR_LOCK,
136        READ_DIR_HIT,
137        READ_HEAP_LOCK,
138        READ_HEAP_WRITE,
139        READ_HEAP_ERASE,
140        READ_HEAP_LAST,
141        READ_RSP,
142        READ_TRT_LOCK,
143        READ_TRT_SET,
144        READ_XRAM_REQ,
145      };
146
147      /* States of the WRITE fsm */
148      enum write_fsm_state_e{
149        WRITE_IDLE,
150        WRITE_NEXT,
151        WRITE_DIR_LOCK,
152        WRITE_DIR_HIT_READ,
153        WRITE_DIR_HIT,
154        WRITE_DIR_HIT_RSP,
155        WRITE_UPT_LOCK,
156        WRITE_HEAP_LOCK,
157        WRITE_UPT_REQ,
158        WRITE_UPDATE,
159        WRITE_UPT_DEC,
160        WRITE_RSP,
161        WRITE_TRT_LOCK,
162        WRITE_TRT_DATA,
163        WRITE_TRT_SET,
164        WRITE_WAIT,
165        WRITE_XRAM_REQ,
166        WRITE_TRT_WRITE_LOCK,
167        WRITE_INVAL_LOCK,
168        WRITE_DIR_INVAL,
169        WRITE_INVAL,
170        WRITE_XRAM_SEND,
171        WRITE_HEAP_ERASE,
172        WRITE_HEAP_LAST,
173      };
174
175      /* States of the IXR_RSP fsm */
176      enum ixr_rsp_fsm_state_e{
177        IXR_RSP_IDLE,
178        IXR_RSP_ACK,
179        IXR_RSP_TRT_ERASE,
180        IXR_RSP_TRT_READ,
181      };
182
183      /* States of the XRAM_RSP fsm */
184      enum xram_rsp_fsm_state_e{
185        XRAM_RSP_IDLE,
186        XRAM_RSP_TRT_COPY,
187        XRAM_RSP_TRT_DIRTY,
188        XRAM_RSP_DIR_LOCK,
189        XRAM_RSP_DIR_UPDT,
190        XRAM_RSP_DIR_RSP,
191        XRAM_RSP_INVAL_LOCK,
192        XRAM_RSP_INVAL_WAIT,
193        XRAM_RSP_INVAL,
194        XRAM_RSP_WRITE_DIRTY,
195        XRAM_RSP_HEAP_ERASE,
196        XRAM_RSP_HEAP_LAST,
197      };
198
199      /* States of the IXR_CMD fsm */
200      enum ixr_cmd_fsm_state_e{
201        IXR_CMD_READ_IDLE,
202        IXR_CMD_WRITE_IDLE,
203        IXR_CMD_LLSC_IDLE,
204        IXR_CMD_XRAM_IDLE,
205        IXR_CMD_READ_NLINE,
206        IXR_CMD_WRITE_NLINE,
207        IXR_CMD_LLSC_NLINE,
208        IXR_CMD_XRAM_DATA,
209      };
210
211      /* States of the LLSC fsm */
212      enum llsc_fsm_state_e{
213        LLSC_IDLE,
214        LL_DIR_LOCK,
215        LL_DIR_HIT,
216        LL_RSP,
217        SC_DIR_LOCK,
218        SC_DIR_HIT,
219        SC_UPT_LOCK,
220        SC_WAIT,
221        SC_HEAP_LOCK,
222        SC_UPT_REQ,
223        SC_UPDATE,
224        SC_TRT_LOCK,
225        SC_INVAL_LOCK,
226        SC_DIR_INVAL,
227        SC_INVAL,
228        SC_XRAM_SEND,
229        SC_HEAP_ERASE,
230        SC_HEAP_LAST, 
231        SC_RSP_FALSE,
232        SC_RSP_TRUE,
233        LLSC_TRT_LOCK,
234        LLSC_TRT_SET,
235        LLSC_XRAM_REQ,
236      };
237
238      /* States of the CLEANUP fsm */
239      enum cleanup_fsm_state_e{
240        CLEANUP_IDLE,
241        CLEANUP_DIR_LOCK,
242        CLEANUP_DIR_WRITE,
243        CLEANUP_HEAP_LOCK,
244        CLEANUP_HEAP_SEARCH,
245        CLEANUP_HEAP_CLEAN,
246        CLEANUP_HEAP_FREE,
247        CLEANUP_UPT_LOCK,
248        CLEANUP_UPT_WRITE,
249        CLEANUP_WRITE_RSP,
250        CLEANUP_RSP,
251      };
252
253      /* States of the ALLOC_DIR fsm */
254      enum alloc_dir_fsm_state_e{
255        ALLOC_DIR_READ,
256        ALLOC_DIR_WRITE,
257        ALLOC_DIR_LLSC,
258        ALLOC_DIR_CLEANUP,
259        ALLOC_DIR_XRAM_RSP,
260      };
261
262      /* States of the ALLOC_TRT fsm */
263      enum alloc_trt_fsm_state_e{
264        ALLOC_TRT_READ,
265        ALLOC_TRT_WRITE,
266        ALLOC_TRT_LLSC,
267        ALLOC_TRT_XRAM_RSP,
268        ALLOC_TRT_IXR_RSP,
269      };
270
271      /* States of the ALLOC_UPT fsm */
272      enum alloc_upt_fsm_state_e{
273        ALLOC_UPT_WRITE,
274        ALLOC_UPT_XRAM_RSP,
275        ALLOC_UPT_INIT_RSP,
276        ALLOC_UPT_CLEANUP,
277        ALLOC_UPT_LLSC,
278      };
279
280      /* States of the ALLOC_HEAP fsm */
281      enum alloc_heap_fsm_state_e{
282        ALLOC_HEAP_READ,
283        ALLOC_HEAP_WRITE,
284        ALLOC_HEAP_LLSC,
285        ALLOC_HEAP_CLEANUP,
286        ALLOC_HEAP_XRAM_RSP,
287      };
288
289      uint32_t     m_cpt_cycles;            // Counter of cycles
290      uint32_t     m_cpt_read;              // Number of READ transactions
291      uint32_t     m_cpt_read_miss;         // Number of MISS READ
292      uint32_t     m_cpt_write;             // Number of WRITE transactions
293      uint32_t     m_cpt_write_miss;        // Number of MISS WRITE
294      uint32_t     m_cpt_write_cells;       // Cumulated length for WRITE transactions
295      uint32_t     m_cpt_write_dirty;       // Cumulated length for WRITE transactions
296      uint32_t     m_cpt_update;            // Number of UPDATE transactions
297      uint32_t     m_cpt_update_mult;       // Number of targets for UPDATE
298      uint32_t     m_cpt_inval;             // Number of INVAL  transactions
299      uint32_t     m_cpt_inval_mult;        // Number of targets for INVAL 
300      uint32_t     m_cpt_inval_brdcast;     // Number of BROADCAST INVAL 
301      uint32_t     m_cpt_cleanup;           // Number of CLEANUP transactions
302      uint32_t     m_cpt_ll;                // Number of LL transactions
303      uint32_t     m_cpt_sc;                // Number of SC transactions
304      uint32_t     m_total_cycles;
305      unsigned long m_waiting_cycles;        // Number of TGT FSM waiting cycles
306      double        m_wait_threshold;       // Trace threshold upon waiting cycles percentage
307
308      protected:
309
310      SC_HAS_PROCESS(VciMemCacheV3);
311
312      public:
313      sc_in<bool>                               p_clk;
314      sc_in<bool>                               p_resetn;
315      soclib::caba::VciTarget<vci_param>        p_vci_tgt;
316      soclib::caba::VciTarget<vci_param>        p_vci_tgt_cleanup;
317      soclib::caba::VciInitiator<vci_param>     p_vci_ini;     
318      soclib::caba::VciInitiator<vci_param>     p_vci_ixr;
319
320      VciMemCacheV3(
321          sc_module_name name,                              // Instance Name
322          const soclib::common::MappingTable &mtp,          // Mapping table for primary requets
323          const soclib::common::MappingTable &mtc,          // Mapping table for coherence requets
324          const soclib::common::MappingTable &mtx,          // Mapping table for XRAM
325          const soclib::common::IntTab &vci_ixr_index,      // VCI port to XRAM (initiator)
326          const soclib::common::IntTab &vci_ini_index,      // VCI port to PROC (initiator)
327          const soclib::common::IntTab &vci_tgt_index,      // VCI port to PROC (target)
328          const soclib::common::IntTab &vci_tgt_index_cleanup,    // VCI port to PROC (target) for cleanup
329          size_t nways,                                     // Number of ways per set
330          size_t nsets,                                     // Number of sets
331          size_t nwords,                                    // Number of words per line
332          size_t heap_size=1024);                           // Size of the heap
333
334      ~VciMemCacheV3();
335
336      void transition();
337
338      void genMoore();
339
340      void print_stats();
341      void clear_stats();
342
343      private:
344       
345        void print_log();
346        void print_trace_to_log_file();
347       
348      // Component attributes
349      const size_t              m_initiators;           // Number of initiators
350      const size_t              m_heap_size;            // Size of the heap
351      const size_t              m_ways;                 // Number of ways in a set
352      const size_t              m_sets;                 // Number of cache sets
353      const size_t              m_words;                        // Number of words in a line
354      const size_t              m_srcid_ixr;                // Srcid for requests to XRAM
355      const size_t              m_srcid_ini;                // Srcid for requests to processors
356      std::list<soclib::common::Segment>  m_seglist;    // memory cached into the cache
357      std::list<soclib::common::Segment>  m_cseglist;   // coherence segment for the cache
358      vci_addr_t                        *m_coherence_table;     // address(srcid)
359      AtomicTab                 m_atomic_tab;           // atomic access table
360      TransactionTab                    m_transaction_tab;          // xram transaction table
361      UpdateTab                 m_update_tab;               // pending update & invalidate
362      CacheDirectory                    m_cache_directory;          // data cache directory
363      HeapDirectory             m_heap_directory;       // heap directory
364
365      data_t                           ***m_cache_data;         // data array[set][way][word]
366        std::ofstream             m_log;
367      size_t                    m_tm_start;
368      long long                 m_debug_start;
369      size_t                    m_tm_end;
370      size_t                    m_period;
371
372
373      // adress masks
374      const soclib::common::AddressMaskingTable<vci_addr_t>   m_x;
375      const soclib::common::AddressMaskingTable<vci_addr_t>   m_y;
376      const soclib::common::AddressMaskingTable<vci_addr_t>   m_z;
377      const soclib::common::AddressMaskingTable<vci_addr_t>   m_nline; 
378
379      // broadcast address
380      vci_addr_t broadcast_addr;
381
382      //////////////////////////////////////////////////
383      // Others registers
384      //////////////////////////////////////////////////
385      size_t m_copy_threshold;
386      sc_signal<size_t>   r_copies_limit; // Limit of the number of copies for one line
387
388      //////////////////////////////////////////////////
389      // Registers controlled by the TGT_CMD fsm
390      //////////////////////////////////////////////////
391
392      // Fifo between TGT_CMD fsm and READ fsm
393      GenericFifo<uint64_t>  m_cmd_read_addr_fifo;
394      GenericFifo<size_t>    m_cmd_read_length_fifo;
395      GenericFifo<size_t>    m_cmd_read_srcid_fifo;
396      GenericFifo<size_t>    m_cmd_read_trdid_fifo;
397      GenericFifo<size_t>    m_cmd_read_pktid_fifo;
398
399      // Fifo between TGT_CMD fsm and WRITE fsm   
400      GenericFifo<uint64_t>  m_cmd_write_addr_fifo;
401      GenericFifo<bool>      m_cmd_write_eop_fifo;
402      GenericFifo<size_t>    m_cmd_write_srcid_fifo;
403      GenericFifo<size_t>    m_cmd_write_trdid_fifo;
404      GenericFifo<size_t>    m_cmd_write_pktid_fifo;
405      GenericFifo<data_t>    m_cmd_write_data_fifo;
406      GenericFifo<be_t>      m_cmd_write_be_fifo;
407
408      // Fifo between TGT_CMD fsm and LLSC fsm
409      GenericFifo<uint64_t>  m_cmd_llsc_addr_fifo;
410      GenericFifo<bool>      m_cmd_llsc_sc_fifo;
411      GenericFifo<size_t>    m_cmd_llsc_srcid_fifo;
412      GenericFifo<size_t>    m_cmd_llsc_trdid_fifo;
413      GenericFifo<size_t>    m_cmd_llsc_pktid_fifo;
414      GenericFifo<data_t>    m_cmd_llsc_wdata_fifo;
415
416      sc_signal<int>         r_tgt_cmd_fsm;
417
418      sc_signal<size_t>      r_index;
419      size_t nseg;
420      size_t ncseg;
421      soclib::common::Segment  **m_seg;
422      soclib::common::Segment  **m_cseg;
423      ///////////////////////////////////////////////////////
424      // Registers controlled by the READ fsm
425      ///////////////////////////////////////////////////////
426
427      sc_signal<int>         r_read_fsm;        // FSM state
428      sc_signal<size_t>      r_read_copy;       // Srcid of the first copy
429      sc_signal<bool>        r_read_copy_inst;  // Type of the first copy
430      sc_signal<tag_t>       r_read_tag;            // cache line tag (in directory)
431      sc_signal<bool>        r_read_is_cnt;         // is_cnt bit (in directory)
432      sc_signal<bool>        r_read_lock;           // lock bit (in directory)
433      sc_signal<bool>        r_read_dirty;          // dirty bit (in directory)
434      sc_signal<bool>        r_read_inst;       // it is an instruction line
435      sc_signal<size_t>      r_read_count;      // number of copies
436      sc_signal<size_t>      r_read_ptr;        // pointer to the heap
437      sc_signal<data_t>     *r_read_data;       // data (one cache line)
438      sc_signal<size_t>      r_read_way;        // associative way (in cache)
439      sc_signal<size_t>      r_read_trt_index;  // Transaction Table index
440      sc_signal<size_t>      r_read_next_ptr;   // Next entry to point to
441      sc_signal<bool>        r_read_last_free;  // Last free entry
442
443      // Buffer between READ fsm and IXR_CMD fsm (ask a missing cache line to XRAM)   
444      sc_signal<bool>        r_read_to_ixr_cmd_req;     // valid request
445      sc_signal<addr_t>      r_read_to_ixr_cmd_nline;   // cache line index
446      sc_signal<size_t>      r_read_to_ixr_cmd_trdid;   // index in Transaction Table
447
448      // Buffer between READ fsm and TGT_RSP fsm (send a hit read response to L1 cache)
449      sc_signal<bool>      r_read_to_tgt_rsp_req;       // valid request
450      sc_signal<size_t>    r_read_to_tgt_rsp_srcid;         // Transaction srcid
451      sc_signal<size_t>    r_read_to_tgt_rsp_trdid;         // Transaction trdid
452      sc_signal<size_t>    r_read_to_tgt_rsp_pktid;         // Transaction pktid
453      sc_signal<data_t>   *r_read_to_tgt_rsp_data;          // data (one cache line)
454      sc_signal<size_t>    r_read_to_tgt_rsp_word;      // first word of the response
455      sc_signal<size_t>    r_read_to_tgt_rsp_length;    // length of the response
456
457      ///////////////////////////////////////////////////////////////
458      // Registers controlled by the WRITE fsm
459      ///////////////////////////////////////////////////////////////
460
461      sc_signal<int>       r_write_fsm;             // FSM state
462      sc_signal<addr_t>    r_write_address;         // first word address
463      sc_signal<size_t>    r_write_word_index;      // first word index in line
464      sc_signal<size_t>    r_write_word_count;      // number of words in line
465      sc_signal<size_t>    r_write_srcid;           // transaction srcid
466      sc_signal<size_t>    r_write_trdid;           // transaction trdid
467      sc_signal<size_t>    r_write_pktid;           // transaction pktid
468      sc_signal<data_t>   *r_write_data;            // data (one cache line)   
469      sc_signal<be_t>     *r_write_be;              // one byte enable per word
470      sc_signal<bool>      r_write_byte;            // is it a byte write
471      sc_signal<bool>      r_write_is_cnt;          // is_cnt bit (in directory)
472      sc_signal<bool>      r_write_lock;            // lock bit (in directory)
473      sc_signal<bool>      r_write_inst;            // instruction bit
474      sc_signal<tag_t>     r_write_tag;             // cache line tag (in directory)
475      sc_signal<size_t>    r_write_copy;            // first owner of the line
476      sc_signal<bool>      r_write_copy_inst;       // is this owner a ICache ?
477      sc_signal<size_t>    r_write_count;           // number of copies
478      sc_signal<size_t>    r_write_ptr;             // pointer to the heap
479      sc_signal<size_t>    r_write_next_ptr;        // next pointer to the heap
480      sc_signal<bool>      r_write_to_dec;          // need to decrement update counter
481      sc_signal<size_t>    r_write_way;                 // way of the line
482      sc_signal<size_t>    r_write_trt_index;       // index in Transaction Table
483      sc_signal<size_t>    r_write_upt_index;       // index in Update Table
484
485      // Buffer between WRITE fsm and TGT_RSP fsm (acknowledge a write command from L1)
486      sc_signal<bool>      r_write_to_tgt_rsp_req;              // valid request
487      sc_signal<size_t>    r_write_to_tgt_rsp_srcid;    // transaction srcid
488      sc_signal<size_t>    r_write_to_tgt_rsp_trdid;    // transaction trdid
489      sc_signal<size_t>    r_write_to_tgt_rsp_pktid;    // transaction pktid
490
491      // Buffer between WRITE fsm and IXR_CMD fsm (ask a missing cache line to XRAM)
492      sc_signal<bool>      r_write_to_ixr_cmd_req;      // valid request
493      sc_signal<bool>      r_write_to_ixr_cmd_write;    // write request
494      sc_signal<addr_t>    r_write_to_ixr_cmd_nline;    // cache line index
495      sc_signal<data_t>   *r_write_to_ixr_cmd_data;         // cache line data
496      sc_signal<size_t>    r_write_to_ixr_cmd_trdid;    // index in Transaction Table
497
498      // Buffer between WRITE fsm and INIT_CMD fsm (Update/Invalidate L1 caches)
499      sc_signal<bool>      r_write_to_init_cmd_multi_req;   // valid multicast request
500      sc_signal<bool>      r_write_to_init_cmd_brdcast_req; // valid brdcast request
501      sc_signal<addr_t>    r_write_to_init_cmd_nline;       // cache line index
502      sc_signal<size_t>    r_write_to_init_cmd_trdid;       // index in Update Table
503      sc_signal<data_t>   *r_write_to_init_cmd_data;        // data (one cache line)
504      sc_signal<bool>     *r_write_to_init_cmd_we;              // word enable
505      sc_signal<size_t>    r_write_to_init_cmd_count;       // number of words in line
506      sc_signal<size_t>    r_write_to_init_cmd_index;       // index of first word in line
507      GenericFifo<bool>    m_write_to_init_cmd_inst_fifo;   // fifo for the L1 type
508      GenericFifo<size_t>  m_write_to_init_cmd_srcid_fifo;  // fifo for srcids
509
510      // Buffer between WRITE fsm and INIT_RSP fsm (Decrement UPT entry)
511      sc_signal<bool>      r_write_to_init_rsp_req;         // valid request
512      sc_signal<size_t>    r_write_to_init_rsp_upt_index;   // index in update table
513
514      /////////////////////////////////////////////////////////
515      // Registers controlled by INIT_RSP fsm
516      //////////////////////////////////////////////////////////
517
518      sc_signal<int>       r_init_rsp_fsm;        // FSM state
519      sc_signal<size_t>    r_init_rsp_upt_index;  // index in the Update Table
520      sc_signal<size_t>    r_init_rsp_srcid;      // pending write srcid     
521      sc_signal<size_t>    r_init_rsp_trdid;      // pending write trdid     
522      sc_signal<size_t>    r_init_rsp_pktid;      // pending write pktid     
523      sc_signal<addr_t>    r_init_rsp_nline;      // pending write nline     
524
525      // Buffer between INIT_RSP fsm and TGT_RSP fsm (complete write/update transaction)
526      sc_signal<bool>        r_init_rsp_to_tgt_rsp_req;         // valid request
527      sc_signal<size_t>    r_init_rsp_to_tgt_rsp_srcid;         // Transaction srcid
528      sc_signal<size_t>    r_init_rsp_to_tgt_rsp_trdid;         // Transaction trdid
529      sc_signal<size_t>    r_init_rsp_to_tgt_rsp_pktid;         // Transaction pktid
530
531      ///////////////////////////////////////////////////////
532      // Registers controlled by CLEANUP fsm
533      ///////////////////////////////////////////////////////
534
535      sc_signal<int>         r_cleanup_fsm;         // FSM state
536      sc_signal<size_t>      r_cleanup_srcid;       // transaction srcid
537      sc_signal<size_t>      r_cleanup_trdid;       // transaction trdid
538      sc_signal<size_t>      r_cleanup_pktid;       // transaction pktid
539      sc_signal<addr_t>      r_cleanup_nline;       // cache line index
540
541      sc_signal<copy_t>      r_cleanup_copy;        // first copy
542      sc_signal<size_t>      r_cleanup_copy_inst;   // type of the first copy
543      sc_signal<copy_t>      r_cleanup_count;       // number of copies
544      sc_signal<size_t>      r_cleanup_ptr;         // pointer to the heap
545      sc_signal<size_t>      r_cleanup_prev_ptr;    // previous pointer to the heap
546      sc_signal<size_t>      r_cleanup_prev_srcid;  // srcid of previous heap entry
547      sc_signal<bool>        r_cleanup_prev_inst;   // inst bit of previous heap entry
548      sc_signal<size_t>      r_cleanup_next_ptr;    // next pointer to the heap
549      sc_signal<tag_t>       r_cleanup_tag;             // cache line tag (in directory)
550      sc_signal<bool>        r_cleanup_is_cnt;      // inst bit (in directory)
551      sc_signal<bool>        r_cleanup_lock;        // lock bit (in directory)
552      sc_signal<bool>        r_cleanup_inst;        // inst bit (in directory)
553      sc_signal<bool>        r_cleanup_dirty;       // dirty bit (in directory)
554      sc_signal<size_t>      r_cleanup_way;             // associative way (in cache)
555
556      sc_signal<size_t>      r_cleanup_write_srcid; // srcid of write response
557      sc_signal<size_t>      r_cleanup_write_trdid; // trdid of write rsp
558      sc_signal<size_t>      r_cleanup_write_pktid; // pktid of write rsp
559      sc_signal<bool>        r_cleanup_need_rsp;    // needs a write rsp
560
561      sc_signal<size_t>      r_cleanup_index;       // index of the INVAL line (in the UPT)
562
563      // Buffer between CLEANUP fsm and TGT_RSP fsm (acknowledge a write command from L1)
564      sc_signal<bool>      r_cleanup_to_tgt_rsp_req;    // valid request
565      sc_signal<size_t>    r_cleanup_to_tgt_rsp_srcid;  // transaction srcid
566      sc_signal<size_t>    r_cleanup_to_tgt_rsp_trdid;  // transaction trdid
567      sc_signal<size_t>    r_cleanup_to_tgt_rsp_pktid;  // transaction pktid
568
569      ///////////////////////////////////////////////////////
570      // Registers controlled by LLSC fsm
571      ///////////////////////////////////////////////////////
572
573      sc_signal<int>       r_llsc_fsm;          // FSM state
574      sc_signal<data_t>    r_llsc_data;             // read data word
575      sc_signal<copy_t>    r_llsc_copy;             // Srcid of the first copy
576      sc_signal<bool>      r_llsc_copy_inst;    // Type of the first copy
577      sc_signal<size_t>    r_llsc_count;            // number of copies
578      sc_signal<size_t>    r_llsc_ptr;              // pointer to the heap
579      sc_signal<size_t>    r_llsc_next_ptr;     // next pointer to the heap
580      sc_signal<bool>      r_llsc_is_cnt;           // is_cnt bit (in directory)
581      sc_signal<bool>      r_llsc_dirty;            // dirty bit (in directory)
582      sc_signal<bool>      r_llsc_inst;         // inst bit
583      sc_signal<size_t>    r_llsc_way;              // way in directory
584      sc_signal<size_t>    r_llsc_set;              // set in directory
585      sc_signal<data_t>    r_llsc_tag;              // cache line tag (in directory)
586      sc_signal<size_t>    r_llsc_trt_index;    // Transaction Table index
587      sc_signal<size_t>    r_llsc_upt_index;    // Update Table index
588
589      // Buffer between LLSC fsm and INIT_CMD fsm (XRAM read)   
590      sc_signal<bool>      r_llsc_to_ixr_cmd_req;   // valid request
591      sc_signal<addr_t>    r_llsc_to_ixr_cmd_nline; // cache line index
592      sc_signal<size_t>    r_llsc_to_ixr_cmd_trdid; // index in Transaction Table
593      sc_signal<bool>      r_llsc_to_ixr_cmd_write; // write request
594      sc_signal<data_t>   *r_llsc_to_ixr_cmd_data;  // cache line data
595
596
597      // Buffer between LLSC fsm and TGT_RSP fsm
598      sc_signal<bool>      r_llsc_to_tgt_rsp_req;   // valid request
599      sc_signal<data_t>    r_llsc_to_tgt_rsp_data;  // read data word
600      sc_signal<size_t>    r_llsc_to_tgt_rsp_srcid; // Transaction srcid
601      sc_signal<size_t>    r_llsc_to_tgt_rsp_trdid; // Transaction trdid
602      sc_signal<size_t>    r_llsc_to_tgt_rsp_pktid; // Transaction pktid
603
604      // Buffer between LLSC fsm and INIT_CMD fsm (Update/Invalidate L1 caches)
605      sc_signal<bool>      r_llsc_to_init_cmd_multi_req;    // valid request
606      sc_signal<bool>      r_llsc_to_init_cmd_brdcast_req;  // brdcast request
607      sc_signal<addr_t>    r_llsc_to_init_cmd_nline;        // cache line index
608      sc_signal<size_t>    r_llsc_to_init_cmd_trdid;        // index in Update Table
609      sc_signal<data_t>    r_llsc_to_init_cmd_wdata;        // data (one word)
610      sc_signal<size_t>    r_llsc_to_init_cmd_index;        // index of the word in line
611      GenericFifo<bool>    m_llsc_to_init_cmd_inst_fifo;    // fifo for the L1 type
612      GenericFifo<size_t>  m_llsc_to_init_cmd_srcid_fifo;   // fifo for srcids
613
614      // Buffer between LLSC fsm and INIT_RSP fsm (Decrement UPT entry)
615      sc_signal<bool>      r_llsc_to_init_rsp_req;          // valid request
616      sc_signal<size_t>    r_llsc_to_init_rsp_upt_index;    // index in update table
617
618      ////////////////////////////////////////////////////
619      // Registers controlled by the IXR_RSP fsm
620      ////////////////////////////////////////////////////
621
622      sc_signal<int>       r_ixr_rsp_fsm;       // FSM state
623      sc_signal<size_t>    r_ixr_rsp_trt_index; // TRT entry index
624      sc_signal<size_t>    r_ixr_rsp_cpt;           // word counter
625
626      // Buffer between IXR_RSP fsm and XRAM_RSP fsm  (response from the XRAM)
627      sc_signal<bool>     *r_ixr_rsp_to_xram_rsp_rok;   // A xram response is ready
628
629      ////////////////////////////////////////////////////
630      // Registers controlled by the XRAM_RSP fsm
631      ////////////////////////////////////////////////////
632
633      sc_signal<int>       r_xram_rsp_fsm;                      // FSM state
634      sc_signal<size_t>    r_xram_rsp_trt_index;            // TRT entry index
635      TransactionTabEntry  r_xram_rsp_trt_buf;              // TRT entry local buffer
636      sc_signal<bool>      r_xram_rsp_victim_inval;         // victim line invalidate
637      sc_signal<bool>      r_xram_rsp_victim_is_cnt;    // victim line inst bit
638      sc_signal<bool>      r_xram_rsp_victim_dirty;         // victim line dirty bit
639      sc_signal<size_t>    r_xram_rsp_victim_way;           // victim line way
640      sc_signal<size_t>    r_xram_rsp_victim_set;           // victim line set
641      sc_signal<addr_t>    r_xram_rsp_victim_nline;     // victim line index
642      sc_signal<copy_t>    r_xram_rsp_victim_copy;      // victim line first copy
643      sc_signal<bool>      r_xram_rsp_victim_copy_inst; // victim line type of first copy
644      sc_signal<size_t>    r_xram_rsp_victim_count;         // victim line number of copies
645      sc_signal<size_t>    r_xram_rsp_victim_ptr;       // victim line pointer to the heap
646      sc_signal<data_t>   *r_xram_rsp_victim_data;          // victim line data
647      sc_signal<size_t>    r_xram_rsp_upt_index;            // UPT entry index
648      sc_signal<size_t>    r_xram_rsp_next_ptr;         // Next pointer to the heap
649
650      // Buffer between XRAM_RSP fsm and TGT_RSP fsm  (response to L1 cache)
651      sc_signal<bool>      r_xram_rsp_to_tgt_rsp_req;   // Valid request
652      sc_signal<size_t>    r_xram_rsp_to_tgt_rsp_srcid; // Transaction srcid
653      sc_signal<size_t>    r_xram_rsp_to_tgt_rsp_trdid; // Transaction trdid
654      sc_signal<size_t>    r_xram_rsp_to_tgt_rsp_pktid; // Transaction pktid
655      sc_signal<data_t>   *r_xram_rsp_to_tgt_rsp_data;  // data (one cache line)
656      sc_signal<size_t>    r_xram_rsp_to_tgt_rsp_word;  // first word index
657      sc_signal<size_t>    r_xram_rsp_to_tgt_rsp_length;// length of the response
658
659      // Buffer between XRAM_RSP fsm and INIT_CMD fsm (Inval L1 Caches)
660      sc_signal<bool>       r_xram_rsp_to_init_cmd_multi_req;       // Valid request
661      sc_signal<bool>       r_xram_rsp_to_init_cmd_brdcast_req;     // Broadcast request
662      sc_signal<addr_t>     r_xram_rsp_to_init_cmd_nline;           // cache line index;
663      sc_signal<size_t>     r_xram_rsp_to_init_cmd_trdid;           // index of UPT entry
664      GenericFifo<bool>     m_xram_rsp_to_init_cmd_inst_fifo;       // fifo for the L1 type
665      GenericFifo<size_t>   m_xram_rsp_to_init_cmd_srcid_fifo;      // fifo for srcids
666
667      // Buffer between XRAM_RSP fsm and IXR_CMD fsm (XRAM write)
668      sc_signal<bool>      r_xram_rsp_to_ixr_cmd_req;   // Valid request
669      sc_signal<addr_t>    r_xram_rsp_to_ixr_cmd_nline; // cache line index
670      sc_signal<data_t>   *r_xram_rsp_to_ixr_cmd_data;  // cache line data
671      sc_signal<size_t>    r_xram_rsp_to_ixr_cmd_trdid; // index in transaction table
672
673      ////////////////////////////////////////////////////
674      // Registers controlled by the IXR_CMD fsm
675      ////////////////////////////////////////////////////
676
677      sc_signal<int>       r_ixr_cmd_fsm;
678      sc_signal<size_t>    r_ixr_cmd_cpt;
679
680      ////////////////////////////////////////////////////
681      // Registers controlled by TGT_RSP fsm
682      ////////////////////////////////////////////////////
683
684      sc_signal<int>       r_tgt_rsp_fsm;
685      sc_signal<size_t>    r_tgt_rsp_cpt;
686
687      ////////////////////////////////////////////////////
688      // Registers controlled by INIT_CMD fsm
689      ////////////////////////////////////////////////////
690
691      sc_signal<int>      r_init_cmd_fsm;
692      sc_signal<size_t>   r_init_cmd_cpt;
693      sc_signal<bool>     r_init_cmd_inst;
694
695      ////////////////////////////////////////////////////
696      // Registers controlled by ALLOC_DIR fsm
697      ////////////////////////////////////////////////////
698
699      sc_signal<int>            r_alloc_dir_fsm;
700
701      ////////////////////////////////////////////////////
702      // Registers controlled by ALLOC_TRT fsm
703      ////////////////////////////////////////////////////
704
705      sc_signal<int>            r_alloc_trt_fsm;
706
707      ////////////////////////////////////////////////////
708      // Registers controlled by ALLOC_UPT fsm
709      ////////////////////////////////////////////////////
710
711      sc_signal<int>            r_alloc_upt_fsm;
712
713      ////////////////////////////////////////////////////
714      // Registers controlled by ALLOC_HEAP fsm
715      ////////////////////////////////////////////////////
716
717      sc_signal<int>            r_alloc_heap_fsm;
718
719    }; // end class VciMemCacheV3
720
721}}
722
723#endif
724
725// Local Variables:
726// tab-width: 4
727// c-basic-offset: 4
728// c-file-offsets:((innamespace . 0)(inline-open . 0))
729// indent-tabs-mode: nil
730// End:
731
732// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
733
Note: See TracBrowser for help on using the repository browser.