Skip to content

Commit 1eac3ec

Browse files
committed
RFC #70: add starting date, answer resolved questions.
1 parent 74ec3f5 commit 1eac3ec

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

text/0070-soc-memory-map-names.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
- Start Date: (fill in with date at which the RFC is merged, YYYY-MM-DD)
2-
- RFC PR: [amaranth-lang/rfcs#0070](https://github.com/amaranth-lang/rfcs/pull/70)
3-
- Amaranth SoC Issue: [amaranth-lang/amaranth-soc#0000](https://github.com/amaranth-lang/amaranth-soc/issues/0000)
1+
- Start Date: 2024-06-28
2+
- RFC PR: [amaranth-lang/rfcs#70](https://github.com/amaranth-lang/rfcs/pull/70)
3+
- Amaranth SoC Issue: [amaranth-lang/amaranth-soc#93](https://github.com/amaranth-lang/amaranth-soc/issues/93)
44

55
# Unify the naming of `MemoryMap` resources and windows
66

@@ -34,13 +34,13 @@ Some examples:
3434

3535
```python3
3636
>>> MemoryMap.Name(("rx", "status"))
37-
('rx', 'status')
37+
Name('rx', 'status')
3838
>>> MemoryMap.Name(("uart", 0))
39-
('uart', 0)
40-
>>> MemoryMap.Name(MemoryMap.Name("uart", 0))
41-
('uart', 0)
39+
Name('uart', 0)
40+
>>> MemoryMap.Name(MemoryMap.Name(("uart", 0))
41+
Name('uart', 0)
4242
>>> MemoryMap.Name("foo")
43-
('foo',)
43+
Name('foo',)
4444
```
4545

4646
### Assigning resource names
@@ -133,12 +133,12 @@ In a `MemoryMap` hierarchy, each resource is identified by a path. The path of a
133133
```python3
134134
>>> for res_info in decoder.csr_bus.memory_map.all_resources():
135135
... print(res_info.path)
136-
(('uart', 0), ('rx', 'config'))
137-
(('uart', 0), ('rx', 'status'))
138-
(('uart', 0), ('rx', 'data'))
139-
(('uart', 1), ('rx', 'config'))
140-
(('uart', 1), ('rx', 'status'))
141-
(('uart', 1), ('rx', 'data'))
136+
(Name('uart', 0), Name('rx', 'config'))
137+
(Name('uart', 0), Name('rx', 'status'))
138+
(Name('uart', 0), Name('rx', 'data'))
139+
(Name('uart', 1), Name('rx', 'config'))
140+
(Name('uart', 1), Name('rx', 'status'))
141+
(Name('uart', 1), Name('rx', 'data'))
142142
```
143143

144144
## Reference-level explanation
@@ -183,20 +183,21 @@ As a consequence of this proposal, the following changes are made to other modul
183183
[rationale-and-alternatives]: #rationale-and-alternatives
184184

185185
- Providing a `MemoryMap.Name` class for resource and window names facilitates their validation and documentation.
186-
* Alternative #1: do not add a class, and use standard tuples instead. Names will have to be validated by other means.
187-
* Alternative #2: use `MemoryMap.Name` for resource names only. Window names remain limited to strings.
186+
* ~~Alternative #1: do not add a class, and use standard tuples instead. Names will have to be validated by other means.~~
187+
* ~~Alternative #2: use `MemoryMap.Name` for resource names only. Window names remain limited to strings.~~
188188

189189
## Prior art
190190
[prior-art]: #prior-art
191191

192192
- Resource names became tuples of strings as a consequence of [RFC 16](https://amaranth-lang.org/rfcs/0016-soc-csr-regs.html). However, array indices defined with `csr.Builder.Index()` were [cast to strings](https://github.com/amaranth-lang/amaranth-soc/issues/69) when `.as_memory_map()` was called.
193193

194-
## Unresolved questions
194+
## Resolved questions
195195
[unresolved-questions]: #unresolved-questions
196196

197197
- Should we require the presence of at least one string in `MemoryMap.Name` ?
198+
* Empty names are forbidden and transparent windows (i.e. without names) must use `None` instead. Further validation is deferred to consumers of the memory map (e.g. a BSP generator).
198199
- Should we specify the order between strings and integers ? In `csr.Builder`, array indices precede cluster and register names (e.g. `('bar', 0, 'foo')` could be formatted as `"bar.foo[0]"`).
199-
- Bikeshedding `MemoryMap.Name`.
200+
* No, this decision is left out to consumers of the memory map. They may interpret a name differently depending on what it is assigned to.
200201

201202
## Future possibilities
202203
[future-possibilities]: #future-possibilities

0 commit comments

Comments
 (0)