Nikos Nikoleris has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/21079 )

Change subject: cpu: Fix checker cpu instantiation
......................................................................

cpu: Fix checker cpu instantiation

This change uses the params as instantiated from the default
constructor to create the checker cpu. If any of these parameters are
invalid for the checker cpu, the simulation will exit with a warning.

Change-Id: I0e58ed096c9ea5f413f2e9b64d8d184d9b0fc84e
Signed-off-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21079
Reviewed-by: Andreas Sandberg <andreas.sandb...@arm.com>
Maintainer: Andreas Sandberg <andreas.sandb...@arm.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/cpu/dummy_checker.cc
M src/cpu/o3/checker.cc
2 files changed, 16 insertions(+), 72 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/cpu/dummy_checker.cc b/src/cpu/dummy_checker.cc
index f9077be..c42c8b5 100644
--- a/src/cpu/dummy_checker.cc
+++ b/src/cpu/dummy_checker.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 ARM Limited
+ * Copyright (c) 2011, 2019 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -41,41 +41,15 @@

 #include "params/DummyChecker.hh"

-////////////////////////////////////////////////////////////////////////
-//
-//  DummyChecker Simulation Object
-//
 DummyChecker *
 DummyCheckerParams::create()
 {
-    DummyChecker::Params *params = new DummyChecker::Params();
-    params->name = name;
-    params->numThreads = numThreads;
-    params->max_insts_any_thread = 0;
-    params->max_insts_all_threads = 0;
-    params->max_loads_any_thread = 0;
-    params->max_loads_all_threads = 0;
-    params->clk_domain = clk_domain;
-    // Hack to touch all parameters.  Consider not deriving Checker
-    // from BaseCPU..it's not really a CPU in the end.
-    Counter temp;
-    temp = max_insts_any_thread;
-    temp = max_insts_all_threads;
-    temp = max_loads_any_thread;
-    temp = max_loads_all_threads;
-    temp++;
-    Tick temp2 = progress_interval;
-    params->progress_interval = 0;
-    temp2++;
+    // The checker should check all instructions executed by the main
+    // cpu and therefore any parameters for early exit don't make much
+    // sense.
+    fatal_if(max_insts_any_thread || max_insts_all_threads ||
+             max_loads_any_thread || max_loads_all_threads ||
+             progress_interval, "Invalid checker parameters");

-    params->itb = itb;
-    params->dtb = dtb;
-    params->isa = isa;
-    params->system = system;
-    params->cpu_id = cpu_id;
-    params->profile = profile;
-    params->workload = workload;
-
-    DummyChecker *cpu = new DummyChecker(params);
-    return cpu;
+    return new DummyChecker(this);
 }
diff --git a/src/cpu/o3/checker.cc b/src/cpu/o3/checker.cc
index 16c5a87..1713da7 100644
--- a/src/cpu/o3/checker.cc
+++ b/src/cpu/o3/checker.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 ARM Limited
+ * Copyright (c) 2011, 2019 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -48,45 +48,15 @@
 template
 class Checker<O3CPUImpl>;

-////////////////////////////////////////////////////////////////////////
-//
-//  CheckerCPU Simulation Object
-//
 O3Checker *
 O3CheckerParams::create()
 {
-    O3Checker::Params *params = new O3Checker::Params();
-    params->name = name;
-    params->numThreads = numThreads;
-    params->max_insts_any_thread = 0;
-    params->max_insts_all_threads = 0;
-    params->max_loads_any_thread = 0;
-    params->max_loads_all_threads = 0;
-    params->exitOnError = exitOnError;
-    params->updateOnError = updateOnError;
-    params->warnOnlyOnLoadError = warnOnlyOnLoadError;
-    params->clk_domain = clk_domain;
-    params->tracer = tracer;
-    // Hack to touch all parameters.  Consider not deriving Checker
-    // from BaseCPU..it's not really a CPU in the end.
-    Counter temp;
-    temp = max_insts_any_thread;
-    temp = max_insts_all_threads;
-    temp = max_loads_any_thread;
-    temp = max_loads_all_threads;
-    temp++;
-    Tick temp2 = progress_interval;
-    params->progress_interval = 0;
-    temp2++;
+    // The checker should check all instructions executed by the main
+    // cpu and therefore any parameters for early exit don't make much
+    // sense.
+    fatal_if(max_insts_any_thread || max_insts_all_threads ||
+             max_loads_any_thread || max_loads_all_threads ||
+             progress_interval, "Invalid checker parameters");

-    params->itb = itb;
-    params->dtb = dtb;
-    params->isa = isa;
-    params->system = system;
-    params->cpu_id = cpu_id;
-    params->profile = profile;
-    params->workload = workload;
-
-    O3Checker *cpu = new O3Checker(params);
-    return cpu;
+    return new O3Checker(this);
 }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/21079
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I0e58ed096c9ea5f413f2e9b64d8d184d9b0fc84e
Gerrit-Change-Number: 21079
Gerrit-PatchSet: 2
Gerrit-Owner: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to