cpu: Move the branch predictor out of the BaseCPU
authorAndreas Hansson <andreas.hansson@arm.com>
Wed, 4 Sep 2013 17:22:56 +0000 (13:22 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Wed, 4 Sep 2013 17:22:56 +0000 (13:22 -0400)
The branch predictor is guarded by having either the in-order or
out-of-order CPU as one of the available CPU models and therefore
should not be used in the BaseCPU. This patch moves the parameter to
the relevant CPU classes.

src/cpu/BaseCPU.py
src/cpu/inorder/InOrderCPU.py
src/cpu/o3/O3CPU.py

index 7ec79ad0ae7e61c6d50f8aa17a9b0da1f9b772cb..cd82207cd8a589725dd4816f591b25a3092b3fde 100644 (file)
@@ -51,7 +51,6 @@ from Bus import CoherentBus
 from InstTracer import InstTracer
 from ExeTracer import ExeTracer
 from MemObject import MemObject
-from BranchPredictor import BranchPredictor
 from ClockDomain import *
 
 default_tracer = ExeTracer()
@@ -210,8 +209,6 @@ class BaseCPU(MemObject):
     dcache_port = MasterPort("Data Port")
     _cached_ports = ['icache_port', 'dcache_port']
 
-    branchPred = Param.BranchPredictor(NULL, "Branch Predictor")
-
     if buildEnv['TARGET_ISA'] in ['x86', 'arm']:
         _cached_ports += ["itb.walker.port", "dtb.walker.port"]
 
index e29a29556bc6d10e658b45930698d2bc5b6bb6b1..4caf254c4ecb7939392947c844c240c5f4c12666 100644 (file)
@@ -68,4 +68,6 @@ class InOrderCPU(BaseCPU):
     div32Latency = Param.Cycles(1, "Latency for 32-bit Divide Operations")
     div32RepeatRate = Param.Cycles(1, "Repeat Rate for 32-bit Divide Operations")
 
-    branchPred = BranchPredictor(numThreads = Parent.numThreads)
+    branchPred = Param.BranchPredictor(BranchPredictor(numThreads =
+                                                       Parent.numThreads),
+                                       "Branch Predictor")
index f46388b4cfc921f0243ee552aebaccd497c4441a..e1988124813cc1b8aaae0c26504a9f1d7a628118 100644 (file)
@@ -125,7 +125,9 @@ class DerivO3CPU(BaseCPU):
     smtROBThreshold = Param.Int(100, "SMT ROB Threshold Sharing Parameter")
     smtCommitPolicy = Param.String('RoundRobin', "SMT Commit Policy")
 
-    branchPred = BranchPredictor(numThreads = Parent.numThreads)
+    branchPred = Param.BranchPredictor(BranchPredictor(numThreads =
+                                                       Parent.numThreads),
+                                       "Branch Predictor")
     needsTSO = Param.Bool(buildEnv['TARGET_ISA'] == 'x86',
                           "Enable TSO Memory model")