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 example of DSLX design parameterization based on proto files #1183

Merged
merged 2 commits into from
Mar 8, 2024

Conversation

lpawelcz
Copy link
Contributor

@lpawelcz lpawelcz commented Nov 6, 2023

This example showcases the usage of proto_to_dslx tool in DSLX design parameterization. It defines a protobuf message containing design parameters:

  • input width,
  • output width

Two textproto files with different variants of the design are provided. Each textproto file can be converted to DSLX file which is then imported by top-level design in order to use the parameters.

The design itself has 2 inputs and one output. The widths of those are controlled by parameters.

In order to provide single import path in top DSLX file custom configuration setting 'design_variant' was provided. It is used to select the design variant from bazel command line.

Verilog files for the variants can be generated with:

bazel build //xls/examples/parameterized:design_verilog --//xls/examples/parameterized:design_variant=narrow

and:

bazel build //xls/examples/parameterized:design_verilog --//xls/examples/parameterized:design_variant=wide

@proppy In this example I wanted to explore your suggestion from #1160 (comment), please take a look.

Copy link
Member

@proppy proppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding this, left some preliminary comments.

@hongted, I don't think we have an equivalent of this yet? (afaik we mainly rely on genrules for this internally)

@lpawelcz
Copy link
Contributor Author

lpawelcz commented Nov 17, 2023

Removed DesignType parameter to keep the example minimal, rebased the code, edited description and cleaned git history. @proppy please take another look.

@lpawelcz lpawelcz force-pushed the parameter-generation-example branch 2 times, most recently from 24b2da6 to 3dec337 Compare February 22, 2024 13:22
Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
This example showcases the usage of proto_to_dslx tool in DSLX design
parameterization.
It defines a protobuf message containing design parameters:

* input width,
* output width

A textproto file with a variant of the design is provided.
Textproto file can be converted to DSLX file which is then imported
by top-level design in order to use the parameters.

The design itself has 2 inputs and one output. The widths of those are
controlled by parameters.

Verilog file for the variant can be generated with:

```
bazel build //xls/examples/parameterized:design_verilog
```

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
@copybara-service copybara-service bot merged commit 26fb558 into google:main Mar 8, 2024
4 checks passed
@lpawelcz lpawelcz deleted the parameter-generation-example branch March 8, 2024 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants