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

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

1) Prediction unit : static prediction not blocking

  • Property svn:keywords set to Id
File size: 16.5 KB
Line 
1#ifndef morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_execute_unit_execute_unit_load_store_unit_Types_h
2#define morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_execute_unit_execute_unit_load_store_unit_Types_h
3
4/*
5 * $Id: Types.h 119 2009-05-25 17:40:26Z rosiere $
6 *
7 * [ Description ]
8 *
9 */
10
11#include "Behavioural/include/Types.h"
12#include "Common/include/ToString.h"
13#include "Common/include/FromString.h"
14#include "Common/include/ErrorMorpheo.h"
15#include <ostream>
16
17namespace morpheo {
18namespace behavioural {
19namespace core {
20namespace multi_execute_loop {
21namespace execute_loop {
22namespace multi_execute_unit {
23namespace execute_unit {
24namespace load_store_unit {
25
26#define DCACHE_REQ_IS_LOAD(x)   (x<<1)
27#define DCACHE_REQ_IS_STORE(x) ((x<<1)|1)
28
29#define DCACHE_RSP_IS_LOAD(x)  ((x&1)==0)
30#define DCACHE_RSP_IS_STORE(x) ((x&1)==1)
31
32
33  typedef enum 
34    {
35       NO_SPECULATIVE_LOAD     //each load wait all previous store before the data cache access
36      ,SPECULATIVE_LOAD_ACCESS //each load wait all previous store before the commiting
37      ,SPECULATIVE_LOAD_COMMIT //each load commit the result before the end of dependence's check
38    //,SPECULATIVE_LOAD_BYPASS //each load bypass the result before the end of dependence's check
39    } Tspeculative_load_t; 
40 
41  typedef enum
42    {
43      SELECT_STORE_QUEUE,
44      SELECT_LOAD_QUEUE ,
45      SELECT_LOAD_QUEUE_SPECULATIVE
46    } Tselect_queue_t;
47 
48  // ----------------------------------------------------------
49  // Store Queue
50  // ----------------------------------------------------------
51
52  typedef enum
53    {
54      STORE_QUEUE_EMPTY                   //entry is empty
55      ,STORE_QUEUE_NO_VALID_NO_SPECULATIVE //entry is the top of rob, and operation isn't arrive
56      ,STORE_QUEUE_VALID_SPECULATIVE       //entry is arrive and wait the top of rob
57      ,STORE_QUEUE_VALID_NO_SPECULATIVE    //entry is ok, can be access at a dcache port.
58      ,STORE_QUEUE_COMMIT                  //entry have access at dcache
59    } Tstore_queue_state_t;
60
61  class Tstore_queue_entry_t
62  {
63  public    : Tstore_queue_state_t _state               ;
64  public    : Tcontext_t           _context_id          ;
65  public    : Tcontext_t           _front_end_id        ;
66  public    : Tcontext_t           _ooo_engine_id       ;
67  public    : Tpacket_t            _packet_id           ;
68  public    : Toperation_t         _operation           ;
69  public    : Tlsq_ptr_t           _load_queue_ptr_write;
70  public    : Tdcache_address_t    _address             ;
71  public    : Tgeneral_data_t      _wdata               ;
72//public    : Tcontrol_t           _write_rd            ;
73//public    : Tgeneral_address_t   _num_reg_rd          ;
74  public    : Texception_t         _exception           ;
75
76    friend std::ostream & operator << (std::ostream& os, const Tstore_queue_entry_t & x) 
77    {
78      return os << " * state                               : " << x._state << std::endl
79                << "   * packet                            : " << toString(x._packet_id) << std::endl
80                << "   * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl
81                << "   * operation                         : " << toString(x._operation) << std::endl
82                << "   * load_ptr                          : " << toString(x._load_queue_ptr_write) << std::endl
83                << "   * exception                         : " << toString(x._exception) << std::endl
84                << std::hex
85                << "   * address                           : " << toString(x._address)<< std::endl
86                << "   * wdata                             : " << toString(x._wdata) << std::endl
87                << std::dec;
88    }
89  };
90 
91 
92
93  // ----------------------------------------------------------
94  // Speculative_Access  Queue
95  // ----------------------------------------------------------
96
97  typedef enum
98    {
99      SPECULATIVE_ACCESS_QUEUE_EMPTY            //entry is empty
100      ,SPECULATIVE_ACCESS_QUEUE_WAIT_CACHE      //entry is valid and can access at the dcache
101      ,SPECULATIVE_ACCESS_QUEUE_WAIT_LOAD_QUEUE //entry wait an empty slot in load queue
102    } Tspeculative_access_queue_state_t;
103
104  class Tspeculative_access_queue_entry_t
105  {
106  public    : Tspeculative_access_queue_state_t  _state                ;
107  public    : Tcontext_t                         _context_id           ;
108  public    : Tcontext_t                         _front_end_id         ;
109  public    : Tcontext_t                         _ooo_engine_id        ;
110  public    : Tpacket_t                          _packet_id            ;
111  public    : Toperation_t                       _operation            ;
112  public    : Tlsq_ptr_t                         _load_queue_ptr_write ;
113  public    : Tlsq_ptr_t                         _store_queue_ptr_write;
114  public    : Tdcache_address_t                  _address              ;
115  public    : Tcontrol_t                         _write_rd             ;
116  public    : Tgeneral_address_t                 _num_reg_rd           ;
117  public    : Texception_t                       _exception            ;
118
119    friend std::ostream & operator << (std::ostream& os, const Tspeculative_access_queue_entry_t & x)
120    {
121      return os << " * state                               : " << x._state << std::endl
122                << "   * packet                            : " << toString(x._packet_id) << std::endl
123                << "   * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl
124                << "   * operation                         : " << toString(x._operation) << std::endl
125                << "   * load, store ptr_write             : " << toString(x._load_queue_ptr_write) << " - " << toString(x._store_queue_ptr_write) << std::endl
126                << "   * exception                         : " << toString(x._exception) << std::endl
127                << std::hex
128                << "   * address                           : " << toString(x._address)<< std::endl
129                << std::dec
130                << "   * write_rd, num_reg_rd              : " << toString(x._write_rd) << " - " << toString(x._num_reg_rd)<< std::endl;
131    }
132  };
133
134  // ----------------------------------------------------------
135  // Load  Queue
136  // ----------------------------------------------------------
137
138  //                                   HAVE_DCACHE_RSP MUST_CHECK DECOD_BARRIER
139  // OPERATION_MEMORY_LOAD             X               X          -
140  // OPERATION_MEMORY_LOCK             -               -          -
141  // OPERATION_MEMORY_INVALIDATE       -               -          X (mtspr)
142  // OPERATION_MEMORY_PREFETCH         -               -          -
143  // OPERATION_MEMORY_FLUSH            -               -          X (mtspr)
144  // OPERATION_MEMORY_SYNCHRONIZATION  X               -          X (msync, psync, csync)
145 
146#define have_dcache_rsp(x) (is_operation_memory_load(x) or (x==OPERATION_MEMORY_SYNCHRONIZATION))
147#define must_check(x)      (is_operation_memory_load(x))
148
149  typedef enum
150    {
151      LOAD_QUEUE_EMPTY         //entry is empty
152      ,LOAD_QUEUE_WAIT_CHECK   //entry must wait the respons and check dependence with store
153      ,LOAD_QUEUE_WAIT         //entry must wait the respons
154      ,LOAD_QUEUE_COMMIT_CHECK //entry must check dependence and can commit speculative
155      ,LOAD_QUEUE_CHECK        //entry must check dependence with store
156      ,LOAD_QUEUE_COMMIT       //entry must commit the instruction
157    } Tload_queue_state_t;
158
159  class Tload_queue_entry_t
160  {
161  public    : Tload_queue_state_t  _state            ;
162  public    : Tcontext_t           _context_id       ;
163  public    : Tcontext_t           _front_end_id     ;
164  public    : Tcontext_t           _ooo_engine_id    ;
165  public    : Tpacket_t            _packet_id        ;
166  public    : Toperation_t         _operation        ;
167  public    : Tlsq_ptr_t           _store_queue_ptr_write;
168  public    : Tdcache_address_t    _address          ;
169  public    : Tdcache_address_t    _check_hit_byte   ; 
170  public    : Tcontrol_t           _check_hit        ;
171  public    : Tdcache_address_t    _shift            ;
172  public    : Tcontrol_t           _is_load_signed   ;
173  public    : Taccess_t            _access_size      ;
174  public    : Tgeneral_data_t      _rdata            ;
175  public    : Tcontrol_t           _write_rd         ;
176  public    : Tgeneral_address_t   _num_reg_rd       ;
177  public    : Texception_t         _exception        ;
178
179    friend std::ostream & operator << (std::ostream& os, const Tload_queue_entry_t & x)
180    {
181      return os << " * state                               : " << x._state << std::endl
182                << "   * packet                            : " << toString(x._packet_id) << std::endl
183                << "   * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl
184                << "   * operation                         : " << toString(x._operation) << std::endl
185                << "   * store_queue_ptr_write             : " << toString(x._store_queue_ptr_write) << std::endl
186                << "   * exception                         : " << toString(x._exception) << std::endl
187                << "   * check_hit, check_hit_byte         : " << toString(x._check_hit) << " - " << toString(x._check_hit_byte) << std::endl
188                << std::hex
189                << "   * address                           : " << toString(x._address)<< std::endl
190                << "   * rdata                             : " << toString(x._rdata) << std::endl
191                << std::dec
192                << "   * write_rd, num_reg_rd              : " << toString(x._write_rd) << " - " << toString(x._num_reg_rd)<< std::endl;
193    }
194
195  };
196
197}; // end namespace load_store_unit
198}; // end namespace execute_unit
199}; // end namespace multi_execute_unit
200}; // end namespace execute_loop
201}; // end namespace multi_execute_loop
202}; // end namespace core
203}; // end namespace behavioural
204
205  template<> inline std::string toString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_load_t>(const morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_load_t& x)
206  {
207    switch (x)
208      {
209      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::NO_SPECULATIVE_LOAD     : return "no_speculative_load"    ; break;
210      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_ACCESS : return "speculative_load_access"; break;
211      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_COMMIT : return "speculative_load_commit"; break;
212//       case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_BYPASS : return "speculative_load_bypass"; break;
213      default    : return ""      ; break;
214      }
215  };
216
217  template<> inline morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_load_t fromString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_load_t>(const std::string& x)
218  {
219    if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::NO_SPECULATIVE_LOAD    ))) == 0) or
220         (x.compare("no_speculative_load")     == 0))
221      return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::NO_SPECULATIVE_LOAD;
222    if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_ACCESS))) == 0) or
223         (x.compare("speculative_load_access") == 0))
224      return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_ACCESS;
225    if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_COMMIT))) == 0) or
226         (x.compare("speculative_load_commit") == 0))
227      return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_COMMIT;
228//     if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_BYPASS)))) or
229//          (x.compare("speculative_load_bypass") == 0))
230//       return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_BYPASS;
231   
232    throw (ErrorMorpheo ("<fromString> : Unknow string : \""+x+"\""));
233  };
234
235
236  template<> inline std::string toString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tstore_queue_state_t>(const morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tstore_queue_state_t& x)
237  {
238    switch (x)
239      {
240      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_EMPTY                   : return "empty"                  ; break;
241      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_NO_VALID_NO_SPECULATIVE : return "no_valid_no_speculative"; break;
242      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_VALID_SPECULATIVE       : return "valid_speculative"      ; break;
243      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_VALID_NO_SPECULATIVE    : return "valid_no_speculative"   ; break;
244      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_COMMIT                  : return "commit"                 ; break;
245      default    : return ""      ; break;
246      }
247  };
248
249  template<> inline std::string toString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_access_queue_state_t>(const morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_access_queue_state_t& x)
250  {
251    switch (x)
252      {
253      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_ACCESS_QUEUE_EMPTY           : return "empty"          ; break;
254      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_ACCESS_QUEUE_WAIT_CACHE      : return "wait_cache"     ; break;
255      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_ACCESS_QUEUE_WAIT_LOAD_QUEUE : return "wait_load_queue"; break;
256      default    : return ""      ; break;
257      }
258  };
259
260  template<> inline std::string toString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tload_queue_state_t>(const morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tload_queue_state_t& x)
261  {
262    switch (x)
263      {
264      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_EMPTY        : return "empty"       ; break;
265      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_WAIT_CHECK   : return "wait_check"  ; break;
266      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_WAIT         : return "wait"        ; break;
267      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_COMMIT_CHECK : return "commit_check"; break;
268      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_CHECK        : return "check"       ; break;
269      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_COMMIT       : return "commit"      ; break;
270      default    : return ""      ; break;
271      }
272  };
273
274}; // end namespace morpheo             
275
276#endif
Note: See TracBrowser for help on using the repository browser.