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 @ 75

Last change on this file since 75 was 75, checked in by rosiere, 16 years ago

Update all component (except front_end) to :

  • new statistics model
  • no namespace std
File size: 11.9 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$
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 <iostream>
17#include "Common/include/ToString.h"
18#include "Common/include/Debug.h"
19
20#include "Behavioural/Generic/Queue_Control/include/Queue_Control.h"
21
22#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Types.h"
23#include "Behavioural/Generic/Queue_Control/include/Queue_Control.h"
24#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Parameters.h"
25#ifdef STATISTICS
26#include "Behavioural/include/Stat.h"
27#endif
28#include "Behavioural/include/Component.h"
29#ifdef VHDL
30#include "Behavioural/include/Vhdl.h"
31#endif
32
33namespace morpheo {
34namespace behavioural {
35namespace core {
36namespace multi_execute_loop {
37namespace execute_loop {
38namespace multi_execute_unit {
39namespace execute_unit {
40namespace load_store_unit {
41
42
43  class Load_store_unit
44#if SYSTEMC
45    : public sc_module
46#endif
47  {
48    // -----[ fields ]----------------------------------------------------
49    // Parameters
50  protected : const std::string       _name;
51
52  protected : const Parameters * _param;
53
54#ifdef STATISTICS
55  private   : Stat                           * _stat;
56
57  private   : counter_t                      * _stat_use_store_queue;
58  private   : counter_t                      * _stat_use_load_queue;
59  private   : counter_t                      * _stat_use_speculative_access_queue;
60
61  private   : counter_t                      * _stat_average_use_store_queue;
62  private   : counter_t                      * _stat_average_use_load_queue;
63  private   : counter_t                      * _stat_average_use_speculative_access_queue;
64
65  private   : counter_t                      * _stat_percent_use_store_queue;
66  private   : counter_t                      * _stat_percent_use_load_queue;
67  private   : counter_t                      * _stat_percent_use_speculative_access_queue;
68
69//   private   : counter_t                      * _stat_nb_load_miss_speculation;
70//   private   : counter_t                      * _stat_nb_head_ko;
71
72//   private   : counter_t                      * _stat_nb_inst_load;
73//   private   : counter_t                      * _stat_nb_inst_store;
74//   private   : counter_t                      * _stat_nb_inst_lock;
75//   private   : counter_t                      * _stat_nb_inst_prefetch;
76//   private   : counter_t                      * _stat_nb_inst_invalid;
77//   private   : counter_t                      * _stat_nb_inst_flush;
78//   private   : counter_t                      * _stat_nb_inst_sync;
79#endif
80
81  public    : Component                      * _component;
82  private   : Interfaces                     * _interfaces;
83
84#ifdef SYSTEMC
85    // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86    // Interface
87  public    : SC_CLOCK                      *  in_CLOCK        ;
88  public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
89
90    // ~~~~~[ Interface "memory_in" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91  public    : SC_IN (Tcontrol_t        )    *  in_MEMORY_IN_VAL         ;
92  public    : SC_OUT(Tcontrol_t        )    * out_MEMORY_IN_ACK         ;
93  public    : SC_IN (Tcontext_t        )    *  in_MEMORY_IN_CONTEXT_ID  ;
94  public    : SC_IN (Tcontext_t        )    *  in_MEMORY_IN_FRONT_END_ID;
95  public    : SC_IN (Tcontext_t        )    *  in_MEMORY_IN_OOO_ENGINE_ID;
96  public    : SC_IN (Tpacket_t         )    *  in_MEMORY_IN_PACKET_ID   ;
97  public    : SC_IN (Toperation_t      )    *  in_MEMORY_IN_OPERATION   ;
98  public    : SC_IN (Tlsq_ptr_t        )    *  in_MEMORY_IN_STORE_QUEUE_PTR_WRITE;
99  public    : SC_IN (Tlsq_ptr_t        )    *  in_MEMORY_IN_LOAD_QUEUE_PTR_WRITE;
100//public    : SC_IN (Tcontrol_t        )    *  in_MEMORY_IN_HAS_IMMEDIAT;
101  public    : SC_IN (Tgeneral_data_t   )    *  in_MEMORY_IN_IMMEDIAT    ; // memory address
102  public    : SC_IN (Tgeneral_data_t   )    *  in_MEMORY_IN_DATA_RA     ; // memory address
103  public    : SC_IN (Tgeneral_data_t   )    *  in_MEMORY_IN_DATA_RB     ; // data        (store)
104//public    : SC_IN (Tspecial_data_t   )    *  in_MEMORY_IN_DATA_RC     ;
105//public    : SC_IN (Tcontrol_t        )    *  in_MEMORY_IN_WRITE_RD    ; // = (operation==load)
106  public    : SC_IN (Tgeneral_address_t)    *  in_MEMORY_IN_NUM_REG_RD  ; // destination (load)
107//public    : SC_IN (Tcontrol_t        )    *  in_MEMORY_IN_WRITE_RE    ;
108//public    : SC_IN (Tspecial_address_t)    *  in_MEMORY_IN_NUM_REG_RE  ;
109
110    // ~~~~~[ Interface "memory_out" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111  public    : SC_OUT(Tcontrol_t        )    * out_MEMORY_OUT_VAL       ;
112  public    : SC_IN (Tcontrol_t        )    *  in_MEMORY_OUT_ACK       ;
113  public    : SC_OUT(Tcontext_t        )    * out_MEMORY_OUT_CONTEXT_ID;
114  public    : SC_OUT(Tcontext_t        )    * out_MEMORY_OUT_FRONT_END_ID;
115  public    : SC_OUT(Tcontext_t        )    * out_MEMORY_OUT_OOO_ENGINE_ID;
116  public    : SC_OUT(Tpacket_t         )    * out_MEMORY_OUT_PACKET_ID ;
117  public    : SC_OUT(Tcontrol_t        )    * out_MEMORY_OUT_WRITE_RD  ; // = (operation==load)
118  public    : SC_OUT(Tgeneral_address_t)    * out_MEMORY_OUT_NUM_REG_RD; // destination (load)
119  public    : SC_OUT(Tgeneral_data_t   )    * out_MEMORY_OUT_DATA_RD   ; // data        (load)
120//public    : SC_OUT(Tcontrol_t        )    * out_MEMORY_OUT_WRITE_RE  ;
121//public    : SC_OUT(Tspecial_address_t)    * out_MEMORY_OUT_NUM_REG_RE;
122//public    : SC_OUT(Tspecial_data_t   )    * out_MEMORY_OUT_DATA_RE   ;
123  public    : SC_OUT(Texception_t      )    * out_MEMORY_OUT_EXCEPTION ;
124
125    // ~~~~~[ Interface "dcache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126  public    : SC_OUT(Tcontrol_t        )    * out_DCACHE_REQ_VAL       ;
127  public    : SC_IN (Tcontrol_t        )    *  in_DCACHE_REQ_ACK       ;
128  public    : SC_OUT(Tcontext_t        )    * out_DCACHE_REQ_CONTEXT_ID;
129  public    : SC_OUT(Tpacket_t         )    * out_DCACHE_REQ_PACKET_ID ;
130  public    : SC_OUT(Tdcache_address_t )    * out_DCACHE_REQ_ADDRESS   ;
131  public    : SC_OUT(Tdcache_type_t    )    * out_DCACHE_REQ_TYPE      ;
132  public    : SC_OUT(Tdcache_data_t    )    * out_DCACHE_REQ_WDATA     ;
133
134    // ~~~~~[ Interface "dcache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135  public    : SC_IN (Tcontrol_t        )    *  in_DCACHE_RSP_VAL       ;
136  public    : SC_OUT(Tcontrol_t        )    * out_DCACHE_RSP_ACK       ;
137  public    : SC_IN (Tcontext_t        )    *  in_DCACHE_RSP_CONTEXT_ID;
138  public    : SC_IN (Tpacket_t         )    *  in_DCACHE_RSP_PACKET_ID ;
139  public    : SC_IN (Tdcache_data_t    )    *  in_DCACHE_RSP_RDATA     ;
140  public    : SC_IN (Tdcache_error_t   )    *  in_DCACHE_RSP_ERROR     ;
141
142    // ~~~~~[ Interface "bypass_memory" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143  public    : SC_OUT(Tcontrol_t        )   ** out_BYPASS_MEMORY_VAL       ;
144  public    : SC_OUT(Tcontext_t        )   ** out_BYPASS_MEMORY_OOO_ENGINE_ID;
145  public    : SC_OUT(Tgeneral_address_t)   ** out_BYPASS_MEMORY_NUM_REG   ;
146  public    : SC_OUT(Tgeneral_data_t   )   ** out_BYPASS_MEMORY_DATA      ;
147
148    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
149  protected : Tstore_queue_entry_t                                        * _store_queue;
150  protected : Tload_queue_entry_t                                         * _load_queue;
151  protected : Tspeculative_access_queue_entry_t                           * _speculative_access_queue;
152  protected : morpheo::behavioural::generic::queue_control::Queue_Control * _speculative_access_queue_control;
153
154    // function pointer
155  public    : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_transition     ) (void);
156  public    : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMoore       ) (void);
157  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);
158  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);
159  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);
160
161    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
162
163    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164
165    // Registers
166  public    : Tlsq_ptr_t                      reg_STORE_QUEUE_PTR_READ;
167//public    : Tlsq_ptr_t                      reg_LOAD_QUEUE_PTR_READ ;
168  public    : Tlsq_ptr_t                      reg_LOAD_QUEUE_CHECK_PRIORITY ;
169
170    // signal
171  public    : Tlsq_ptr_t                      internal_SPECULATIVE_ACCESS_QUEUE_PTR_READ ;
172
173  private   : Tcontrol_t                      internal_MEMORY_IN_ACK;
174  private   : Tcontrol_t                      internal_MEMORY_OUT_VAL;
175  private   : Tselect_queue_t                 internal_MEMORY_OUT_SELECT_QUEUE;
176  public    : Tlsq_ptr_t                      internal_MEMORY_OUT_PTR;
177
178  private   : Tcontrol_t                      internal_DCACHE_RSP_ACK;
179  private   : Tcontrol_t                      internal_DCACHE_REQ_VAL;
180  private   : Tselect_queue_t                 internal_DCACHE_REQ_SELECT_QUEUE;
181#endif
182
183    // -----[ methods ]---------------------------------------------------
184
185#ifdef SYSTEMC
186    SC_HAS_PROCESS (Load_store_unit);
187#endif
188  public  :          Load_store_unit             
189  (
190#ifdef SYSTEMC
191   sc_module_name                                name,
192#else                                         
193   std::string                                   name,
194#endif                                         
195#ifdef STATISTICS
196   morpheo::behavioural::Parameters_Statistics * param_statistics,
197#endif
198   Parameters                                  * param );
199  public  :          ~Load_store_unit             (void);
200                                               
201#ifdef SYSTEMC                                 
202  private : void     allocation                (void);
203  private : void     deallocation              (void);
204
205  public  : void     transition                (void);
206  public  : void     genMoore                  (void);
207  public  : void     genMealy_dcache           (void);
208  public  : void     genMealy_insert           (void);
209  public  : void     genMealy_retire           (void);
210   
211  public  : void     function_speculative_load_commit_transition      (void);
212  public  : void     function_speculative_load_commit_genMoore        (void);
213  public  : void     function_speculative_load_commit_genMealy_dcache (void);
214  public  : void     function_speculative_load_commit_genMealy_insert (void);
215  public  : void     function_speculative_load_commit_genMealy_retire (void);
216#endif                                         
217
218#ifdef STATISTICS
219  public  : void     statistics_declaration    (morpheo::behavioural::Parameters_Statistics * param_statistics);
220#endif
221                                               
222#if VHDL                                       
223  public  : void     vhdl                      (void);
224  private : void     vhdl_declaration          (Vhdl * & vhdl);
225  private : void     vhdl_body                 (Vhdl * & vhdl);
226#endif                                         
227                                               
228#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
229  private : void     end_cycle                 (void);
230#endif
231  };
232
233}; // end namespace load_store_unit
234}; // end namespace execute_unit
235}; // end namespace multi_execute_unit
236}; // end namespace execute_loop
237}; // end namespace multi_execute_loop
238}; // end namespace core
239
240}; // end namespace behavioural
241}; // end namespace morpheo             
242
243#endif
Note: See TracBrowser for help on using the repository browser.