google / google/xls

Consider adding `.+` and `.*` operators for extended-bitwidth

Open
#1,316 0 comments 0 reactions 0 assignees View on GitHub
dslx enhancement long-term-enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Some folks have brought up that `+` and `*` are typed like they are in Rust, but at times in hardware we want the variant of the operator where we get all of the bits (i.e. currently `add_with_carry` and `std::smul` and `std::umul`). Right now you just need to call a stdlib function, which is not so bad, but if it's sufficiently common / desired we could add operator variants with special names as infix. Takes us farther away from the general "try to mimic rust and not add tons of obscure language feature" guideline we tend to try to follow, but perhaps it's important enough.

See also the recent discussion in #1313 -- I wouldn't consider changing the default `+` and `*` on uN/sN builtin types at this point but the `.*` and `.+` variants could be considered.

Good to follow the general principle "beware the desire to add new bespoke syntax" and "keep it familiar", just so happens we're coming down on the "familiar from SW family of languages" since Verilog semantics for extension and slicing are not a particularly good role model to mimic.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.