Enhancement: DSLX: Create a tool to generate proc tests automatically
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
The process of creating proc unit tests is repetitive and requires rewriting boilerplate code. Take a look at:
- Proc https://github.com/google/xls/blob/main/xls/examples/delay_loopback_channel.x#L50
- Proc unit test https://github.com/google/xls/blob/main/xls/examples/delay_loopback_channel.x#L86
The steps to create a proc test are:
- Create new `proc` (config, init, next function)
- Declare the same channels as in Proc Under Test (PUT), but in reversed direction
- Add terminator channel
- In `config` function, create `consumer/producer` channel endpoints and attach them to PUT and test `proc` (this can be figured out based on the channel direction of the PUT)
Resulting code is predictable and could be done automatically with a tool, which parses the config function of the PUT. Ideally, the tool would be implemented in such a way, that it could be reused by code editors plugins, e.g. [VSCode Plugin](https://github.com/kammoh/dslx-vscode). Another solution would be to figure out how to change DSLX syntax to reduce the boilerplate.
Contributor guide
Assessment
This issue has not been assessed yet.