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

[Feature] pacakge generic boundary #1223

Open
taichi-ishitani opened this issue Feb 4, 2025 · 1 comment
Open

[Feature] pacakge generic boundary #1223

taichi-ishitani opened this issue Feb 4, 2025 · 1 comment
Labels
lang Language design

Comments

@taichi-ishitani
Copy link
Contributor

taichi-ishitani commented Feb 4, 2025

Some IPs use a lot of typedefs defined by its structued config parameters.
For example:

For this kind of useage, config parameters and typedefs should be handled together.
I'd like to introduce the package generic boundary to allow to specify a generic package as a generic argument.

Example code:

package foo_pkg::<AW: const, DW: const> {
  const ADDRESS_WIDTH: u32 = AW;
  const DATA_WIDTH:    u32 = DW;

  type address_t = logic<ADDRESS_WIDTH>;
  type data_t    = logic<DATA_WIDTH>;
}


module foo_top::<PKG: foo_pkg> (
  i_address: input PKG::address_t,
  i_data:    input PKG::data_t,
) {
  import PKG::*;

  var address: address_t;
}

inst u_foo: foo_top::<foo_pkg::<16, 32>>(
  i_address: address,
  i_data:    data,
);
@dalance dalance added the lang Language design label Feb 4, 2025
@taichi-ishitani
Copy link
Contributor Author

For the above sample, foo_pkg has only 2 generic parameters but an actual packages may have more generic parameters. I think it is very troublesome to write such generic instance everywhere it is used.

To avoid this, I think it would be nice to create an alias to such generic package instance.

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

No branches or pull requests

2 participants