From e48bcb706d99826da358585d7ce878ac86583652 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Mon, 15 Feb 2021 15:19:22 +0000 Subject: [PATCH] sim: Fix initialization of ticksClkGated distribution The third init argument is the bucket size. This should be evaluated according to the following formula: bucket size = (max - min + 1.0) / #buckets Current initialization is not taking into considering the minimum value (and the +1 offset) Change-Id: Ie4b8dd7e26d3db60288ab1715ff1b7f0f4fe419e Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41413 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/sim/power_state.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sim/power_state.cc b/src/sim/power_state.cc index a12e247707..8281d2f6c1 100644 --- a/src/sim/power_state.cc +++ b/src/sim/power_state.cc @@ -245,7 +245,8 @@ PowerState::PowerStateStats::regStats() // Each sample is time in ticks unsigned num_bins = std::max(p.clk_gate_bins, 10U); ticksClkGated - .init(p.clk_gate_min, p.clk_gate_max, (p.clk_gate_max / num_bins)) + .init(p.clk_gate_min, p.clk_gate_max, + (p.clk_gate_max - p.clk_gate_min + 1.0) / num_bins) .flags(pdf | nozero | nonan) ;