Suggested Documentation Changes to "Tutorial: Intro to Parametrics"
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
[doc link](https://google.github.io/xls/tutorials/intro_to_parametrics)
* Include link to language reference for [parametric functions](https://google.github.io/xls/dslx_reference/#parametric-functions)
* Derived parametrics
* "Oh no! Specifying parametrics in this way has revealed a problem!" What problem? It's not clear from the example that the user is supposed to replace the `???` and anyway even if they did it doesn't matter because the problem with this example is in the function signature. Include runtime error example:
```
fn unbias_exponent(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^----^ ParseError: Expected '{', got 'identifier': expected '{' because parametric expressions must be enclosed in braces
```
* Parameterized float-to-int
* `exp:float32::bexp`` size + 1 sign bit` it looks like a `'s` got misformatted as \`; same with `fraction:float32::fraction`
* "missing cases from the previous tutorial" checking for `Infinity/NaN` by looking to see if the exponent is a max value works for fixed builtin types, e.g. `x.bexp == u8::MAX` but fails for parameterized types e.g. `x.bexp == uN[EXP_SZ]::MAX` results in a `ParseError`. Should that expression work and therefore this is a bug in the language implementation? Or is there a more canonical way to do this? Either way, a doc link might be useful. [dslx_reference/#bit-type](https://google.github.io/xls/dslx_reference/#bit-type) looks incomplete.
Contributor guide
Assessment
This issue has not been assessed yet.