Packet: Unify the use of PortID in packet and port
[gem5.git] / src / mem / packet_access.hh
index 552b6dd273d6d25885ce75ebcf83e85bf2673dfb..fca9606fc84a73273a4a3e54f96c9d8e0dedd98d 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "arch/isa_traits.hh"
 #include "base/bigint.hh"
+#include "config/the_isa.hh"
 #include "mem/packet.hh"
 #include "sim/byteswap.hh"
 
 // these functions and make the users do their own byte swapping since
 // the memory system does not in fact have an endianness.
 
-template<>
-inline Twin64_t
-Packet::get()
-{
-    Twin64_t d;
-    assert(staticData || dynamicData);
-    assert(sizeof(Twin64_t) <= size);
-    d.a = TheISA::gtoh(*(uint64_t*)data);
-    d.b = TheISA::gtoh(*((uint64_t*)data + 1));
-    return d;
-}
-
-template<>
-inline Twin32_t
-Packet::get()
-{
-    Twin32_t d;
-    assert(staticData || dynamicData);
-    assert(sizeof(Twin32_t) <= size);
-    d.a = TheISA::gtoh(*(uint32_t*)data);
-    d.b = TheISA::gtoh(*((uint32_t*)data + 1));
-    return d;
-}
-
-
 /** return the value of what is pointed to in the packet. */
 template <typename T>
 inline T
 Packet::get()
 {
-    assert(staticData || dynamicData);
+    assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA));
     assert(sizeof(T) <= size);
     return TheISA::gtoh(*(T*)data);
 }
@@ -81,6 +57,7 @@ template <typename T>
 inline void
 Packet::set(T v)
 {
+    assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA));
     assert(sizeof(T) <= size);
     *(T*)data = TheISA::htog(v);
 }