gpu-compute: Use dict.get syntax for accessing buildEnv keys
authorKyle Roarty <kyleroarty1716@gmail.com>
Mon, 30 Nov 2020 20:41:59 +0000 (14:41 -0600)
committerKyle Roarty <kyleroarty1716@gmail.com>
Tue, 1 Dec 2020 19:19:52 +0000 (19:19 +0000)
37775 removed SmartDict, which is the type buildEnv used to be.
Because of that change, doing buildEnv[key] with a key not in the dict
returns KeyError instead of False. By using buildEnv(key, False), we are
able to return False when the key isn't in the dict.

Change-Id: I4aae29b95b082efb2b021f21d608f9cd1c196379
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38135
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matthew Poremba <matthew.poremba@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/gpu-compute/X86GPUTLB.py

index fee9b9a9b9e764f1a53e94a2ee29a9afff8d7af8..7e5d93222b13284b74efd61f67dd8400f2d37727 100644 (file)
@@ -36,7 +36,7 @@ from m5.proxy import *
 from m5.objects.ClockedObject import ClockedObject
 from m5.SimObject import SimObject
 
-if buildEnv['FULL_SYSTEM']:
+if buildEnv.get('FULL_SYSTEM', False):
     class X86PagetableWalker(SimObject):
         type = 'X86PagetableWalker'
         cxx_class = 'X86ISA::Walker'
@@ -50,7 +50,7 @@ class X86GPUTLB(ClockedObject):
     size = Param.Int(64, "TLB size (number of entries)")
     assoc = Param.Int(64, "TLB associativity")
 
-    if buildEnv['FULL_SYSTEM']:
+    if buildEnv.get('FULL_SYSTEM', False):
         walker = Param.X86PagetableWalker(X86PagetableWalker(),
                                           "page table walker")