source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Load_store_unit.h @ 136

Last change on this file since 136 was 136, checked in by rosiere, 15 years ago

1) Add new algo in ifetch queue
2) Add Cancel bit
3) new config

  • Property svn:keywords set to Id
File size: 15.0 KB
Line 
1#ifndef morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_execute_unit_execute_unit_load_store_unit_Load_store_unit_h
2#define morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_execute_unit_execute_unit_load_store_unit_Load_store_unit_h
3
4/*
5 * $Id: Load_store_unit.h 136 2009-10-20 18:52:15Z rosiere $
6 *
7 * [ Description ]
8 *
9 * Ce composant peut être amélioré en placant deux ptr de lecture au lieu d'un : un pour l'accès au cache et un pour le commit
10 */
11
12#ifdef SYSTEMC
13#include "systemc.h"
14#endif
15
16#include "Common/include/ToString.h"
17#include "Common/include/Debug.h"
18
19#include "Behavioural/Generic/Queue_Control/include/Queue_Control.h"
20
21#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Types.h"
22#include "Behavioural/Generic/Queue_Control/include/Queue_Control.h"
23#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Parameters.h"
24#ifdef STATISTICS
25#include "Behavioural/include/Stat.h"
26#endif
27#include "Behavioural/include/Component.h"
28#ifdef VHDL
29#include "Behavioural/include/Vhdl.h"
30#endif
31#include "Behavioural/include/Usage.h"
32
33#include <iostream>
34#include <fstream>
35
36namespace morpheo {
37namespace behavioural {
38namespace core {
39namespace multi_execute_loop {
40namespace execute_loop {
41namespace multi_execute_unit {
42namespace execute_unit {
43namespace load_store_unit {
44
45
46  class Load_store_unit
47#if SYSTEMC
48    : public sc_module
49#endif
50  {
51    // -----[ fields ]----------------------------------------------------
52    // Parameters
53  protected : const std::string  _name;
54  protected : const Parameters * _param;
55  private   : const Tusage_t     _usage;
56
57#ifdef STATISTICS
58  public    : Stat                           * _stat;
59
60  private   : counter_t                      * _stat_use_store_queue;
61  private   : counter_t                      * _stat_use_load_queue;
62  private   : counter_t                      * _stat_use_speculative_access_queue;
63
64  private   : counter_t                      * _stat_average_use_store_queue;
65  private   : counter_t                      * _stat_average_use_load_queue;
66  private   : counter_t                      * _stat_average_use_speculative_access_queue;
67
68  private   : counter_t                      * _stat_percent_use_store_queue;
69  private   : counter_t                      * _stat_percent_use_load_queue;
70  private   : counter_t                      * _stat_percent_use_speculative_access_queue;
71
72  private   : counter_t                      * _stat_nb_inst_load;
73  private   : counter_t                      * _stat_nb_inst_load_commit_speculative;
74  private   : counter_t                      * _stat_nb_inst_load_commit_miss;
75
76//   private   : counter_t                      * _stat_nb_load_miss_speculation;
77//   private   : counter_t                      * _stat_nb_head_ko;
78
79//   private   : counter_t                      * _stat_nb_inst_load;
80//   private   : counter_t                      * _stat_nb_inst_store;
81//   private   : counter_t                      * _stat_nb_inst_lock;
82//   private   : counter_t                      * _stat_nb_inst_prefetch;
83//   private   : counter_t                      * _stat_nb_inst_invalid;
84//   private   : counter_t                      * _stat_nb_inst_flush;
85//   private   : counter_t                      * _stat_nb_inst_sync;
86#endif
87
88  public    : Component                      * _component;
89  private   : Interfaces                     * _interfaces;
90
91#ifdef SYSTEMC
92    // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93    // Interface
94  public    : SC_CLOCK                      *  in_CLOCK        ;
95  public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
96
97    // ~~~~~[ Interface "memory_in" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98  public    : SC_IN (Tcontrol_t        )   **  in_MEMORY_IN_VAL                  ;//[nb_inst_memory]
99  public    : SC_OUT(Tcontrol_t        )   ** out_MEMORY_IN_ACK                  ;//[nb_inst_memory]
100  public    : SC_IN (Tcontext_t        )   **  in_MEMORY_IN_CONTEXT_ID           ;//[nb_inst_memory]
101  public    : SC_IN (Tcontext_t        )   **  in_MEMORY_IN_FRONT_END_ID         ;//[nb_inst_memory]
102  public    : SC_IN (Tcontext_t        )   **  in_MEMORY_IN_OOO_ENGINE_ID        ;//[nb_inst_memory]
103  public    : SC_IN (Tpacket_t         )   **  in_MEMORY_IN_PACKET_ID            ;//[nb_inst_memory]
104  public    : SC_IN (Toperation_t      )   **  in_MEMORY_IN_OPERATION            ;//[nb_inst_memory]
105  public    : SC_IN (Ttype_t           )   **  in_MEMORY_IN_TYPE                 ;//[nb_inst_memory]
106  public    : SC_IN (Tcontrol_t        )   **  in_MEMORY_IN_CANCEL               ;//[nb_inst_memory]
107  public    : SC_IN (Tlsq_ptr_t        )   **  in_MEMORY_IN_STORE_QUEUE_PTR_WRITE;//[nb_inst_memory]
108  public    : SC_IN (Tlsq_ptr_t        )   **  in_MEMORY_IN_STORE_QUEUE_PTR_READ ;//[nb_inst_memory]
109  public    : SC_IN (Tcontrol_t        )   **  in_MEMORY_IN_STORE_QUEUE_EMPTY    ;//[nb_inst_memory]
110  public    : SC_IN (Tlsq_ptr_t        )   **  in_MEMORY_IN_LOAD_QUEUE_PTR_WRITE ;//[nb_inst_memory]
111  public    : SC_IN (Tcontrol_t        )   **  in_MEMORY_IN_HAS_IMMEDIAT         ;//[nb_inst_memory]
112  public    : SC_IN (Tgeneral_data_t   )   **  in_MEMORY_IN_IMMEDIAT             ;//[nb_inst_memory] // memory address
113  public    : SC_IN (Tgeneral_data_t   )   **  in_MEMORY_IN_DATA_RA              ;//[nb_inst_memory] // memory address
114  public    : SC_IN (Tgeneral_data_t   )   **  in_MEMORY_IN_DATA_RB              ;//[nb_inst_memory] // data        (store)
115  public    : SC_IN (Tspecial_data_t   )   **  in_MEMORY_IN_DATA_RC              ;//[nb_inst_memory]
116  public    : SC_IN (Tcontrol_t        )   **  in_MEMORY_IN_WRITE_RD             ;//[nb_inst_memory] // = (operation==load)
117  public    : SC_IN (Tgeneral_address_t)   **  in_MEMORY_IN_NUM_REG_RD           ;//[nb_inst_memory] // destination (load)
118  public    : SC_IN (Tcontrol_t        )   **  in_MEMORY_IN_WRITE_RE             ;//[nb_inst_memory]
119  public    : SC_IN (Tspecial_address_t)   **  in_MEMORY_IN_NUM_REG_RE           ;//[nb_inst_memory]
120
121    // ~~~~~[ Interface "memory_out" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122  public    : SC_OUT(Tcontrol_t        )   ** out_MEMORY_OUT_VAL                 ;//[nb_inst_memory]
123  public    : SC_IN (Tcontrol_t        )   **  in_MEMORY_OUT_ACK                 ;//[nb_inst_memory]
124  public    : SC_OUT(Tcontext_t        )   ** out_MEMORY_OUT_CONTEXT_ID          ;//[nb_inst_memory]
125  public    : SC_OUT(Tcontext_t        )   ** out_MEMORY_OUT_FRONT_END_ID        ;//[nb_inst_memory]
126  public    : SC_OUT(Tcontext_t        )   ** out_MEMORY_OUT_OOO_ENGINE_ID       ;//[nb_inst_memory]
127  public    : SC_OUT(Tpacket_t         )   ** out_MEMORY_OUT_PACKET_ID           ;//[nb_inst_memory]
128//public    : SC_OUT(Toperation_t      )   ** out_MEMORY_OUT_OPERATION           ;//[nb_inst_memory]
129//public    : SC_OUT(Ttype_t           )   ** out_MEMORY_OUT_TYPE                ;//[nb_inst_memory]
130  public    : SC_OUT(Tcontrol_t        )   ** out_MEMORY_OUT_CANCEL              ;//[nb_inst_memory]
131  public    : SC_OUT(Tcontrol_t        )   ** out_MEMORY_OUT_WRITE_RD            ;//[nb_inst_memory] // = (operation==load)
132  public    : SC_OUT(Tgeneral_address_t)   ** out_MEMORY_OUT_NUM_REG_RD          ;//[nb_inst_memory] // destination (load)
133  public    : SC_OUT(Tgeneral_data_t   )   ** out_MEMORY_OUT_DATA_RD             ;//[nb_inst_memory] // data        (load)
134  public    : SC_OUT(Tcontrol_t        )   ** out_MEMORY_OUT_WRITE_RE            ;//[nb_inst_memory]
135  public    : SC_OUT(Tspecial_address_t)   ** out_MEMORY_OUT_NUM_REG_RE          ;//[nb_inst_memory]
136  public    : SC_OUT(Tspecial_data_t   )   ** out_MEMORY_OUT_DATA_RE             ;//[nb_inst_memory]
137  public    : SC_OUT(Texception_t      )   ** out_MEMORY_OUT_EXCEPTION           ;//[nb_inst_memory]
138  public    : SC_OUT(Tcontrol_t        )   ** out_MEMORY_OUT_NO_SEQUENCE         ;//[nb_inst_memory]
139  public    : SC_OUT(Taddress_t        )   ** out_MEMORY_OUT_ADDRESS             ;//[nb_inst_memory]
140   
141    // ~~~~~[ Interface "dcache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142  public    : SC_OUT(Tcontrol_t        )   ** out_DCACHE_REQ_VAL                 ;//[nb_cache_port]
143  public    : SC_IN (Tcontrol_t        )   **  in_DCACHE_REQ_ACK                 ;//[nb_cache_port]
144  public    : SC_OUT(Tcontext_t        )   ** out_DCACHE_REQ_CONTEXT_ID          ;//[nb_cache_port]
145  public    : SC_OUT(Tpacket_t         )   ** out_DCACHE_REQ_PACKET_ID           ;//[nb_cache_port]
146  public    : SC_OUT(Tdcache_address_t )   ** out_DCACHE_REQ_ADDRESS             ;//[nb_cache_port]
147  public    : SC_OUT(Tdcache_type_t    )   ** out_DCACHE_REQ_TYPE                ;//[nb_cache_port]
148  public    : SC_OUT(Tdcache_data_t    )   ** out_DCACHE_REQ_WDATA               ;//[nb_cache_port]
149
150    // ~~~~~[ Interface "dcache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151  public    : SC_IN (Tcontrol_t        )   **  in_DCACHE_RSP_VAL                 ;//[nb_cache_port]
152  public    : SC_OUT(Tcontrol_t        )   ** out_DCACHE_RSP_ACK                 ;//[nb_cache_port]
153  public    : SC_IN (Tcontext_t        )   **  in_DCACHE_RSP_CONTEXT_ID          ;//[nb_cache_port]
154  public    : SC_IN (Tpacket_t         )   **  in_DCACHE_RSP_PACKET_ID           ;//[nb_cache_port]
155  public    : SC_IN (Tdcache_data_t    )   **  in_DCACHE_RSP_RDATA               ;//[nb_cache_port]
156  public    : SC_IN (Tdcache_error_t   )   **  in_DCACHE_RSP_ERROR               ;//[nb_cache_port]
157
158    // ~~~~~[ Interface "bypass_memory" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159  public    : SC_OUT(Tcontrol_t        )   ** out_BYPASS_MEMORY_VAL          ; //[nb_bypass_memory]
160  public    : SC_OUT(Tcontext_t        )   ** out_BYPASS_MEMORY_OOO_ENGINE_ID; //[nb_bypass_memory]
161  public    : SC_OUT(Tgeneral_address_t)   ** out_BYPASS_MEMORY_NUM_REG      ; //[nb_bypass_memory]
162  public    : SC_OUT(Tgeneral_data_t   )   ** out_BYPASS_MEMORY_DATA         ; //[nb_bypass_memory]
163
164    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
165  protected : Tstore_queue_entry_t                                        * _store_queue                     ;//[size_store_queue]
166  protected : Tload_queue_entry_t                                         * _load_queue                      ;//[size_load_queue]
167  protected : Tspeculative_access_queue_entry_t                           * _speculative_access_queue        ;//[size_speculative_access_queue]
168  protected : morpheo::behavioural::generic::queue_control::Queue_Control * _speculative_access_queue_control;
169
170    // function pointer
171  public    : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_transition     ) (void);
172  public    : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMoore       ) (void);
173  public    : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMealy_dcache) (void);
174  public    : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMealy_insert) (void);
175  public    : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMealy_retire) (void);
176
177    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
178
179    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180
181    // Registers
182  public    : Tlsq_ptr_t                    * reg_STORE_QUEUE_NB_CHECK     ;//[size_store_queue]
183  public    : Tlsq_ptr_t                      reg_STORE_QUEUE_PTR_READ     ;
184//public    : Tlsq_ptr_t                      reg_LOAD_QUEUE_PTR_READ      ;
185  public    : Tlsq_ptr_t                      reg_LOAD_QUEUE_CHECK_PRIORITY;
186
187    // signal
188  public    : Tlsq_ptr_t                      internal_SPECULATIVE_ACCESS_QUEUE_PTR_READ ;
189                                             
190  private   : Tcontrol_t                      internal_MEMORY_IN_ACK          ;
191  private   : uint32_t                        internal_MEMORY_IN_PORT         ;
192
193  private   : Tcontrol_t                      internal_MEMORY_OUT_VAL         ;
194  private   : Tselect_queue_t                 internal_MEMORY_OUT_SELECT_QUEUE;
195  private   : Tlsq_ptr_t                      internal_MEMORY_OUT_PTR         ;
196                                             
197  private   : Tcontrol_t                      internal_DCACHE_RSP_ACK         ;
198  private   : Tcontrol_t                      internal_DCACHE_REQ_VAL         ;
199  private   : Tselect_queue_t                 internal_DCACHE_REQ_SELECT_QUEUE;
200
201#if defined(DEBUG) and defined(DEBUG_Load_store_unit) and (DEBUG_Load_store_unit == true)
202  private   : std::ofstream                 * memory_log_file;
203#endif
204
205#endif
206
207
208    // -----[ methods ]---------------------------------------------------
209
210#ifdef SYSTEMC
211    SC_HAS_PROCESS (Load_store_unit);
212#endif
213  public  :          Load_store_unit             
214  (
215#ifdef SYSTEMC
216   sc_module_name                                name,
217#else                                         
218   std::string                                   name,
219#endif                                         
220#ifdef STATISTICS
221   morpheo::behavioural::Parameters_Statistics * param_statistics,
222#endif
223   Parameters                                  * param,
224   morpheo::behavioural::Tusage_t                usage );
225  public  :          ~Load_store_unit             (void);
226                                               
227#ifdef SYSTEMC                                 
228  private : void     allocation                (void);
229  private : void     deallocation              (void);
230
231  public  : void     constant                  (void);
232  public  : void     transition                (void);
233  public  : void     genMoore                  (void);
234  public  : void     genMealy_dcache           (void);
235  public  : void     genMealy_insert           (void);
236  public  : void     genMealy_retire           (void);
237   
238  public  : void     function_speculative_load_commit_transition      (void);
239  public  : void     function_speculative_load_commit_genMoore        (void);
240  public  : void     function_speculative_load_commit_genMealy_dcache (void);
241  public  : void     function_speculative_load_commit_genMealy_insert (void);
242  public  : void     function_speculative_load_commit_genMealy_retire (void);
243#endif                                         
244
245#ifdef STATISTICS
246  public  : void     statistics_allocation     (morpheo::behavioural::Parameters_Statistics * param_statistics);
247  public  : void     statistics_deallocation   (void);
248#endif
249                                               
250#if VHDL                                       
251  public  : void     vhdl                      (void);
252  private : void     vhdl_declaration          (Vhdl * & vhdl);
253  private : void     vhdl_body                 (Vhdl * & vhdl);
254#endif                                         
255                                               
256#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
257  private : void     end_cycle                 (void);
258#endif
259  };
260
261}; // end namespace load_store_unit
262}; // end namespace execute_unit
263}; // end namespace multi_execute_unit
264}; // end namespace execute_loop
265}; // end namespace multi_execute_loop
266}; // end namespace core
267
268}; // end namespace behavioural
269}; // end namespace morpheo             
270
271#endif
Note: See TracBrowser for help on using the repository browser.