source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Types.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: 17.3 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 136 2009-10-20 18:52:15Z 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    : Tcontrol_t           _cancel              ;
70  public    : Tlsq_ptr_t           _load_queue_ptr_write;
71  public    : Tdcache_address_t    _address             ;
72  public    : Tgeneral_data_t      _wdata               ;
73//public    : Tcontrol_t           _write_rd            ;
74//public    : Tgeneral_address_t   _num_reg_rd          ;
75  public    : Texception_t         _exception           ;
76  public    : bool                 _send_commit         ;
77
78    friend std::ostream & operator << (std::ostream& os, const Tstore_queue_entry_t & x) 
79    {
80      return os << " * state                               : " << x._state << std::endl
81                << "   * packet                            : " << toString(x._packet_id) << std::endl
82                << "   * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl
83                << "   * operation, cancel                 : " << toString(x._operation) << " - " << toString(x._cancel) << std::endl
84                << "   * load_ptr                          : " << toString(x._load_queue_ptr_write) << std::endl
85                << "   * exception                         : " << toString(x._exception) << std::endl
86                << std::hex
87                << "   * address                           : " << toString(x._address)<< std::endl
88                << "   * wdata                             : " << toString(x._wdata) << std::endl
89                << std::dec;
90    }
91  };
92 
93 
94
95  // ----------------------------------------------------------
96  // Speculative_Access  Queue
97  // ----------------------------------------------------------
98
99  typedef enum
100    {
101      SPECULATIVE_ACCESS_QUEUE_EMPTY            //entry is empty
102      ,SPECULATIVE_ACCESS_QUEUE_WAIT_CACHE      //entry is valid and can access at the dcache
103      ,SPECULATIVE_ACCESS_QUEUE_WAIT_LOAD_QUEUE //entry wait an empty slot in load queue
104    } Tspeculative_access_queue_state_t;
105
106  class Tspeculative_access_queue_entry_t
107  {
108  public    : Tspeculative_access_queue_state_t  _state                ;
109  public    : Tcontext_t                         _context_id           ;
110  public    : Tcontext_t                         _front_end_id         ;
111  public    : Tcontext_t                         _ooo_engine_id        ;
112  public    : Tpacket_t                          _packet_id            ;
113  public    : Toperation_t                       _operation            ;
114  public    : Tcontrol_t                         _cancel               ;
115  public    : Tlsq_ptr_t                         _load_queue_ptr_write ;
116  public    : Tlsq_ptr_t                         _store_queue_ptr_write;
117  public    : Tlsq_ptr_t                         _store_queue_ptr_read ;
118  public    : Tcontrol_t                         _store_queue_empty    ;
119  public    : Tdcache_address_t                  _address              ;
120  public    : Tcontrol_t                         _write_rd             ;
121  public    : Tgeneral_address_t                 _num_reg_rd           ;
122  public    : Texception_t                       _exception            ;
123
124    friend std::ostream & operator << (std::ostream& os, const Tspeculative_access_queue_entry_t & x)
125    {
126      return os << " * state                               : " << x._state << std::endl
127                << "   * packet                            : " << toString(x._packet_id) << std::endl
128                << "   * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl
129                << "   * operation, cancel                 : " << toString(x._operation) << " - " << toString(x._cancel) << std::endl
130                << "   * load, store ptr_(write/read) empty: " << toString(x._load_queue_ptr_write) << " - " << toString(x._store_queue_ptr_write) << " - " << toString(x._store_queue_ptr_read) << " - " << toString(x._store_queue_empty) << std::endl
131                << "   * exception                         : " << toString(x._exception) << std::endl
132                << std::hex
133                << "   * address                           : " << toString(x._address)<< std::endl
134                << std::dec
135                << "   * write_rd, num_reg_rd              : " << toString(x._write_rd) << " - " << toString(x._num_reg_rd)<< std::endl;
136    }
137  };
138
139  // ----------------------------------------------------------
140  // Load  Queue
141  // ----------------------------------------------------------
142
143  //                                   HAVE_DCACHE_RSP MUST_CHECK DECOD_BARRIER
144  // OPERATION_MEMORY_LOAD             X               X          -
145  // OPERATION_MEMORY_LOCK             -               -          -
146  // OPERATION_MEMORY_INVALIDATE       -               -          X (mtspr)
147  // OPERATION_MEMORY_PREFETCH         -               -          -
148  // OPERATION_MEMORY_FLUSH            -               -          X (mtspr)
149  // OPERATION_MEMORY_SYNCHRONIZATION  X               -          X (msync, psync, csync)
150 
151#define have_dcache_rsp(x) (is_operation_memory_load(x) or (x==OPERATION_MEMORY_SYNCHRONIZATION))
152#define must_check(x)      (is_operation_memory_load(x))
153
154  typedef enum
155    {
156      LOAD_QUEUE_EMPTY         //entry is empty
157      ,LOAD_QUEUE_WAIT_CHECK   //entry must wait the respons and check dependence with store
158      ,LOAD_QUEUE_WAIT         //entry must wait the respons
159      ,LOAD_QUEUE_COMMIT_CHECK //entry must check dependence and can commit speculative
160      ,LOAD_QUEUE_CHECK        //entry must check dependence with store
161      ,LOAD_QUEUE_COMMIT       //entry must commit the instruction
162    } Tload_queue_state_t;
163
164  class Tload_queue_entry_t
165  {
166  public    : Tload_queue_state_t  _state            ;
167  public    : Tcontext_t           _context_id       ;
168  public    : Tcontext_t           _front_end_id     ;
169  public    : Tcontext_t           _ooo_engine_id    ;
170  public    : Tpacket_t            _packet_id        ;
171  public    : Toperation_t         _operation        ;
172  public    : Tcontrol_t           _cancel           ;
173  public    : Tlsq_ptr_t           _store_queue_ptr_write;
174  public    : Tlsq_ptr_t           _store_queue_ptr_read ;
175  public    : Tcontrol_t           _store_queue_empty    ;
176  public    : Tdcache_address_t    _address          ;
177  public    : Tdcache_address_t    _check_hit_byte   ; 
178  public    : Tcontrol_t           _check_hit        ;
179  public    : Tdcache_address_t    _shift            ;
180  public    : Tcontrol_t           _is_load_signed   ;
181  public    : Taccess_t            _access_size      ;
182  public    : Tgeneral_data_t      _rdata            ;
183  public    : Tcontrol_t           _write_rd         ;
184  public    : Tgeneral_address_t   _num_reg_rd       ;
185  public    : Texception_t         _exception        ;
186
187    friend std::ostream & operator << (std::ostream& os, const Tload_queue_entry_t & x)
188    {
189      return os << " * state                               : " << x._state << std::endl
190                << "   * packet                            : " << toString(x._packet_id) << std::endl
191                << "   * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl
192                << "   * operation, cancel                 : " << toString(x._operation) << " - " << toString(x._cancel) << std::endl
193                << "   * store_queue ptr_(write,read) empty: " << toString(x._store_queue_ptr_write) << " - " << toString(x._store_queue_ptr_read) << " - " << toString(x._store_queue_empty) <<std::endl
194                << "   * exception                         : " << toString(x._exception) << std::endl
195                << "   * check_hit, check_hit_byte         : " << toString(x._check_hit) << " - " << toString(x._check_hit_byte) << std::endl
196                << std::hex
197                << "   * address                           : " << toString(x._address)<< std::endl
198                << "   * rdata                             : " << toString(x._rdata) << std::endl
199                << std::dec
200                << "   * write_rd, num_reg_rd              : " << toString(x._write_rd) << " - " << toString(x._num_reg_rd)<< std::endl;
201    }
202
203  };
204
205}; // end namespace load_store_unit
206}; // end namespace execute_unit
207}; // end namespace multi_execute_unit
208}; // end namespace execute_loop
209}; // end namespace multi_execute_loop
210}; // end namespace core
211}; // end namespace behavioural
212
213  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)
214  {
215    switch (x)
216      {
217      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;
218      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;
219      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;
220//       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;
221      default    : return ""      ; break;
222      }
223  };
224
225  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)
226  {
227    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
228         (x.compare("no_speculative_load")     == 0))
229      return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::NO_SPECULATIVE_LOAD;
230    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
231         (x.compare("speculative_load_access") == 0))
232      return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_ACCESS;
233    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
234         (x.compare("speculative_load_commit") == 0))
235      return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_COMMIT;
236//     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
237//          (x.compare("speculative_load_bypass") == 0))
238//       return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_BYPASS;
239   
240    throw (ErrorMorpheo ("<fromString> : Unknow string : \""+x+"\""));
241  };
242
243
244  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)
245  {
246    switch (x)
247      {
248      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_EMPTY                   : return "empty"                  ; break;
249      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;
250      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;
251      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;
252      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_COMMIT                  : return "commit"                 ; break;
253      default    : return ""      ; break;
254      }
255  };
256
257  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)
258  {
259    switch (x)
260      {
261      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_ACCESS_QUEUE_EMPTY           : return "empty"          ; break;
262      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;
263      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;
264      default    : return ""      ; break;
265      }
266  };
267
268  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)
269  {
270    switch (x)
271      {
272      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_EMPTY        : return "empty"       ; break;
273      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;
274      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_WAIT         : return "wait"        ; break;
275      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;
276      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_CHECK        : return "check"       ; break;
277      case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_COMMIT       : return "commit"      ; break;
278      default    : return ""      ; break;
279      }
280  };
281
282}; // end namespace morpheo             
283
284#endif
Note: See TracBrowser for help on using the repository browser.