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

Specifying logical signal direction for ports of an elaboratable #243

Open
Ravenslofty opened this issue Sep 30, 2019 · 1 comment
Open
Labels

Comments

@Ravenslofty
Copy link
Contributor

This came up on IRC a while back, and I thought I'd write it down for the sake of posterity.

Signals should have an optional must_read and must_write parameter for linting purposes. This would be used to mark Signals intended for external use by other Elaboratables, and warn (error?) when they are not used correctly; for example, a FIFO's input would be marked must_write and its output would be marked must_read, because if the input was not written to, or the output not read from, the FIFO would be useless.

I would suggest semantics for these as must_read and must_write producing a warning if they are never used as the source, or destination of a connection between Signals (I don't know the nMigen term for this).

Perhaps one could go further and warn if an Elaboratable does not declare any of its Signals must_read or must_write, as their linting purpose is unhelpful if all signals are optional. This would likely be quite noisy on an established nMigen codebase however.

@whitequark
Copy link
Contributor

I think attaching these attributes to Signals is probably not the right approach. I think it makes more sense to attach them to Elaboratables, perhaps as Python 3.7 type annotations, such that documentation can take those into account where currently Signal, in is written explicitly. This feature should also interact with #213.

@whitequark whitequark changed the title RFC: must_read/must_write attributes for Signals Specifying logical signal direction for ports of an elaboratable Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants