google / google/xls

Conversion between bool[N] and bits[N] should allow control over ordering

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

Description

### What's hard to do? (limit 100 words)

In XLS, we have a distinction between an array of bools `bool[N]` (i.e. `bits[1][N]`) and a packed bit vector `bits[N]`. Oftentimes, you may choose to write one or the other depending on convenience (e.g. arrays support map, bits support and/or reduce). But in these cases, the order of indices is normally fixed regardless of whether we write it as one version or the other.

stdlib provides `convert_to_bools_lsb0` and `convert_to_bits_msb0` to convert between the two, but it'd be cleaner to have that ordering user-specified.

### Current best alternative workaround (limit 100 words)

You can use `rev` or `array_rev` before or after the conversion functions, to undo the reversing.

### Your view of the "best case XLS enhancement" (limit 100 words)

Provide APIs to convert between the two without extraneous reversing.

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.