The Sparta Modeling Framework
Loading...
Searching...
No Matches
Execute.hpp
1// <Execute.h> -*- C++ -*-
2
3
11#pragma once
12
22#include "sparta/ports/Port.hpp"
25
26#include "CoreTypes.hpp"
27#include "FlushManager.hpp"
28
29namespace core_example
30{
35 class Execute : public sparta::Unit
36 {
37
38 public:
41 {
42 public:
45 { }
46 PARAMETER(bool, ignore_inst_execute_time, false,
47 "Ignore the instruction's execute time, "
48 "use execute_time param instead")
49 PARAMETER(uint32_t, execute_time, 1, "Time for execution")
50 PARAMETER(uint32_t, scheduler_size, 8, "Scheduler queue size")
51 PARAMETER(bool, in_order_issue, true, "Force in order issue")
52 };
53
61 const ExecuteParameterSet * p);
62
64 static const char name[];
65
66 private:
67 // Ports and the set -- remove the ", 1" to experience a DAG issue!
69 &unit_port_set_, "in_execute_write", 1};
70 sparta::DataOutPort<uint32_t> out_scheduler_credits_{&unit_port_set_, "out_scheduler_credits"};
72 {&unit_port_set_, "in_reorder_flush", sparta::SchedulingPhase::Flush, 1};
73
74 // Ready queue
75 typedef std::list<ExampleInstPtr> ReadyQueue;
76 ReadyQueue ready_queue_;
77
78 // busy signal for the attached alu
79 bool unit_busy_ = false;
80 // Execution unit's execution time
81 const bool ignore_inst_execute_time_ = false;
82 const uint32_t execute_time_;
83 const uint32_t scheduler_size_;
84 const bool in_order_issue_;
86 ready_queue_collector_ {getContainer(), "scheduler_queue",
87 &ready_queue_, scheduler_size_};
88
89 // Events used to issue and complete the instruction
90 sparta::UniqueEvent<> issue_inst_{&unit_event_set_, getName() + "_issue_inst",
91 CREATE_SPARTA_HANDLER(Execute, issueInst_)};
93 &unit_event_set_, getName() + "_complete_inst",
94 CREATE_SPARTA_HANDLER_WITH_DATA(Execute, completeInst_, ExampleInstPtr)};
95
96 // A pipeline collector
98
99 // Counter
100 sparta::Counter total_insts_issued_{
101 getStatisticSet(), "total_insts_issued",
102 "Total instructions issued", sparta::Counter::COUNT_NORMAL
103 };
104 sparta::Counter total_insts_executed_{
105 getStatisticSet(), "total_insts_executed",
106 "Total instructions executed", sparta::Counter::COUNT_NORMAL
107 };
108
109 void sendInitialCredits_();
111 // Callbacks
112 void issueInst_();
113 void getInstsFromDispatch_(const ExampleInstPtr&);
114
115 // Used to complete the inst in the FPU
116 void completeInst_(const ExampleInstPtr&);
117
118 // Used to flush the ALU
119 void flushInst_(const FlushManager::FlushingCriteria & criteria);
120 };
121} // namespace core_example
122
File that defines the Clock class.
Implementation of the Collectable class that allows a user to collect an object into an pipeViewer pi...
File that defines Data[In,Out]Port<DataT>
File that defines the EventSet class.
A set of sparta::Parameters per sparta::ResourceTreeNode.
#define PARAMETER(type, name, def, doc)
Parameter declaration.
File that defines the PortSet class.
File that defines the Port base class.
File that defines the SignalInPort.
#define CREATE_SPARTA_HANDLER_WITH_DATA(clname, meth, dataT)
#define CREATE_SPARTA_HANDLER(clname, meth)
File that defines the StartupEvent class.
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 Execute model.
Definition Execute.hpp:41
static const char name[]
Name of this resource. Required by sparta::UnitFactory.
Definition Execute.hpp:64
@ COUNT_NORMAL
Counter counts the number of times something happens like one would expect. This is a weakly monotoni...
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
Generic container of Parameters.
Class to schedule a Scheduleable in the future with a payload, typed on both the data type and the sc...
TreeNode * getContainer()
Gets the TreeNode (container) for this resource (if any)
std::string getName() const
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
StatisticSet * getStatisticSet()
Return the stat set.
Definition Unit.hpp:105
Class used to either manually or auto-collect an Annotation String object in a pipeline database.
A collector of any iterable type (std::vector, std::list, sparta::Buffer, etc)
@ Flush
Phase where flushing of pipelines, etc can occur.