summaryrefslogtreecommitdiff
path: root/src/mem/ruby/system/GPUCoalescer.hh
diff options
context:
space:
mode:
authorTony Gutierrez <anthony.gutierrez@amd.com>2016-10-26 22:46:58 -0400
committerTony Gutierrez <anthony.gutierrez@amd.com>2016-10-26 22:46:58 -0400
commitc7d4afd878ac37ff7d1b72628e98d6337f0a4441 (patch)
treeec2a03529f22caf7909820bda35c64cf19645eb0 /src/mem/ruby/system/GPUCoalescer.hh
parent90b087171b048aa226be96dc32d73624f957b793 (diff)
downloadgem5-c7d4afd878ac37ff7d1b72628e98d6337f0a4441.tar.xz
ruby: make a RequestDesc class instead of std::pair
the RequestDesc was previously implemented as a std::pair, which made the implementation overly complex and error prone. here we encapsulate the packet, primary, and secondary types all in a single data structure with all members properly intialized in a ctor
Diffstat (limited to 'src/mem/ruby/system/GPUCoalescer.hh')
-rw-r--r--src/mem/ruby/system/GPUCoalescer.hh22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/mem/ruby/system/GPUCoalescer.hh b/src/mem/ruby/system/GPUCoalescer.hh
index fcf7cecf4..557d39235 100644
--- a/src/mem/ruby/system/GPUCoalescer.hh
+++ b/src/mem/ruby/system/GPUCoalescer.hh
@@ -73,6 +73,24 @@ struct GPUCoalescerRequest
{}
};
+class RequestDesc
+{
+ public:
+ RequestDesc(PacketPtr pkt, RubyRequestType p_type, RubyRequestType s_type)
+ : pkt(pkt), primaryType(p_type), secondaryType(s_type)
+ {
+ }
+
+ RequestDesc() : pkt(nullptr), primaryType(RubyRequestType_NULL),
+ secondaryType(RubyRequestType_NULL)
+ {
+ }
+
+ PacketPtr pkt;
+ RubyRequestType primaryType;
+ RubyRequestType secondaryType;
+};
+
std::ostream& operator<<(std::ostream& out, const GPUCoalescerRequest& obj);
class GPUCoalescer : public RubyPort
@@ -271,9 +289,7 @@ class GPUCoalescer : public RubyPort
// The secondary request type comprises a subset of RubyRequestTypes that
// are understood by the L1 Controller. A primary request type can be any
// RubyRequestType.
- enum {PrimaryType, SecondaryType};
- typedef std::pair<PacketPtr, std::vector<RubyRequestType> > RequestDesc;
- typedef std::unordered_map<Addr, std::vector<RequestDesc> > CoalescingTable;
+ typedef std::unordered_map<Addr, std::vector<RequestDesc>> CoalescingTable;
CoalescingTable reqCoalescer;
std::vector<Addr> newRequests;