8000 Narrow logical right shifts used only through low bit slices by Novpolina · Pull Request #5246 · google/xls · GitHub
[go: up one dir, main page]

Skip to content

Narrow logical right shifts used only through low bit slices - #5246

Open
Novpolina wants to merge 1 commit into
google:mainfrom
Novpolina:fix/narrow-truncated-right-shifts
Open

Novpolina wants to merge 1 commit into
google:mainfrom
Novpolina:fix/narrow-truncated-right-shifts

Conversation

@Novpolina
Copy link
Copy Markdown

Narrow logical right shifts used only through low bit slices

Summary

Replace a wide logical right shift whose result is observed only through low bit slices with a narrow dynamic_bit_slice.

Motivation

In the single-proc CRC module, one byte is extracted from a 128-bit payload, but optimized IR and generated SystemVerilog retain a full 128-bit dynamic right shift:

shifted = shrl(payload, shift)
data = bit_slice(shifted, start=0, width=8)

This change exposes the operation as dynamic_bit_slice(payload, shift, width=8) instead of a full-width barrel shifter. Since the shift is a multiple of eight, the existing optimization pipeline can collapse it into a 16-to-1 mux of bytes.

Testing

bazel test \
  //xls/passes:bit_slice_simplification_pass_test \
  //xls/passes:optimization_pass_pipeline_test

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0