mem-garnet: Initialize unused Credit members
authorMichael LeBeane <Michael.Lebeane@amd.com>
Fri, 8 Mar 2019 19:12:36 +0000 (14:12 -0500)
committerSrikant Bharadwaj <srikant.bharadwaj@amd.com>
Fri, 4 Sep 2020 22:17:36 +0000 (22:17 +0000)
The Credit class doesn't initialize a number of its unused base class
fields.  This leads to non-determanistic traces when printing flits that
are Credits.  This patch initializes all unused fields to 0.

Change-Id: Ib73c652c71a10be57b24c0d6e1ac22eafa421e11
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32598
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>

src/mem/ruby/network/garnet2.0/CommonTypes.hh
src/mem/ruby/network/garnet2.0/Credit.cc

index 94aa600964bed69085b050965c3b3c19dc72da36..643ce8cda6d0570d33406b7b250a2c6ea7410b72 100644 (file)
@@ -46,6 +46,11 @@ enum RoutingAlgorithm { TABLE_ = 0, XY_ = 1, CUSTOM_ = 2,
 
 struct RouteInfo
 {
+    RouteInfo()
+        : vnet(0), src_ni(0), src_router(0), dest_ni(0), dest_router(0),
+          hops_traversed(0)
+    {}
+
     // destination format for table-based routing
     int vnet;
     NetDest net_dest;
index 3e56b4ed52ea913194b563cd075b0ff32e7a8f83..bde9484b8973e09936ff0365f8ccf4ddecf64c68 100644 (file)
 // and m_is_free_signal (whether VC is free or not)
 
 Credit::Credit(int vc, bool is_free_signal, Tick curTime)
+    : flit(0, vc, 0, RouteInfo(), 0, nullptr, 0, 0, curTime)
 {
-    m_id = 0;
-    m_vc = vc;
     m_is_free_signal = is_free_signal;
-    m_time = curTime;
     m_type = CREDIT_;
 }