From b72246d0ef1bf4e52e4e362e633f026382eebedb Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Thu, 26 Nov 2020 10:42:16 +0000 Subject: [PATCH] cpu: MinorCPU not updating cycle counter value By not updating the cycle counter value for every tick in the MinorCPU meant that a read to the associated performance counter was always returning 0. For more info check the following email thread in gem5-users: https://www.mail-archive.com/gem5-users@gem5.org/msg18742.html Change-Id: Ibc033b536669cbb43d40c8a7c0659eb5565bdf93 Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38095 Tested-by: kokoro Reviewed-by: Gabe Black Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/cpu/minor/cpu.hh | 8 +++++++- src/cpu/minor/pipeline.cc | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cpu/minor/cpu.hh b/src/cpu/minor/cpu.hh index 0e919f332..1e8465656 100644 --- a/src/cpu/minor/cpu.hh +++ b/src/cpu/minor/cpu.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2014 ARM Limited + * Copyright (c) 2012-2014, 2020 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -181,6 +181,12 @@ class MinorCPU : public BaseCPU return prio_list; } + /** The tick method in the MinorCPU is simply updating the cycle + * counters as the ticking of the pipeline stages is already + * handled by the Pipeline object. + */ + void tick() { updateCycleCounters(BaseCPU::CPU_STATE_ON); } + /** Interface for stages to signal that they have become active after * a callback or eventq event where the pipeline itself may have * already been idled. The stage argument should be from the diff --git a/src/cpu/minor/pipeline.cc b/src/cpu/minor/pipeline.cc index 78c202062..3997c89c1 100644 --- a/src/cpu/minor/pipeline.cc +++ b/src/cpu/minor/pipeline.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014 ARM Limited + * Copyright (c) 2013-2014, 2020 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -121,6 +121,9 @@ Pipeline::minorTrace() const void Pipeline::evaluate() { + /** We tick the CPU to update the BaseCPU cycle counters */ + cpu.tick(); + /* Note that it's important to evaluate the stages in order to allow * 'immediate', 0-time-offset TimeBuffer activity to be visible from * later stages to earlier ones in the same cycle */ -- 2.30.2