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

add resource helpers for USB (direct+ULPI) #86

Merged
merged 1 commit into from Jul 19, 2020

Conversation

@ktemkin
Copy link
Contributor

@ktemkin ktemkin commented Jul 19, 2020

These resource helpers are in the format accepted by e.g. LUNA, and should help to standardize USB pin naming. :)

[Forgive my earlier failure to pull request; I am apparently too tired to use {git, github} properly.]

if pullup:
io.append(Subsignal("pullup", Pins(pullup, dir="o", conn=conn, assert_width=1)))
if vbus_valid:
io.append(Subsignal("vbus_valid", Pins(pullup, dir="i", conn=conn, assert_width=1)))
Copy link
Member

@whitequark whitequark Jul 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

Suggested change
io.append(Subsignal("vbus_valid", Pins(pullup, dir="i", conn=conn, assert_width=1)))
io.append(Subsignal("vbus_valid", Pins(vbus_valid, dir="i", conn=conn, assert_width=1)))

I'd also probably call it something like vbus_detect but this isn't important.

Copy link
Contributor Author

@ktemkin ktemkin Jul 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VbusValid is what UTMI/ULPI call it, so it makes sense not to come up with our own name. (It's ideally to be the output of a level comparator, even if it's often not in practice.)

Copy link
Member

@whitequark whitequark Jul 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good then.


def ULPIResource(*args, data, clk, dir, nxt, stp, rst=None,
clk_out=False, attrs=None, conn=None):
clock_dir = "o" if clk_out else "i"
Copy link
Member

@whitequark whitequark Jul 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably specify clk_dir directly rather than going through a (small) layer of indirection.

@ktemkin ktemkin force-pushed the add_usb_resource branch from 968c81e to 3dbfa0d Jul 19, 2020
@ktemkin ktemkin force-pushed the add_usb_resource branch from 3dbfa0d to 177be66 Jul 19, 2020
@whitequark whitequark merged commit dd0bb11 into amaranth-lang:master Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants