13 ignore_inst_execute_time_(p->ignore_inst_execute_time),
14 execute_time_(p->execute_time),
15 scheduler_size_(p->scheduler_size),
16 in_order_issue_(p->in_order_issue),
17 collected_inst_(node, node->getName())
25 FlushManager::FlushingCriteria));
32 complete_inst_ >> issue_inst_;
40 void Execute::sendInitialCredits_()
42 out_scheduler_credits_.
send(scheduler_size_);
47 void Execute::getInstsFromDispatch_(
const ExampleInstPtr & ex_inst)
50 if (in_order_issue_ ==
true || ready_queue_.size() == 0) {
51 ready_queue_.emplace_back(ex_inst);
55 uint64_t issue_pos = std::rand() % ready_queue_.size();
56 if (issue_pos == ready_queue_.size()-1) {
57 ready_queue_.emplace_back(ex_inst);
61 auto iter = ready_queue_.begin();
62 while (iter != ready_queue_.end()) {
63 if (pos == issue_pos) {
64 ready_queue_.insert(iter, ex_inst);
73 if (unit_busy_ ==
false) {
74 issue_inst_.
schedule(sparta::Clock::Cycle(0));
78 void Execute::issueInst_() {
81 "Somehow we're issuing on a busy unit or empty ready_queue");
83 ExampleInstPtr & ex_inst_ptr = ready_queue_.front();
84 auto & ex_inst = *ex_inst_ptr;
85 ex_inst.setStatus(ExampleInst::Status::SCHEDULED);
86 const uint32_t exe_time =
87 ignore_inst_execute_time_ ? execute_time_ : ex_inst.getExecuteTime();
88 collected_inst_.collectWithDuration(ex_inst, exe_time);
95 ++total_insts_issued_;
97 complete_inst_.preparePayload(ex_inst_ptr)->schedule(exe_time);
101 ready_queue_.pop_front();
102 out_scheduler_credits_.
send(1, 0);
106 void Execute::completeInst_(
const ExampleInstPtr & ex_inst) {
111 ++total_insts_executed_;
112 ex_inst->setStatus(ExampleInst::Status::COMPLETED);
116 if (ready_queue_.size() > 0) {
117 issue_inst_.
schedule(sparta::Clock::Cycle(0));
121 void Execute::flushInst_(
const FlushManager::FlushingCriteria & criteria)
128 ReadyQueue::iterator it = ready_queue_.begin();
129 uint32_t credits_to_send = 0;
130 while(it != ready_queue_.end()) {
131 if((*it)->getUniqueID() >= uint64_t(criteria)) {
132 ready_queue_.erase(it++);
139 if(credits_to_send) {
140 out_scheduler_credits_.
send(credits_to_send, 0);
145 auto cancel_critera = [criteria](
const ExampleInstPtr & inst) ->
bool {
146 if(inst->getUniqueID() >= uint64_t(criteria)) {
151 complete_inst_.cancelIf(cancel_critera);
154 if(complete_inst_.getNumOutstandingEvents() == 0) {
156 collected_inst_.closeRecord();
#define sparta_assert_context(e, insertions)
Check condition and throw a sparta exception if condition evaluates to false or 0....
Set of macros for Sparta assertions. Caught by the framework.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
#define SPARTA_EXPECT_FALSE(x)
A macro for hinting to the compiler a particular condition should be considered most likely false.
#define CREATE_SPARTA_HANDLER_WITH_DATA(clname, meth, dataT)
#define CREATE_SPARTA_HANDLER(clname, meth)
Parameters for Execute model.
Execute(sparta::TreeNode *node, const ExecuteParameterSet *p)
Constructor for Execute.
static const char name[]
Name of this resource. Required by sparta::UnitFactory.
Cycle currentCycle() const
Get the current cycle (uses current tick from the Scheduler)
void send(const DataT &dat, sparta::Clock::Cycle rel_time=0)
Send data to bound receivers.
const Clock * getClock() const
void cancel()
Cancel all the times that this Scheduleable was placed on the Scheduler.
StartupEvent is a simple class for scheduling a starting event on the Scheduler. It does not support ...
Node in a composite tree representing a sparta Tree item.
group_idx_type getGroupIdx() const
Gets the group index of this node.
void schedule()
Schedule this event with its pre-set delay using the pre-set Clock.
log::MessageSource info_logger_
Default info logger.
Macros for handling exponential backoff.