Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sim: represent time internally as 1ps units #651

Merged
merged 1 commit into from Dec 13, 2021

Conversation

modwizcode
Copy link
Contributor

@modwizcode modwizcode commented Dec 13, 2021

Actually represent time internally without using floating point numbers.

This is mostly important for after simulation API changes result in an API that allows user facing code to specify these parameters in exact units as well, however for now we don't wish to have a breaking change before this new API is defined.

This will make that change far more trivial and has already been tested.

Fixes #535.

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2021

Codecov Report

Merging #651 (2648c34) into main (0b74d1c) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #651      +/-   ##
==========================================
- Coverage   81.53%   81.47%   -0.07%     
==========================================
  Files          49       49              
  Lines        6468     6467       -1     
  Branches     1531     1531              
==========================================
- Hits         5274     5269       -5     
- Misses       1002     1005       +3     
- Partials      192      193       +1     
Impacted Files Coverage Δ
amaranth/sim/_pyclock.py 100.00% <100.00%> (ø)
amaranth/sim/_pycoro.py 80.00% <100.00%> (+0.23%) ⬆️
amaranth/sim/core.py 83.67% <100.00%> (+0.34%) ⬆️
amaranth/sim/pysim.py 93.17% <100.00%> (-0.11%) ⬇️
amaranth/tracer.py 89.18% <0.00%> (-5.41%) ⬇️
amaranth/_toolchain/cxx.py 95.12% <0.00%> (-4.88%) ⬇️
amaranth/lib/cdc.py 90.58% <0.00%> (ø)
amaranth/lib/fifo.py 94.08% <0.00%> (ø)
amaranth/build/run.py 22.05% <0.00%> (ø)
amaranth/lib/coding.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b74d1c...2648c34. Read the comment docs.

amaranth/sim/core.py Outdated Show resolved Hide resolved
@modwizcode modwizcode force-pushed the fix-538 branch 4 times, most recently from e0fc3bd to 1201252 Compare Dec 13, 2021
@modwizcode modwizcode changed the title sim: represent time internally as 100ps units sim: represent time internally as 1ps units Dec 13, 2021
Using floats to represent simulation time internally isn't ideal
instead use 1ps internal units while continuing to use a floating
point based interface for compatibility.

Fixes amaranth-lang#535.
Copy link
Member

@whitequark whitequark left a comment

LGTM

@whitequark whitequark enabled auto-merge (rebase) Dec 13, 2021
@whitequark
Copy link
Member

whitequark commented Dec 13, 2021

Thank you!

@whitequark whitequark merged commit 1ee2482 into amaranth-lang:main Dec 13, 2021
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants