The Sparta Modeling Framework
Loading...
Searching...
No Matches
ROB.hpp
1// <ROB.h> -*- C++ -*-
2
3
4#pragma once
5#include <string>
6
12#include "sparta/log/MessageSource.hpp"
13
14#include "CoreTypes.hpp"
15#include "FlushManager.hpp"
16
17namespace core_example
18{
19
27 class ROB : public sparta::Unit
28 {
29 public:
32 {
33 public:
36 { }
37
38 PARAMETER(uint32_t, num_to_retire, 4, "Number of instructions to retire")
39 PARAMETER(uint32_t, retire_queue_depth, 30, "Depth of the retire queue")
40 PARAMETER(uint32_t, num_insts_to_retire, 0,
41 "Number of instructions to retire after which simulation will be "
42 "terminated. 0 means simulation will run until end of testcase")
43
44 };
45
56 ROB(sparta::TreeNode * node,
57 const ROBParameterSet * p);
58
60 static const char name[];
61
63 ~ROB();
64
65 private:
66
67 sparta::StatisticDef stat_ipc_;
68 sparta::Counter num_retired_;
69 sparta::Counter num_flushes_;
70 sparta::Clock::Cycle last_retirement_ = 0;
71 const sparta::Clock::Cycle retire_timeout_interval_ = 100000;
72
73 const uint32_t num_to_retire_;
74 const uint32_t num_insts_to_retire_; // parameter from ilimit
75
76 InstQueue reorder_buffer_;
77
78 // Ports used by the ROB
79 sparta::DataInPort<InstGroup> in_reorder_buffer_write_ {&unit_port_set_, "in_reorder_buffer_write", 1};
80 sparta::DataOutPort<uint32_t> out_reorder_buffer_credits_{&unit_port_set_, "out_reorder_buffer_credits"};
81 sparta::DataInPort<bool> in_oldest_completed_ {&unit_port_set_, "in_reorder_oldest_completed"};
82 sparta::DataOutPort<FlushManager::FlushingCriteria> out_retire_flush_ {&unit_port_set_, "out_retire_flush"};
83 sparta::DataOutPort<uint64_t> out_fetch_flush_redirect_ {&unit_port_set_, "out_fetch_flush_redirect"};
84
85 // UPDATE:
86 sparta::DataOutPort<ExampleInstPtr> out_rob_retire_ack_ {&unit_port_set_, "out_rob_retire_ack"};
87
88 // For flush
90 {&unit_port_set_, "in_reorder_flush", sparta::SchedulingPhase::Flush, 1};
91
92 // Events used by the ROB
93 sparta::UniqueEvent<> ev_retire_ {&unit_event_set_, "retire_insts",
94 CREATE_SPARTA_HANDLER(ROB, retireEvent_)};
95
96 // A nice checker to make sure forward progress is being made
97 // Note that in the ROB constructor, this event is set as non-continuing
98 sparta::Event<> ev_ensure_forward_progress_{&unit_event_set_, "forward_progress_check",
99 CREATE_SPARTA_HANDLER(ROB, checkForwardProgress_)};
100
101 void sendInitialCredits_();
102 void retireEvent_();
103 void robAppended_(const InstGroup &);
104 void retireInstructions_();
105 void checkForwardProgress_();
106 void handleFlush_(const FlushManager::FlushingCriteria & criteria);
107
108 };
109}
110
File that defines Data[In,Out]Port<DataT>
A set of sparta::Parameters per sparta::ResourceTreeNode.
#define PARAMETER(type, name, def, doc)
Parameter declaration.
#define CREATE_SPARTA_HANDLER(clname, meth)
Basic Node framework in sparta device tree composite pattern.
File that defines the UniqueEvent class.
File that defines the Unit class, a common grouping of sets and loggers.
Parameters for ROB model.
Definition ROB.hpp:32
static const char name[]
Name of this resource. Required by sparta::UnitFactory.
Definition ROB.hpp:60
~ROB()
Destroy!
Definition ROB.cpp:55
Represents a counter of type counter_type (uint64_t). 2 and greater than 0 with a ceiling specified....
Definition Counter.hpp:27
DataInPort receives data from sender using a DataOutPort.
Definition DataPort.hpp:289
DataOutPort is used for transferring any data to another module.
Definition DataPort.hpp:77
Event is a simple class for scheduling random events on the Scheduler.
Definition Event.hpp:42
Generic container of Parameters.
Contains a statistic definition (some useful information which can be computed)
Node in a composite tree representing a sparta Tree item.
Definition TreeNode.hpp:205
A type of Event that uniquely schedules itself on the schedule within a single time quantum....
The is the base class for user defined blocks in simulation.
Definition Unit.hpp:38
sparta::EventSet unit_event_set_
The Unit's event set.
Definition Unit.hpp:114
sparta::PortSet unit_port_set_
The Unit's Ports.
Definition Unit.hpp:111
@ Flush
Phase where flushing of pipelines, etc can occur.