Skip to content

Commit dbb347f

Browse files
committed
RFC #66: Expand scope to also cover platform code dealing with clock constraints.
1 parent 52efa4d commit dbb347f

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

text/0066-simulation-time.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Summary
88
[summary]: #summary
99

10-
Add a type for representing time durations and simulator methods to query the elapsed time.
10+
Add a type for representing time durations (including clock periods) and simulator methods to query the elapsed time.
1111

1212
## Motivation
1313
[motivation]: #motivation
@@ -21,7 +21,7 @@ Also, to quote @whitequark: Time is not a number.
2121
## Guide- and reference-level explanation
2222
[guide-level-explanation]: #guide-level-explanation
2323

24-
A new type `amaranth.sim.Period` is introduced.
24+
A new type `Period` is introduced.
2525
It is immutable, has no public constructor and is instead constructed through the following classmethods:
2626
- `.s(duration: numbers.Real)`
2727
- `.ms(duration: numbers.Real)`
@@ -69,16 +69,25 @@ The following operators are defined:
6969

7070
`Simulator` and `SimulatorContext` both have a `.time() -> Period` method added that returns the elapsed time since start of simulation.
7171

72-
The methods that currently take seconds as a `float` are updated to take a `Period`:
73-
- `.add_clock()`
74-
- `.delay()`
72+
These methods that has a `period` argument currently taking seconds as a `float` are updated to take a `Period`:
73+
- `Simulator.add_clock()`
74+
- `SimulatorContext.delay()`
75+
76+
These methods that has a `frequency` argument currently taking Hz as a `float` are updated to take a `Period`:
77+
- `ResourceManager.add_clock_constraint()`
78+
- `Clock.__init__()`
79+
80+
The ability to pass seconds or Hz directly as a `float` is deprecated and removed in a future Amaranth version.
81+
82+
The `Clock.period` property is updated to return a `Period` and the `Clock.frequency` property is deprecated.
83+
84+
Consequently, `Platform.default_clk_frequency()` is also deprecated and replaced with a new method `Platform.default_clk_period() -> Period`.
7585

76-
The ability to pass seconds as a `float` is deprecated and removed in a future Amaranth version.
7786

7887
## Drawbacks
7988
[drawbacks]: #drawbacks
8089

81-
- Deprecating being able to pass seconds as a `float` creates churn.
90+
- Deprecating being able to pass seconds or Hz directly as a `float` creates churn.
8291

8392
## Rationale and alternatives
8493
[rationale-and-alternatives]: #rationale-and-alternatives
@@ -110,9 +119,13 @@ None.
110119
## Unresolved questions
111120
[unresolved-questions]: #unresolved-questions
112121

122+
- With the scope of `Period` extended beyond simulation, where do we put it?
123+
113124
- The usual bikeshedding.
114125
- Case, e.g. `.MHz` vs `.mhz`.
115126

127+
- Should `Period` also have properties to return the reciprocal frequency?
128+
116129
## Future possibilities
117130
[future-possibilities]: #future-possibilities
118131

0 commit comments

Comments
 (0)