Skip to content

Commit 412039a

Browse files
committed
Add RFC for renaming reset= to init=.
1 parent e10875b commit 412039a

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

text/0043-rename-reset-to-init.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
- Start Date: 2024-02-12
2+
- RFC PR: [amaranth-lang/rfcs#43](https://github.com/amaranth-lang/rfcs/pull/43)
3+
- Amaranth Issue: [amaranth-lang/amaranth#1110](https://github.com/amaranth-lang/amaranth/issues/1110)
4+
5+
# Rename `reset=` to `init=`
6+
7+
## Summary
8+
[summary]: #summary
9+
10+
Rename the `reset=` keyword argument to `init=` in `Signal()`, `In()`, `Out()`, `Memory()`, etc.
11+
12+
## Motivation
13+
[motivation]: #motivation
14+
15+
The value specified by the `reset=` keyword argument is called an "initial value" in our language guide, never a "reset value", because when the signal is driven combinatorially, it does not get *reset* to that value (as it holds no state), but rather *initialized* to that value whenever the value of the signal is computed.
16+
17+
Calling it a "reset value" (even implicitly, by the name of the keyword argument) makes teaching Amaranth more difficult and is a point of confusion. All of our documentation already has to carefully avoid calling it a "reset value", and similarly, any Amaranth experts would have to avoid that in speech. Tutorial authors [have to call it out explicitly](https://github.com/RobertBaruch/amaranth-tutorial/blob/6a7ebe9cb3b904177df876df01552099e89c031f/3_modules.md#resetdefault-values-for-signals).
18+
19+
`Memory` already does not have a `reset=` argument or accessor; it uses `init=`. `Memory` should be consistent with `Signal`.
20+
21+
## Guide-level explanation
22+
[guide-level-explanation]: #guide-level-explanation
23+
24+
All instances of `reset=` keyword argument in Amaranth are changed to use `init=`. `reset_less=`, `async_reset=`, etc remain as they are. Using `reset=` raises a deprecation warning but continues working for a long time, perhaps Amaranth 1.0.
25+
26+
## Reference-level explanation
27+
[reference-level-explanation]: #reference-level-explanation
28+
29+
The following entry points have their `reset=` argument and attribute changed to `init=`:
30+
- `Signal(reset=)`
31+
- `Signal.like(reset=)`
32+
- `with m.FSM(reset=):`
33+
- `FFSynchronizer(reset=)`
34+
- `Member(reset=)` (which handles `In(reset=)`, `Out(reset=)`)
35+
36+
Specifically:
37+
- At most one of `init=` and `reset=` keyword arguments are accepted. Using `reset=` prints a deprecation warning. The semantics is exactly the same.
38+
- Wherever there was an accessible `.reset` attribute, a getter and a setter are provided that read/write `.init`.
39+
- No specific deprecation timeline is established, unlike with many other features. We could do this, perhaps, in two years, or by Amaranth 1.0.
40+
41+
## Drawbacks
42+
[drawbacks]: #drawbacks
43+
44+
Churn.
45+
46+
## Rationale and alternatives
47+
[rationale-and-alternatives]: #rationale-and-alternatives
48+
49+
The primary alternative is to not do this. Amaranth is steadily gaining popularity, so the earlier we do it the better.
50+
51+
There are no good alternatives to the `init=` name, especially given our already written documentation and its use for `Memory`.
52+
53+
## Prior art
54+
[prior-art]: #prior-art
55+
56+
Verilog has `initial x = 1;`, though that does not result in a reset being inferred.
57+
58+
## Unresolved questions
59+
[unresolved-questions]: #unresolved-questions
60+
61+
When exactly do we remove `reset=`? It seems valuable to do it as late as possible to minimize breakage of lightly maintained Amaranth code.
62+
63+
## Future possibilities
64+
[future-possibilities]: #future-possibilities
65+
66+
None.

0 commit comments

Comments
 (0)