Fix and refactor conversion from double to uint64_t (fixes test br1029b on x86-64-v4)
#1264
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
When compiling with
-march=x86-64-v4or-march=znver4, test casebr1029bfail to pass. Based on PR #919 and discussion in #917, I think the followingiverilog/vvp/vthread.cc
Lines 2383 to 2386 in db82380
vpi_vthr_vector.ccandvthread.cc.This PR fixes:
<cmath>is already included in the code and I noticed that c++11 is in the default flags).vlg_round_to_u64to safely cast formdoubletouint64_tand reuse across files.vpi_callback.ccandvpi_vthr_vector.c.I have tested this PR locally on my x86 machine both with and without
-march=x86-64-v4. Test casebr1029bpasses in both configurations, and no regressions were introduced. It probably needs to be tested on other architectures as well but I don't have ARM machines at the moment.Please let me know if there are any comments and feel free to make edits.