The Sparta Modeling Framework
Loading...
Searching...
No Matches
FlushManager.hpp
1// <Flush.h> -*- C++ -*-
2
3
10#pragma once
11
12#include <cinttypes>
13#include <string>
14
17
18namespace core_example
19{
39 {
40 public:
41 typedef uint64_t FlushingCriteria;
42 static constexpr char name[] = "flushmanager";
43
52
59 Unit(rc, name),
60 out_retire_flush_(getPortSet(), "out_retire_flush", false),
61 in_retire_flush_(getPortSet(), "in_retire_flush", 0),
62 out_fetch_flush_redirect_(getPortSet(), "out_fetch_flush_redirect", false),
63 in_fetch_flush_redirect_(getPortSet(), "in_fetch_flush_redirect", 0)
64 {
65 (void)params;
66 in_retire_flush_.
67 registerConsumerHandler(CREATE_SPARTA_HANDLER_WITH_DATA(FlushManager,
68 forwardRetireFlush_,
69 FlushingCriteria));
70 in_fetch_flush_redirect_.
71 registerConsumerHandler(CREATE_SPARTA_HANDLER_WITH_DATA(FlushManager,
72 forwardFetchRedirectFlush_,
73 uint64_t));
74 }
75
76 private:
77
78 // Flushing criteria
80 sparta::DataInPort <FlushingCriteria> in_retire_flush_;
81
82 // Flush redirect for Fetch
83 sparta::DataOutPort<uint64_t> out_fetch_flush_redirect_;
84 sparta::DataInPort <uint64_t> in_fetch_flush_redirect_;
85
86 // Internal method used to forward the flush to the attached
87 // listeners
88 void forwardRetireFlush_(const FlushingCriteria & flush_data) {
89 out_retire_flush_.send(flush_data);
90 }
91
92 // Internal method used to forward the fetch redirect
93 void forwardFetchRedirectFlush_(const uint64_t & flush_data) {
94 out_fetch_flush_redirect_.send(flush_data);
95 }
96 };
97}
98
File that defines Data[In,Out]Port<DataT>
#define CREATE_SPARTA_HANDLER_WITH_DATA(clname, meth, dataT)
File that defines the Unit class, a common grouping of sets and loggers.
Class used by performance models for signaling a flushing event across blocks.
FlushManager(sparta::TreeNode *rc, const FlushManagerParameters *params)
Create a FlushManager in the tree.
DataOutPort is used for transferring any data to another module.
Definition DataPort.hpp:77
void send(const DataT &dat, sparta::Clock::Cycle rel_time=0)
Send data to bound receivers.
Definition DataPort.hpp:145
Generic container of Parameters.
Node in a composite tree representing a sparta Tree item.
Definition TreeNode.hpp:205
The is the base class for user defined blocks in simulation.
Definition Unit.hpp:38
Unit(TreeNode *rc, const std::string &name)
Construct unit with a ResouceContainer.
Definition Unit.hpp:54
PortSet * getPortSet()
Return the port set.
Definition Unit.hpp:95