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

MemoryMap.add_resource() should support integers in resource names #69

Closed
jfng opened this issue Feb 9, 2024 · 0 comments · Fixed by #95
Closed

MemoryMap.add_resource() should support integers in resource names #69

jfng opened this issue Feb 9, 2024 · 0 comments · Fixed by #95
Assignees
Labels

Comments

@jfng
Copy link
Member

jfng commented Feb 9, 2024

Currently, csr.Builder works around this by casting array indices to strings calling MemoryMap.add_resource().

Repro:

from amaranth import *
from amaranth_soc import csr

class FooRegister(csr.Register, access="r"):
    a: csr.Field(csr.action.R, unsigned(8))

regs = csr.Builder(addr_width=1, data_width=8)

for n in range(2):
    with regs.Index(n):
        regs.add("foo", FooRegister())

for reg, reg_name, reg_range in regs.as_memory_map().resources():
    print(reg_name)

Current output:

('0', 'foo')
('1', 'foo')

Expected output:

(0, 'foo')
(1, 'foo')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant