commit | 4e484ca33e7d751a76b00f4c27f55fd589962607 | [log] [tgz] |
---|---|---|
author | Hoa Nguyen <hoanguyen@ucdavis.edu> | Thu May 28 17:20:06 2020 -0700 |
committer | Bobby R. Bruce <bbruce@ucdavis.edu> | Mon Jun 01 19:40:49 2020 +0000 |
tree | 28e77741e6fa193502cc6b5db61b1ba303e5f08c | |
parent | b1b8af04439240c532d3530a02773b75b9853f77 [diff] |
python: Fix m5's tick rounding mechanism Partially reverts: https://gem5-review.googlesource.com/c/public/gem5/+/29372 where the `math.ceil` function was used to fix an issue where 0.5 was rounded to zero in python3. This has the side effect of giving incorrect clock frequences due to rounding errors. To demonstrate: ``` >>> import math >>> 1e-9*1000000000000 1000.0000000000001 >>> int(math.ceil(1e-9*1000000000000)) 1001 ``` The solution to this problem is to use Python's `decimal` module to round values. Issue-on: https://gem5.atlassian.net/browse/GEM5-616 Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Change-Id: Ic76736ccb4b6b8c037103a34493aff7d9731d314 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29577 Reviewed-by: Tiago Mück <tiago.muck@arm.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>