The Sparta Modeling Framework
Loading...
Searching...
No Matches
BIU.hpp
1
2#pragma once
3
14
15#include "CoreTypes.hpp"
16#include "FlushManager.hpp"
17
18// UPDATE
21
22namespace core_example
23{
24 class BIU : public sparta::Unit
25 {
26 public:
29 {
30 public:
31 // Constructor for BIUParameterSet
34 { }
35
36 PARAMETER(uint32_t, biu_req_queue_size, 4, "BIU request queue size")
37 PARAMETER(uint32_t, biu_latency, 1, "Send bus request latency")
38 };
39
40 // Constructor for BIU
41 // node parameter is the node that represent the BIU and p is the BIU parameter set
42 BIU(sparta::TreeNode* node, const BIUParameterSet* p);
43
44 // name of this resource.
45 static const char name[];
46
47
49 // Type Name/Alias Declaration
51
52
53 private:
55 // Input Ports
57
59 {&unit_port_set_, "in_biu_req", 1};
60
61 sparta::SyncInPort<bool> in_mss_ack_sync_
62 {&unit_port_set_, "in_mss_ack_sync", getClock()};
63
64
66 // Output Ports
68
70 {&unit_port_set_, "out_biu_ack"};
71
73 {&unit_port_set_, "out_mss_req_sync", getClock()};
74
75
77 // Internal States
79
80 using BusRequestQueue = std::list<ExampleInstPtr>;
81 BusRequestQueue biu_req_queue_;
82
83 const uint32_t biu_req_queue_size_;
84 const uint32_t biu_latency_;
85
86 bool biu_busy_ = false;
87
88
90 // Event Handlers
92
93 // Event to handle BIU request from LSU
94 sparta::UniqueEvent<> ev_handle_biu_req_
95 {&unit_event_set_, "handle_biu_req", CREATE_SPARTA_HANDLER(BIU, handle_BIU_Req_)};
96
97 // Event to handle MSS Ack
98 sparta::UniqueEvent<> ev_handle_mss_ack_
99 {&unit_event_set_, "handle_mss_ack", CREATE_SPARTA_HANDLER(BIU, handle_MSS_Ack_)};
100
101
103 // Callbacks
105
106 // Receive new BIU request from LSU
107 void getReqFromLSU_(const ExampleInstPtr &);
108
109 // Handle BIU request
110 void handle_BIU_Req_();
111
112 // Handle MSS Ack
113 void handle_MSS_Ack_();
114
115 // Receive MSS access acknowledge
116 // Q: Does the argument list has to be "const DataType &" ?
117 void getAckFromMSS_(const bool &);
118
119
121 // Regular Function/Subroutine Call
123
124 // Append BIU request queue
125 void appendReqQueue_(const ExampleInstPtr &);
126
127
128 };
129}
130
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.
Defines the Pipe class.
File that defines the PortSet class.
File that defines the SignalInPort.
#define CREATE_SPARTA_HANDLER(clname, meth)
File that defines the StartupEvent class.
File that defines synchronized input/output ports.
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 BIU model.
Definition BIU.hpp:29
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.
const Clock * getClock() const
Class that defines an synchronized input port on modules on two different clocks.
Definition SyncPort.hpp:412
Class that defines a synchronized SyncOutPort for data writes on different clocks.
Definition SyncPort.hpp:113
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