Skip to content

Conversation

@copybara-service
Copy link

@copybara-service copybara-service bot commented Jan 29, 2026

Adds support for DSLX bit vectors wider than 64 bits in the C++ transpiler.

Previously, bit vectors larger than 64 bits were incorrectly represented as (u)int64_t. This change introduces a new representation for wide bit vectors: std::bitset<N>.

A new class hierarchy is introduced:

  • BitVectorCppEmitter: Base class for bit vector emitters.
  • CppIntBitVectorEmitter: Handles bit vectors up to 64 bits, using standard C++ integer types.
  • RawBitVectorCppEmitter: Handles bit vectors larger than 64 bits, using std::bitset<N>.

Enums are a special case; their underlying type is capped at 64 bits in the C++ representation, even if the DSLX type is wider.

Helper functions FillBitSet and FromBitSet are added to xls::Bits to facilitate conversion between Bits and std::bitset<N>.

Fixes: #1135

Bug: #3764

Bug: #3763

@copybara-service copybara-service bot force-pushed the test_862902415 branch 4 times, most recently from 3b6aaf9 to 6811a1d Compare January 30, 2026 16:35
@copybara-service copybara-service bot closed this Jan 30, 2026
@copybara-service copybara-service bot deleted the test_862902415 branch January 30, 2026 17:09
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.

Support wide bitvector types (>64 bits) in cpp transpiler

0 participants