Skip to content

RFC #77: Stream port name conventions. #77

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions text/0077-stream-port-name-conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
- Start Date: (fill in with date at which the RFC is merged, YYYY-MM-DD)
- RFC PR: [amaranth-lang/rfcs#77](https://github.com/amaranth-lang/rfcs/pull/77)
- Amaranth Issue: [amaranth-lang/amaranth#0000](https://github.com/amaranth-lang/amaranth/issues/0000)

# Stream port name conventions

## Summary
[summary]: #summary

Settle on and document name conventions for stream components.

## Motivation
[motivation]: #motivation

Having a name convention for stream ports makes stream components easier to work with and allows automating the connection of pipelines like this:

```
pipeline = [component_a, component_b, component_c]
for upstream, downstream in itertools.pairwise(pipeline):
wiring.connect(m, upstream.output, downstream.input)
```

## Guide- and reference-level explanation
[guide-level-explanation]: #guide-level-explanation

Document the following conventions:

- When a component has a single primary input stream, the port should be named *TBD*.
- When a component has a single primary output stream, the port should be named *TBD*.

Update existing stream components to follow these conventions.

## Drawbacks
[drawbacks]: #drawbacks

None.

## Rationale and alternatives
[rationale-and-alternatives]: #rationale-and-alternatives

Without a common convention, components will be written with different naming schemes, requiring more care when interconnecting them.

## Prior art
[prior-art]: #prior-art

Stream ports in LiteX components are conventionally named `sink` and `source`.

## Unresolved questions
[unresolved-questions]: #unresolved-questions

- Which exact names should we settle on?
- `i` / `o`
- `input` / `output`
- `w_stream` / `r_stream`
- `sink` / `source`
- Others?

## Future possibilities
[future-possibilities]: #future-possibilities

A `connect_pipeline()` function can be added that takes an iterable of components and connects them in sequence like shown above.