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

DigitalSource should include open-drain? #335

Open
ducky64 opened this issue Apr 5, 2024 · 0 comments
Open

DigitalSource should include open-drain? #335

ducky64 opened this issue Apr 5, 2024 · 0 comments

Comments

@ducky64
Copy link
Collaborator

ducky64 commented Apr 5, 2024

Instead of a separate DigitalSingleSource, DigitalSource could model high_drive and low_drive, allowing for up to two DigitalSources. This would allow a common interface for devices that can be push-pull or open-drain, eg comparators. Could also simplify the DigitalLink definition slightly with less ports and constraints.

Modeling is that a DigitalSource is always driven (high, low, or both - as defined on the port) and must not conflict with another DigitalSource (at most one high DigitalSource and at most one low DigitalSource per Link), while DigitalBidir is optionally driven and may conflict with another Bidir or Source. Sources can also model pullup/down (?), which will not conflict with another Source. Sources may not read the line and do not model input thresholds.

Downside is that designs become less abstract, since where the IO is open-drain (depending on refinement part) it will need external resistors. But fundamentally you'd need that anyways, the alternative is perhaps the less clean e.g. ComparatorOpenDrain and ComparatorPushPull, or some weirdness of the above with mixins.

This could be implemented as DigitalSource.open_drain(...) and/or DigitalSource.open_drain_from_supply(...). The vanilla DigitalSource.from_supply(...) generates a push-pull IO.

Downside is that for single-sources, it would also need to model limits, so all DigitalSource may need to model limits (even if they're effectively nop/inf for push-pull devices)

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

No branches or pull requests

1 participant