mem-ruby: Check number of vnets when creating links
authorMichael Boyer <Michael.Boyer@amd.com>
Tue, 28 Apr 2020 18:02:41 +0000 (14:02 -0400)
committerSrikant Bharadwaj <srikant.bharadwaj@amd.com>
Tue, 8 Sep 2020 22:09:23 +0000 (22:09 +0000)
Added error checking to ensure that the system has sufficient virtual
networks when setting latency and weight values.

Change-Id: I1b28144bbe9fefab0c0a6227f1fdf4ea10403061
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32603
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/Topology.cc

index 13219a54762945f223e446b6af79d7bf138299c5..c9a5811065ca5a34d764a6d3dd8673ba5ac462ac 100644 (file)
@@ -163,6 +163,8 @@ Topology::createLinks(Network *net)
             } else {
                 for (int v = 0; v < link->mVnets.size(); v++) {
                     int vnet = link->mVnets[v];
+                    fatal_if(vnet >= m_vnets, "Not enough virtual networks "
+                             "(setting latency and weight for vnet %d)", vnet);
                     // Two links connecting same src and destination
                     // cannot carry same vnets.
                     fatal_if(vnet_done[vnet], "Two links connecting same src"