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

Wrong number of pins reported when the direction is "io" #397

Closed
jeanthom opened this issue Jun 3, 2020 · 3 comments
Closed

Wrong number of pins reported when the direction is "io" #397

jeanthom opened this issue Jun 3, 2020 · 3 comments
Labels

Comments

@jeanthom
Copy link

jeanthom commented Jun 3, 2020

Hi,

I just came across a bug that causes nMigen to report the wrong number of pins when the direction of the pins is set to bidirectional.

Test code:

from nmigen import *
from nmigen_boards.arty_a7 import ArtyA7Platform

platform = ArtyA7Platform()
ram = platform.request("ddr3", 0)

print("Number of DQ signals:", len(ram.dq)) # DQ is "io"
print("Number of A signals:", len(ram.a)) # A is output only

Result:

Number of DQ signals: 33
Number of A signals: 14

What I was expecting:

Number of DQ signals: 16
Number of A signals: 14
@whitequark
Copy link
Member

whitequark commented Jun 3, 2020

You should never use attributes of the object returned by platform.request directly. Instead, use ram.x.i for inputs or inouts, ram.x.o for outputs or inouts, and ram.x.oe for inouts.

@jeanthom
Copy link
Author

jeanthom commented Jun 3, 2020

Ok, I will use .i/.o/.oe instead.

@jeanthom jeanthom closed this as completed Jun 3, 2020
@whitequark
Copy link
Member

whitequark commented Jun 3, 2020

FWIW, this is a footgun I'm aware of and I have plans to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants