ChampSim
ooo_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023 The ChampSim Contributors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifdef CHAMPSIM_MODULE
18 #define SET_ASIDE_CHAMPSIM_MODULE
19 #undef CHAMPSIM_MODULE
20 #endif
21 
22 #ifndef OOO_CPU_H
23 #define OOO_CPU_H
24 
25 #include <array>
26 #include <bitset>
27 #include <deque>
28 #include <limits>
29 #include <memory>
30 #include <optional>
31 #include <queue>
32 #include <stdexcept>
33 #include <vector>
34 
35 #include "champsim.h"
36 #include "champsim_constants.h"
37 #include "channel.h"
38 #include "instruction.h"
39 #include "module_impl.h"
40 #include "operable.h"
41 #include "util/lru_table.h"
42 #include <type_traits>
43 
44 enum STATUS { INFLIGHT = 1, COMPLETED = 2 };
45 
46 class CACHE;
47 class CacheBus
48 {
52 
54  uint32_t cpu;
55 
56  friend class O3_CPU;
57 
58 public:
59  CacheBus(uint32_t cpu_idx, champsim::channel* ll) : lower_level(ll), cpu(cpu_idx) {}
60  bool issue_read(request_type packet);
61  bool issue_write(request_type packet);
62 };
63 
64 struct cpu_stats {
65  std::string name;
67  uint64_t end_instrs = 0, end_cycles = 0, end_base_update_uops = 0;
69 
70  std::array<long long, 8> total_branch_types = {};
71  std::array<long long, 8> branch_type_misses = {};
72 
73  uint64_t instrs() const { return end_instrs - begin_instrs; }
75  uint64_t cycles() const { return end_cycles - begin_cycles; }
76 
84 };
85 
86 struct LSQ_ENTRY {
87  uint64_t instr_id = 0;
88  uint64_t virtual_address = 0;
89  uint64_t ip = 0;
90  uint64_t event_cycle = 0;
91 
92  std::array<uint8_t, 2> asid = {std::numeric_limits<uint8_t>::max(), std::numeric_limits<uint8_t>::max()};
93  bool fetch_issued = false;
94 
95  uint64_t producer_id = std::numeric_limits<uint64_t>::max();
96  std::vector<std::reference_wrapper<std::optional<LSQ_ENTRY>>> lq_depend_on_me{};
97 
98  LSQ_ENTRY(uint64_t id, uint64_t addr, uint64_t ip, std::array<uint8_t, 2> asid);
99  void finish(std::deque<ooo_model_instr>::iterator begin, std::deque<ooo_model_instr>::iterator end) const;
100 };
101 
102 // cpu
104 {
105 public:
106  uint32_t cpu = 0;
107 
108  // cycle
109  uint64_t begin_phase_cycle = 0;
110  uint64_t begin_phase_instr = 0;
111  uint64_t finish_phase_cycle = 0;
112  uint64_t finish_phase_instr = 0;
113  uint64_t last_heartbeat_cycle = 0;
114  uint64_t last_heartbeat_instr = 0;
115  uint64_t next_print_instruction = STAT_PRINTING_PERIOD;
116 
117  // instruction
118  uint64_t num_retired = 0;
119  uint64_t num_base_update_uops = 0;
120 
121  bool show_heartbeat = true;
122 
124 
126 
127  // instruction buffer
128  struct dib_shift {
129  std::size_t shamt;
130  auto operator()(uint64_t val) const { return val >> shamt; }
131  };
134 
135  // reorder buffer, load/store queue, register file
136  std::deque<ooo_model_instr> IFETCH_BUFFER;
137  std::deque<ooo_model_instr> DISPATCH_BUFFER;
138  std::deque<ooo_model_instr> DECODE_BUFFER;
139  std::deque<ooo_model_instr> ROB;
140 
141  std::vector<std::optional<LSQ_ENTRY>> LQ;
142  std::deque<LSQ_ENTRY> SQ;
143 
144  std::array<std::vector<std::reference_wrapper<ooo_model_instr>>, std::numeric_limits<uint8_t>::max() + 1> reg_producers;
145 
146  // Constants
149  const long int LQ_WIDTH, SQ_WIDTH;
150  const long int RETIRE_WIDTH;
152  const long int L1I_BANDWIDTH, L1D_BANDWIDTH;
153 
154  // branch
155  uint64_t fetch_resume_cycle = 0;
156 
157  const long IN_QUEUE_SIZE = 2 * FETCH_WIDTH;
158  std::deque<ooo_model_instr> input_queue;
159 
162 
163  void initialize() override final;
164  long operate() override final;
165  void begin_phase() override final;
166  void end_phase(unsigned cpu) override final;
167 
168  void initialize_instruction();
169  long check_dib();
170  long fetch_instruction();
171  long promote_to_decode();
172  long decode_instruction();
173  long dispatch_instruction();
174  long schedule_instruction();
175  long execute_instruction();
176  long operate_lsq();
178  long handle_memory_return();
179  long retire_rob();
180 
182  bool do_predict_branch(ooo_model_instr& instr);
183  void do_check_dib(ooo_model_instr& instr);
184  bool do_fetch_instruction(std::deque<ooo_model_instr>::iterator begin, std::deque<ooo_model_instr>::iterator end);
185  void do_dib_update(const ooo_model_instr& instr);
186  void do_scheduling(ooo_model_instr& instr);
187  void do_execution(ooo_model_instr& rob_it);
190  void do_sq_forward_to_lq(LSQ_ENTRY& sq_entry, LSQ_ENTRY& lq_entry);
191 
192  void do_finish_store(const LSQ_ENTRY& sq_entry);
193  bool do_complete_store(const LSQ_ENTRY& sq_entry);
194  bool execute_load(const LSQ_ENTRY& lq_entry);
195 
196  uint64_t roi_instr() const { return roi_stats.instrs(); }
197  uint64_t roi_cycle() const { return roi_stats.cycles(); }
198  uint64_t sim_instr() const { return num_retired - begin_phase_instr; }
199  uint64_t sim_cycle() const { return current_cycle - sim_stats.begin_cycles; }
200 
201  void print_deadlock() override final;
202 
203 #include "ooo_cpu_module_decl.inc"
204 
205  struct module_concept {
206  virtual ~module_concept() = default;
207 
209  virtual void impl_last_branch_result(uint64_t ip, uint64_t target, uint8_t taken, uint8_t branch_type) = 0;
210  virtual uint8_t impl_predict_branch(uint64_t ip) = 0;
211 
212  virtual void impl_initialize_btb() = 0;
213  virtual void impl_update_btb(uint64_t ip, uint64_t predicted_target, uint8_t taken, uint8_t branch_type) = 0;
214  virtual std::pair<uint64_t, uint8_t> impl_btb_prediction(uint64_t ip) = 0;
215  };
216 
217  template <unsigned long long B_FLAG, unsigned long long T_FLAG>
218  struct module_model final : module_concept {
220  explicit module_model(O3_CPU* core) : intern_(core) {}
221 
223  void impl_last_branch_result(uint64_t ip, uint64_t target, uint8_t taken, uint8_t branch_type);
224  uint8_t impl_predict_branch(uint64_t ip);
225 
227  void impl_update_btb(uint64_t ip, uint64_t predicted_target, uint8_t taken, uint8_t branch_type);
228  std::pair<uint64_t, uint8_t> impl_btb_prediction(uint64_t ip);
229  };
230 
231  std::unique_ptr<module_concept> module_pimpl;
232 
233  void impl_initialize_branch_predictor() { module_pimpl->impl_initialize_branch_predictor(); }
234  void impl_last_branch_result(uint64_t ip, uint64_t target, uint8_t taken, uint8_t branch_type)
235  {
236  module_pimpl->impl_last_branch_result(ip, target, taken, branch_type);
237  }
238  uint8_t impl_predict_branch(uint64_t ip) { return module_pimpl->impl_predict_branch(ip); }
239 
240  void impl_initialize_btb() { module_pimpl->impl_initialize_btb(); }
241  void impl_update_btb(uint64_t ip, uint64_t predicted_target, uint8_t taken, uint8_t branch_type)
242  {
243  module_pimpl->impl_update_btb(ip, predicted_target, taken, branch_type);
244  }
245  std::pair<uint64_t, uint8_t> impl_btb_prediction(uint64_t ip) { return module_pimpl->impl_btb_prediction(ip); }
246 
248  {
249  };
250  template <unsigned long long B_FLAG = 0, unsigned long long T_FLAG = 0>
251  class Builder
252  {
254 
255  uint32_t m_cpu{};
256  double m_freq_scale{};
257  std::size_t m_dib_set{};
258  std::size_t m_dib_way{};
259  std::size_t m_dib_window{};
260  std::size_t m_ifetch_buffer_size{};
261  std::size_t m_decode_buffer_size{};
262  std::size_t m_dispatch_buffer_size{};
263  std::size_t m_rob_size{};
264  std::size_t m_lq_size{};
265  std::size_t m_sq_size{};
266  unsigned m_fetch_width{};
267  unsigned m_decode_width{};
268  unsigned m_dispatch_width{};
269  unsigned m_schedule_width{};
270  unsigned m_execute_width{};
271  unsigned m_lq_width{};
272  unsigned m_sq_width{};
273  unsigned m_retire_width{};
275  unsigned m_decode_latency{};
276  unsigned m_dispatch_latency{};
277  unsigned m_schedule_latency{};
278  unsigned m_execute_latency{};
279 
281  long int m_l1i_bw{};
282  long int m_l1d_bw{};
285 
286  friend class O3_CPU;
287 
288  template <unsigned long long OTHER_B, unsigned long long OTHER_T>
298  {
299  }
300 
301  public:
302  Builder() = default;
303 
304  self_type& index(uint32_t cpu_)
305  {
306  m_cpu = cpu_;
307  return *this;
308  }
309  self_type& frequency(double freq_scale_)
310  {
311  m_freq_scale = freq_scale_;
312  return *this;
313  }
314  self_type& dib_set(std::size_t dib_set_)
315  {
316  m_dib_set = dib_set_;
317  return *this;
318  }
319  self_type& dib_way(std::size_t dib_way_)
320  {
321  m_dib_way = dib_way_;
322  return *this;
323  }
324  self_type& dib_window(std::size_t dib_window_)
325  {
326  m_dib_window = dib_window_;
327  return *this;
328  }
329  self_type& ifetch_buffer_size(std::size_t ifetch_buffer_size_)
330  {
331  m_ifetch_buffer_size = ifetch_buffer_size_;
332  return *this;
333  }
334  self_type& decode_buffer_size(std::size_t decode_buffer_size_)
335  {
336  m_decode_buffer_size = decode_buffer_size_;
337  return *this;
338  }
339  self_type& dispatch_buffer_size(std::size_t dispatch_buffer_size_)
340  {
341  m_dispatch_buffer_size = dispatch_buffer_size_;
342  return *this;
343  }
344  self_type& rob_size(std::size_t rob_size_)
345  {
346  m_rob_size = rob_size_;
347  return *this;
348  }
349  self_type& lq_size(std::size_t lq_size_)
350  {
351  m_lq_size = lq_size_;
352  return *this;
353  }
354  self_type& sq_size(std::size_t sq_size_)
355  {
356  m_sq_size = sq_size_;
357  return *this;
358  }
359  self_type& fetch_width(unsigned fetch_width_)
360  {
361  m_fetch_width = fetch_width_;
362  return *this;
363  }
364  self_type& decode_width(unsigned decode_width_)
365  {
366  m_decode_width = decode_width_;
367  return *this;
368  }
369  self_type& dispatch_width(unsigned dispatch_width_)
370  {
371  m_dispatch_width = dispatch_width_;
372  return *this;
373  }
374  self_type& schedule_width(unsigned schedule_width_)
375  {
376  m_schedule_width = schedule_width_;
377  return *this;
378  }
379  self_type& execute_width(unsigned execute_width_)
380  {
381  m_execute_width = execute_width_;
382  return *this;
383  }
384  self_type& lq_width(unsigned lq_width_)
385  {
386  m_lq_width = lq_width_;
387  return *this;
388  }
389  self_type& sq_width(unsigned sq_width_)
390  {
391  m_sq_width = sq_width_;
392  return *this;
393  }
394  self_type& retire_width(unsigned retire_width_)
395  {
396  m_retire_width = retire_width_;
397  return *this;
398  }
399  self_type& mispredict_penalty(unsigned mispredict_penalty_)
400  {
401  m_mispredict_penalty = mispredict_penalty_;
402  return *this;
403  }
404  self_type& decode_latency(unsigned decode_latency_)
405  {
406  m_decode_latency = decode_latency_;
407  return *this;
408  }
409  self_type& dispatch_latency(unsigned dispatch_latency_)
410  {
411  m_dispatch_latency = dispatch_latency_;
412  return *this;
413  }
414  self_type& schedule_latency(unsigned schedule_latency_)
415  {
416  m_schedule_latency = schedule_latency_;
417  return *this;
418  }
419  self_type& execute_latency(unsigned execute_latency_)
420  {
421  m_execute_latency = execute_latency_;
422  return *this;
423  }
425  {
426  m_l1i = l1i_;
427  return *this;
428  }
429  self_type& l1i_bandwidth(long int l1i_bw_)
430  {
431  m_l1i_bw = l1i_bw_;
432  return *this;
433  }
434  self_type& l1d_bandwidth(long int l1d_bw_)
435  {
436  m_l1d_bw = l1d_bw_;
437  return *this;
438  }
440  {
441  m_fetch_queues = fetch_queues_;
442  return *this;
443  }
445  {
446  m_data_queues = data_queues_;
447  return *this;
448  }
449 
450  template <unsigned long long B>
452  {
454  }
455  template <unsigned long long T>
457  {
459  }
460  };
461 
462  template <unsigned long long B_FLAG, unsigned long long T_FLAG>
464  : champsim::operable(b.m_freq_scale), cpu(b.m_cpu), DIB(b.m_dib_set, b.m_dib_way, {champsim::lg2(b.m_dib_window)}, {champsim::lg2(b.m_dib_window)}),
465  LQ(b.m_lq_size), IFETCH_BUFFER_SIZE(b.m_ifetch_buffer_size), DISPATCH_BUFFER_SIZE(b.m_dispatch_buffer_size), DECODE_BUFFER_SIZE(b.m_decode_buffer_size),
466  ROB_SIZE(b.m_rob_size), SQ_SIZE(b.m_sq_size), FETCH_WIDTH(b.m_fetch_width), DECODE_WIDTH(b.m_decode_width), DISPATCH_WIDTH(b.m_dispatch_width),
467  SCHEDULER_SIZE(b.m_schedule_width), EXEC_WIDTH(b.m_execute_width), LQ_WIDTH(b.m_lq_width), SQ_WIDTH(b.m_sq_width), RETIRE_WIDTH(b.m_retire_width),
468  BRANCH_MISPREDICT_PENALTY(b.m_mispredict_penalty), DISPATCH_LATENCY(b.m_dispatch_latency), DECODE_LATENCY(b.m_decode_latency),
469  SCHEDULING_LATENCY(b.m_schedule_latency), EXEC_LATENCY(b.m_execute_latency), L1I_BANDWIDTH(b.m_l1i_bw), L1D_BANDWIDTH(b.m_l1d_bw),
470  L1I_bus(b.m_cpu, b.m_fetch_queues), L1D_bus(b.m_cpu, b.m_data_queues), l1i(b.m_l1i), module_pimpl(std::make_unique<module_model<B_FLAG, T_FLAG>>(this))
471  {
472  }
473 };
474 
475 #include "ooo_cpu_module_def.inc"
476 
477 #endif
478 
479 #ifdef SET_ASIDE_CHAMPSIM_MODULE
480 #undef SET_ASIDE_CHAMPSIM_MODULE
481 #define CHAMPSIM_MODULE
482 #endif
Definition: cache.h:57
Definition: ooo_cpu.h:48
typename channel_type::response_type response_type
Definition: ooo_cpu.h:51
bool issue_read(request_type packet)
Definition: ooo_cpu.cc:738
CacheBus(uint32_t cpu_idx, champsim::channel *ll)
Definition: ooo_cpu.h:59
typename channel_type::request_type request_type
Definition: ooo_cpu.h:50
channel_type * lower_level
Definition: ooo_cpu.h:53
uint32_t cpu
Definition: ooo_cpu.h:54
bool issue_write(request_type packet)
Definition: ooo_cpu.cc:748
Definition: ooo_cpu.h:252
self_type & l1d_bandwidth(long int l1d_bw_)
Definition: ooo_cpu.h:434
self_type & data_queues(champsim::channel *data_queues_)
Definition: ooo_cpu.h:444
champsim::channel * m_data_queues
Definition: ooo_cpu.h:284
self_type & dib_window(std::size_t dib_window_)
Definition: ooo_cpu.h:324
self_type & sq_size(std::size_t sq_size_)
Definition: ooo_cpu.h:354
self_type & schedule_latency(unsigned schedule_latency_)
Definition: ooo_cpu.h:414
std::size_t m_dib_way
Definition: ooo_cpu.h:258
self_type & lq_width(unsigned lq_width_)
Definition: ooo_cpu.h:384
unsigned m_fetch_width
Definition: ooo_cpu.h:266
Builder()=default
self_type & ifetch_buffer_size(std::size_t ifetch_buffer_size_)
Definition: ooo_cpu.h:329
self_type & l1i(CACHE *l1i_)
Definition: ooo_cpu.h:424
unsigned m_sq_width
Definition: ooo_cpu.h:272
self_type & rob_size(std::size_t rob_size_)
Definition: ooo_cpu.h:344
unsigned m_dispatch_width
Definition: ooo_cpu.h:268
self_type & mispredict_penalty(unsigned mispredict_penalty_)
Definition: ooo_cpu.h:399
self_type & dib_way(std::size_t dib_way_)
Definition: ooo_cpu.h:319
std::size_t m_decode_buffer_size
Definition: ooo_cpu.h:261
self_type & l1i_bandwidth(long int l1i_bw_)
Definition: ooo_cpu.h:429
self_type & index(uint32_t cpu_)
Definition: ooo_cpu.h:304
unsigned m_schedule_latency
Definition: ooo_cpu.h:277
std::size_t m_dib_window
Definition: ooo_cpu.h:259
self_type & dib_set(std::size_t dib_set_)
Definition: ooo_cpu.h:314
std::size_t m_sq_size
Definition: ooo_cpu.h:265
self_type & dispatch_buffer_size(std::size_t dispatch_buffer_size_)
Definition: ooo_cpu.h:339
std::size_t m_dib_set
Definition: ooo_cpu.h:257
long int m_l1i_bw
Definition: ooo_cpu.h:281
unsigned m_mispredict_penalty
Definition: ooo_cpu.h:274
self_type & frequency(double freq_scale_)
Definition: ooo_cpu.h:309
unsigned m_decode_latency
Definition: ooo_cpu.h:275
self_type & execute_width(unsigned execute_width_)
Definition: ooo_cpu.h:379
self_type & decode_width(unsigned decode_width_)
Definition: ooo_cpu.h:364
double m_freq_scale
Definition: ooo_cpu.h:256
self_type & retire_width(unsigned retire_width_)
Definition: ooo_cpu.h:394
unsigned m_lq_width
Definition: ooo_cpu.h:271
unsigned m_retire_width
Definition: ooo_cpu.h:273
self_type & schedule_width(unsigned schedule_width_)
Definition: ooo_cpu.h:374
unsigned m_execute_latency
Definition: ooo_cpu.h:278
CACHE * m_l1i
Definition: ooo_cpu.h:280
self_type & fetch_queues(champsim::channel *fetch_queues_)
Definition: ooo_cpu.h:439
std::size_t m_lq_size
Definition: ooo_cpu.h:264
unsigned m_schedule_width
Definition: ooo_cpu.h:269
std::size_t m_ifetch_buffer_size
Definition: ooo_cpu.h:260
Builder< B_FLAG, T > btb()
Definition: ooo_cpu.h:456
self_type & fetch_width(unsigned fetch_width_)
Definition: ooo_cpu.h:359
Builder< B, T_FLAG > branch_predictor()
Definition: ooo_cpu.h:451
self_type & decode_latency(unsigned decode_latency_)
Definition: ooo_cpu.h:404
long int m_l1d_bw
Definition: ooo_cpu.h:282
unsigned m_dispatch_latency
Definition: ooo_cpu.h:276
unsigned m_decode_width
Definition: ooo_cpu.h:267
self_type & sq_width(unsigned sq_width_)
Definition: ooo_cpu.h:389
uint32_t m_cpu
Definition: ooo_cpu.h:255
std::size_t m_dispatch_buffer_size
Definition: ooo_cpu.h:262
self_type & dispatch_width(unsigned dispatch_width_)
Definition: ooo_cpu.h:369
Builder(builder_conversion_tag, const Builder< OTHER_B, OTHER_T > &other)
Definition: ooo_cpu.h:289
self_type & decode_buffer_size(std::size_t decode_buffer_size_)
Definition: ooo_cpu.h:334
self_type & execute_latency(unsigned execute_latency_)
Definition: ooo_cpu.h:419
self_type & dispatch_latency(unsigned dispatch_latency_)
Definition: ooo_cpu.h:409
self_type & lq_size(std::size_t lq_size_)
Definition: ooo_cpu.h:349
unsigned m_execute_width
Definition: ooo_cpu.h:270
champsim::channel * m_fetch_queues
Definition: ooo_cpu.h:283
std::size_t m_rob_size
Definition: ooo_cpu.h:263
Definition: ooo_cpu.h:248
Definition: ooo_cpu.h:104
long check_dib()
Definition: ooo_cpu.cc:242
const long int LQ_WIDTH
Definition: ooo_cpu.h:149
const long int DECODE_WIDTH
Definition: ooo_cpu.h:148
std::deque< ooo_model_instr > IFETCH_BUFFER
Definition: ooo_cpu.h:136
const long int SCHEDULER_SIZE
Definition: ooo_cpu.h:148
uint8_t impl_predict_branch(uint64_t ip)
Definition: ooo_cpu.h:238
uint64_t last_heartbeat_instr
Definition: ooo_cpu.h:114
long dispatch_instruction()
Definition: ooo_cpu.cc:367
uint64_t sim_cycle() const
Definition: ooo_cpu.h:199
stats_type roi_stats
Definition: ooo_cpu.h:125
const std::size_t DISPATCH_BUFFER_SIZE
Definition: ooo_cpu.h:147
bool do_fetch_instruction(std::deque< ooo_model_instr >::iterator begin, std::deque< ooo_model_instr >::iterator end)
Definition: ooo_cpu.cc:301
uint64_t num_base_update_uops
Definition: ooo_cpu.h:119
std::deque< ooo_model_instr > input_queue
Definition: ooo_cpu.h:158
const unsigned SCHEDULING_LATENCY
Definition: ooo_cpu.h:151
uint64_t begin_phase_cycle
Definition: ooo_cpu.h:109
const std::size_t ROB_SIZE
Definition: ooo_cpu.h:147
bool do_predict_branch(ooo_model_instr &instr)
Definition: ooo_cpu.cc:150
stats_type sim_stats
Definition: ooo_cpu.h:125
uint64_t finish_phase_cycle
Definition: ooo_cpu.h:111
long fetch_instruction()
Definition: ooo_cpu.cc:268
bool show_heartbeat
Definition: ooo_cpu.h:121
void initialize() override final
Definition: ooo_cpu.cc:73
void impl_update_btb(uint64_t ip, uint64_t predicted_target, uint8_t taken, uint8_t branch_type)
Definition: ooo_cpu.h:241
const unsigned BRANCH_MISPREDICT_PENALTY
Definition: ooo_cpu.h:151
bool execute_load(const LSQ_ENTRY &lq_entry)
Definition: ooo_cpu.cc:567
dib_type DIB
Definition: ooo_cpu.h:133
void end_phase(unsigned cpu) override final
Definition: ooo_cpu.cc:94
std::deque< ooo_model_instr > DECODE_BUFFER
Definition: ooo_cpu.h:138
uint64_t finish_phase_instr
Definition: ooo_cpu.h:112
const unsigned DISPATCH_LATENCY
Definition: ooo_cpu.h:151
const long int FETCH_WIDTH
Definition: ooo_cpu.h:148
bool do_complete_store(const LSQ_ENTRY &sq_entry)
Definition: ooo_cpu.cc:553
long complete_inflight_instruction()
Definition: ooo_cpu.cc:605
long decode_instruction()
Definition: ooo_cpu.cc:332
long operate_lsq()
Definition: ooo_cpu.cc:500
const long int L1I_BANDWIDTH
Definition: ooo_cpu.h:152
bool do_init_instruction(ooo_model_instr &instr)
Definition: ooo_cpu.cc:230
long handle_memory_return()
Definition: ooo_cpu.cc:619
CacheBus L1I_bus
Definition: ooo_cpu.h:160
void do_check_dib(ooo_model_instr &instr)
Definition: ooo_cpu.cc:251
const long IN_QUEUE_SIZE
Definition: ooo_cpu.h:157
std::array< std::vector< std::reference_wrapper< ooo_model_instr > >, std::numeric_limits< uint8_t >::max()+1 > reg_producers
Definition: ooo_cpu.h:144
std::pair< uint64_t, uint8_t > impl_btb_prediction(uint64_t ip)
Definition: ooo_cpu.h:245
const std::size_t DECODE_BUFFER_SIZE
Definition: ooo_cpu.h:147
const long int DISPATCH_WIDTH
Definition: ooo_cpu.h:148
void do_complete_execution(ooo_model_instr &instr)
Definition: ooo_cpu.cc:581
void begin_phase() override final
Definition: ooo_cpu.cc:80
void initialize_instruction()
Definition: ooo_cpu.cc:109
void print_deadlock() override final
Definition: ooo_cpu.cc:683
const unsigned DECODE_LATENCY
Definition: ooo_cpu.h:151
uint64_t last_heartbeat_cycle
Definition: ooo_cpu.h:113
void do_memory_scheduling(ooo_model_instr &instr)
Definition: ooo_cpu.cc:460
void do_dib_update(const ooo_model_instr &instr)
Definition: ooo_cpu.cc:365
uint32_t cpu
Definition: ooo_cpu.h:106
std::deque< ooo_model_instr > DISPATCH_BUFFER
Definition: ooo_cpu.h:137
void do_finish_store(const LSQ_ENTRY &sq_entry)
Definition: ooo_cpu.cc:539
uint64_t roi_instr() const
Definition: ooo_cpu.h:196
long promote_to_decode()
Definition: ooo_cpu.cc:317
void impl_initialize_btb()
Definition: ooo_cpu.h:240
uint64_t sim_instr() const
Definition: ooo_cpu.h:198
std::unique_ptr< module_concept > module_pimpl
Definition: ooo_cpu.h:231
std::vector< std::optional< LSQ_ENTRY > > LQ
Definition: ooo_cpu.h:141
void do_sq_forward_to_lq(LSQ_ENTRY &sq_entry, LSQ_ENTRY &lq_entry)
std::deque< LSQ_ENTRY > SQ
Definition: ooo_cpu.h:142
uint64_t begin_phase_instr
Definition: ooo_cpu.h:110
CacheBus L1D_bus
Definition: ooo_cpu.h:160
uint64_t roi_cycle() const
Definition: ooo_cpu.h:197
uint64_t next_print_instruction
Definition: ooo_cpu.h:115
long operate() override final
Definition: ooo_cpu.cc:35
long execute_instruction()
Definition: ooo_cpu.cc:427
void impl_initialize_branch_predictor()
Definition: ooo_cpu.h:233
void impl_last_branch_result(uint64_t ip, uint64_t target, uint8_t taken, uint8_t branch_type)
Definition: ooo_cpu.h:234
const std::size_t IFETCH_BUFFER_SIZE
Definition: ooo_cpu.h:147
const long int RETIRE_WIDTH
Definition: ooo_cpu.h:150
const long int L1D_BANDWIDTH
Definition: ooo_cpu.h:152
uint64_t fetch_resume_cycle
Definition: ooo_cpu.h:155
O3_CPU(Builder< B_FLAG, T_FLAG > b)
Definition: ooo_cpu.h:463
const long int EXEC_WIDTH
Definition: ooo_cpu.h:148
long retire_rob()
Definition: ooo_cpu.cc:664
uint64_t num_retired
Definition: ooo_cpu.h:118
void do_scheduling(ooo_model_instr &instr)
Definition: ooo_cpu.cc:403
std::deque< ooo_model_instr > ROB
Definition: ooo_cpu.h:139
CACHE * l1i
Definition: ooo_cpu.h:161
void do_execution(ooo_model_instr &rob_it)
Definition: ooo_cpu.cc:440
const std::size_t SQ_SIZE
Definition: ooo_cpu.h:147
const long int SQ_WIDTH
Definition: ooo_cpu.h:149
const unsigned EXEC_LATENCY
Definition: ooo_cpu.h:151
long schedule_instruction()
Definition: ooo_cpu.cc:386
Definition: channel.h:64
response response_type
Definition: channel.h:109
request request_type
Definition: channel.h:110
Definition: lru_table.h:46
Definition: operable.h:24
uint64_t current_cycle
Definition: operable.h:29
operable(double scale)
Definition: operable.h:32
branch_type
Definition: instruction.h:30
constexpr unsigned lg2(uint64_t n)
Definition: bits.h:25
Definition: champsim.h:24
STATUS
Definition: ooo_cpu.h:44
@ INFLIGHT
Definition: ooo_cpu.h:44
@ COMPLETED
Definition: ooo_cpu.h:44
Definition: ooo_cpu.h:86
uint64_t ip
Definition: ooo_cpu.h:89
std::array< uint8_t, 2 > asid
Definition: ooo_cpu.h:92
void finish(std::deque< ooo_model_instr >::iterator begin, std::deque< ooo_model_instr >::iterator end) const
Definition: ooo_cpu.cc:723
bool fetch_issued
Definition: ooo_cpu.h:93
std::vector< std::reference_wrapper< std::optional< LSQ_ENTRY > > > lq_depend_on_me
Definition: ooo_cpu.h:96
uint64_t instr_id
Definition: ooo_cpu.h:87
uint64_t event_cycle
Definition: ooo_cpu.h:90
uint64_t virtual_address
Definition: ooo_cpu.h:88
LSQ_ENTRY(uint64_t id, uint64_t addr, uint64_t ip, std::array< uint8_t, 2 > asid)
Definition: ooo_cpu.cc:718
uint64_t producer_id
Definition: ooo_cpu.h:95
Definition: ooo_cpu.h:128
auto operator()(uint64_t val) const
Definition: ooo_cpu.h:130
std::size_t shamt
Definition: ooo_cpu.h:129
Definition: ooo_cpu.h:205
virtual uint8_t impl_predict_branch(uint64_t ip)=0
virtual void impl_last_branch_result(uint64_t ip, uint64_t target, uint8_t taken, uint8_t branch_type)=0
virtual std::pair< uint64_t, uint8_t > impl_btb_prediction(uint64_t ip)=0
virtual void impl_initialize_btb()=0
virtual void impl_initialize_branch_predictor()=0
virtual ~module_concept()=default
virtual void impl_update_btb(uint64_t ip, uint64_t predicted_target, uint8_t taken, uint8_t branch_type)=0
Definition: ooo_cpu.h:218
void impl_last_branch_result(uint64_t ip, uint64_t target, uint8_t taken, uint8_t branch_type)
std::pair< uint64_t, uint8_t > impl_btb_prediction(uint64_t ip)
uint8_t impl_predict_branch(uint64_t ip)
module_model(O3_CPU *core)
Definition: ooo_cpu.h:220
void impl_update_btb(uint64_t ip, uint64_t predicted_target, uint8_t taken, uint8_t branch_type)
void impl_initialize_branch_predictor()
O3_CPU * intern_
Definition: ooo_cpu.h:219
Definition: ooo_cpu.h:64
uint64_t instrs() const
Definition: ooo_cpu.h:73
uint64_t end_instrs
Definition: ooo_cpu.h:67
uint64_t begin_cycles
Definition: ooo_cpu.h:66
uint64_t direction_prediction_miss
Definition: ooo_cpu.h:77
uint64_t total_rob_occupancy_at_branch_mispredict
Definition: ooo_cpu.h:68
std::string name
Definition: ooo_cpu.h:65
uint64_t target_prediction_miss_general_not_in_btb
Definition: ooo_cpu.h:82
uint64_t target_prediction_miss_return_wrong_target
Definition: ooo_cpu.h:79
uint64_t end_base_update_uops
Definition: ooo_cpu.h:67
uint64_t target_prediction_miss_return_not_in_btb
Definition: ooo_cpu.h:78
uint64_t target_prediction_miss_indirect_wrong_target
Definition: ooo_cpu.h:81
uint64_t end_cycles
Definition: ooo_cpu.h:67
uint64_t begin_instrs
Definition: ooo_cpu.h:66
uint64_t begin_base_update_uops
Definition: ooo_cpu.h:66
std::array< long long, 8 > branch_type_misses
Definition: ooo_cpu.h:71
uint64_t cycles() const
Definition: ooo_cpu.h:75
uint64_t target_prediction_miss_indirect_not_in_btb
Definition: ooo_cpu.h:80
uint64_t base_update_uops() const
Definition: ooo_cpu.h:74
uint64_t target_prediction_miss_general_wrong_target
Definition: ooo_cpu.h:83
std::array< long long, 8 > total_branch_types
Definition: ooo_cpu.h:70
Definition: instruction.h:41