intel / intel/rohd

A type-safe mechanism to connect `PairInterface`s

Open
#613 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Dart
Stars
489
Forks
88
Avg merge
3d 23h
Merged PRs (30d)
10

Description

### Motivation

Currently, when you connect two modules with a `PairInterface`, they both receive an instance of the same `PairInterface` and call `pairConnectIO` with the appropriate `PairRole`. If both sides would like to play the same role, then you will not find out until runtime when signals on the interface find multiple drivers. It would be nice if we could statically resolve the role before runtime.

### Desired solution

Create a mechanism to "split" a `PairInterface` into two typed portions, so that arguments to the modules' constructors can specify the direction using the type.

For example something kind of like:
```dart
(PairProvider, PairConsumer) split(IntfType interface) { ... }
```

Where `PairProvider` and `PairConsumer` have references to (wrap) the original `interface`, but can then be used with some API in `Module` like `connectPairProvider` or `connectPairConsumer` that only accept the proper type and thus call `pairConnectIO` with the correct `PairRole`.

### Alternatives considered

_No response_

### Additional details

Thank you to @ethanuppal for the suggestion!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.