google / google/xls

Confusing name/behavior for `signex`

Open
#191 3 comments 0 reactions 0 assignees View on GitHub
dslx good first issue
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Everyone is different, but for me personally, I find the behavior of `signex` doesn't match the name. For me, sign extend of an unsigned value shouldn't change its Real number interpretation, so unsigned types should be zero extended when "sign extending" them. To be picky, unsigned values don't have a sign bit (they are un-signed or not signed), so there's no bit to duplicate.

Could we rename this primitive to `duplicate_msb` or `extend_msb` to reflect the fact that it's operating on the most significant bit? That is, the operation of this primitive has nothing to do with sign bits (or lack of sign bits). I think one of these names would be clearer to the set of users who share my interpretation of sign extension.

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.