From a8eb5b18e06c1304ac0bc7e5929c57a1cfaacda1 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Mon, 28 Jan 2013 06:14:18 -0600 Subject: [PATCH] ruby: remove get_time() This patch replaces get_time() in *.sm files with curCycle() which is now possible since controllers are clocked objects. --- src/mem/protocol/MOESI_CMP_token-L1cache.sm | 5 +++-- src/mem/protocol/MOESI_hammer-cache.sm | 11 ++++++----- src/mem/protocol/MOESI_hammer-dir.sm | 19 ++++++++++--------- src/mem/protocol/RubySlicc_Util.sm | 1 - .../ruby/slicc_interface/RubySlicc_Util.hh | 6 ------ 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/mem/protocol/MOESI_CMP_token-L1cache.sm b/src/mem/protocol/MOESI_CMP_token-L1cache.sm index a5de5e832..5533a34dc 100644 --- a/src/mem/protocol/MOESI_CMP_token-L1cache.sm +++ b/src/mem/protocol/MOESI_CMP_token-L1cache.sm @@ -179,6 +179,7 @@ machine(L1Cache, "Token protocol") void unset_tbe(); void wakeUpAllBuffers(); void wakeUpBuffers(Address a); + Time curCycle(); TBETable L1_TBEs, template="", constructor="m_number_of_TBEs"; @@ -1344,7 +1345,7 @@ machine(L1Cache, "Token protocol") tbe.Prefetch := in_msg.Prefetch; tbe.AccessMode := in_msg.AccessMode; } - tbe.IssueTime := get_time(); + tbe.IssueTime := curCycle(); } action(ta_traceStalledAddress, "ta", desc="Trace Stalled Address") { @@ -1447,7 +1448,7 @@ machine(L1Cache, "Token protocol") // Update average latency if (tbe.IssueCount <= 1) { if (tbe.ExternalResponse == true) { - updateAverageLatencyEstimate(time_to_int(get_time()) - time_to_int(tbe.IssueTime)); + updateAverageLatencyEstimate(time_to_int(curCycle()) - time_to_int(tbe.IssueTime)); } } diff --git a/src/mem/protocol/MOESI_hammer-cache.sm b/src/mem/protocol/MOESI_hammer-cache.sm index 0f35b4277..e4d01df65 100644 --- a/src/mem/protocol/MOESI_hammer-cache.sm +++ b/src/mem/protocol/MOESI_hammer-cache.sm @@ -181,6 +181,7 @@ machine(L1Cache, "AMD Hammer-like protocol") void unset_tbe(); void wakeUpAllBuffers(); void wakeUpBuffers(Address a); + Time curCycle(); Entry getCacheEntry(Address address), return_by_pointer="yes" { Entry L2cache_entry := static_cast(Entry, "pointer", L2cacheMemory.lookup(address)); @@ -545,7 +546,7 @@ machine(L1Cache, "AMD Hammer-like protocol") out_msg.Requestor := machineID; out_msg.Destination.add(map_Address_to_Directory(address)); out_msg.MessageSize := MessageSizeType:Request_Control; - out_msg.InitialRequestTime := get_time(); + out_msg.InitialRequestTime := curCycle(); tbe.NumPendingMsgs := machineCount(MachineType:L1Cache); // One from each other cache (n-1) plus the memory (+1) } } @@ -558,7 +559,7 @@ machine(L1Cache, "AMD Hammer-like protocol") out_msg.Requestor := machineID; out_msg.Destination.add(map_Address_to_Directory(address)); out_msg.MessageSize := MessageSizeType:Request_Control; - out_msg.InitialRequestTime := get_time(); + out_msg.InitialRequestTime := curCycle(); tbe.NumPendingMsgs := machineCount(MachineType:L1Cache); // One from each other cache (n-1) plus the memory (+1) } } @@ -572,7 +573,7 @@ machine(L1Cache, "AMD Hammer-like protocol") out_msg.Requestor := machineID; out_msg.Destination.add(map_Address_to_Directory(address)); out_msg.MessageSize := MessageSizeType:Request_Control; - out_msg.InitialRequestTime := get_time(); + out_msg.InitialRequestTime := curCycle(); } } tbe.NumPendingMsgs := machineCount(MachineType:L1Cache); // One from each other cache (n-1) plus the memory (+1) @@ -586,7 +587,7 @@ machine(L1Cache, "AMD Hammer-like protocol") out_msg.Requestor := machineID; out_msg.Destination.add(map_Address_to_Directory(address)); out_msg.MessageSize := MessageSizeType:Request_Control; - out_msg.InitialRequestTime := get_time(); + out_msg.InitialRequestTime := curCycle(); tbe.NumPendingMsgs := machineCount(MachineType:L1Cache); // One from each other cache (n-1) plus the memory (+1) } } @@ -982,7 +983,7 @@ machine(L1Cache, "AMD Hammer-like protocol") tbe.ForwardRequestTime := in_msg.ForwardRequestTime; } if (tbe.FirstResponseTime == zero_time()) { - tbe.FirstResponseTime := get_time(); + tbe.FirstResponseTime := curCycle(); } } } diff --git a/src/mem/protocol/MOESI_hammer-dir.sm b/src/mem/protocol/MOESI_hammer-dir.sm index 5b752f781..f923ddeab 100644 --- a/src/mem/protocol/MOESI_hammer-dir.sm +++ b/src/mem/protocol/MOESI_hammer-dir.sm @@ -179,6 +179,7 @@ machine(Directory, "AMD Hammer-like protocol") void set_tbe(TBE a); void unset_tbe(); void wakeUpBuffers(Address a); + Time curCycle(); // ** OBJECTS ** @@ -877,7 +878,7 @@ machine(Directory, "AMD Hammer-like protocol") out_msg.Destination.setNetDest(MachineType:L1Cache, fwd_set); out_msg.MessageSize := MessageSizeType:Multicast_Control; out_msg.InitialRequestTime := in_msg.InitialRequestTime; - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); assert(tbe.SilentAcks > 0); out_msg.SilentAcks := tbe.SilentAcks; } @@ -893,7 +894,7 @@ machine(Directory, "AMD Hammer-like protocol") out_msg.Destination.remove(in_msg.Requestor); // Don't include the original requestor out_msg.MessageSize := MessageSizeType:Broadcast_Control; out_msg.InitialRequestTime := in_msg.InitialRequestTime; - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); } } } @@ -953,7 +954,7 @@ machine(Directory, "AMD Hammer-like protocol") out_msg.Destination.setNetDest(MachineType:L1Cache, fwd_set); out_msg.MessageSize := MessageSizeType:Multicast_Control; out_msg.InitialRequestTime := in_msg.InitialRequestTime; - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); out_msg.SilentAcks := machineCount(MachineType:L1Cache) - fwd_set.count(); out_msg.SilentAcks := out_msg.SilentAcks - 1; } @@ -967,7 +968,7 @@ machine(Directory, "AMD Hammer-like protocol") out_msg.Destination.remove(in_msg.Requestor); // Don't include the original requestor out_msg.MessageSize := MessageSizeType:Broadcast_Control; out_msg.InitialRequestTime := in_msg.InitialRequestTime; - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); } } } @@ -1007,7 +1008,7 @@ machine(Directory, "AMD Hammer-like protocol") } out_msg.MessageSize := MessageSizeType:Request_Control; out_msg.InitialRequestTime := zero_time(); - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); } } } @@ -1025,7 +1026,7 @@ machine(Directory, "AMD Hammer-like protocol") out_msg.MessageSize := MessageSizeType:Request_Control; out_msg.DirectedProbe := true; out_msg.InitialRequestTime := in_msg.InitialRequestTime; - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); } } } else { @@ -1038,7 +1039,7 @@ machine(Directory, "AMD Hammer-like protocol") out_msg.Destination.remove(in_msg.Requestor); // Don't include the original requestor out_msg.MessageSize := MessageSizeType:Broadcast_Control; out_msg.InitialRequestTime := in_msg.InitialRequestTime; - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); } } } @@ -1059,7 +1060,7 @@ machine(Directory, "AMD Hammer-like protocol") out_msg.MessageSize := MessageSizeType:Request_Control; out_msg.DirectedProbe := true; out_msg.InitialRequestTime := in_msg.InitialRequestTime; - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); } } } @@ -1073,7 +1074,7 @@ machine(Directory, "AMD Hammer-like protocol") out_msg.Destination.remove(in_msg.Requestor); // Don't include the original requestor out_msg.MessageSize := MessageSizeType:Broadcast_Control; out_msg.InitialRequestTime := in_msg.InitialRequestTime; - out_msg.ForwardRequestTime := get_time(); + out_msg.ForwardRequestTime := curCycle(); } } } diff --git a/src/mem/protocol/RubySlicc_Util.sm b/src/mem/protocol/RubySlicc_Util.sm index e5ef7ca8d..65f47d5aa 100644 --- a/src/mem/protocol/RubySlicc_Util.sm +++ b/src/mem/protocol/RubySlicc_Util.sm @@ -32,7 +32,6 @@ void error(std::string msg); void assert(bool condition); int random(int number); -Time get_time(); Time zero_time(); NodeID intToID(int nodenum); int IDToInt(NodeID id); diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh index 178c4cd1e..f55b6eae4 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh @@ -47,12 +47,6 @@ random(int n) return random() % n; } -inline Time -get_time() -{ - return g_system_ptr->getTime(); -} - inline Time zero_time() { -- 2.30.2