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 concrete type definitions #51

Open
johanpel opened this issue Mar 25, 2020 · 0 comments
Open

Add concrete type definitions #51

johanpel opened this issue Mar 25, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@johanpel
Copy link
Member

Currently, Streamlet Definition Files support only the declaration of multiple streamlets as such:

Streamlet foo (
  x : in Stream<Bits<2>>,
  y : out Stream<Bits<2>>
)

Streamlet bar ...

In the internals of the generator tooling, one file is parsed to one library, containing the declared streamlets.

It would be nice to be able to define types, and use them across multiple libraries that reside in a single project.
Since the files do not only contain streamlet declarations, it would be nice to rename the files to .tydi file, and then be able to type something like the following.

For example, in some file: mills.tydi

type Wheat = Stream<Bits<1>>;
type Flour = Stream<Bits<4>>;

Streamlet windmill (
  wheat : in Wheat,
  flour : out Flour
)

And another file: bakery.tydi

use mills::Flour;

type Cookie = Stream<Bits<1>>;

Streamlet bakery (
  flour : in Flour,
  cookie : out Cookie
)

This means the type of the interfaces windmill.flour and bakery.flour are equal (their in/out mode is not part of the type), and can be connected if their mode corresponds accordingly.

However windmill.wheat and bakery.cookie do not have the same types. In other words, the windmill outputs the exact same type of Flour that the bakery can use as input, but Wheat is not a Cookie.

@johanpel johanpel added the enhancement New feature or request label Mar 25, 2020
@mbrobbel mbrobbel mentioned this issue Jul 14, 2020
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants