data.bitarray


template <
    auto Size,
    auto WordWidth,
    template <typename, auto> typename Memory = memory
    >
class bitarray §

A fixed sized array of bits, stored internally as a memory of words. Provides methods to read or write at bit and word granularity.

Parameters

  • auto Size
    

    Number of bits in the bit vector.

  • auto WordWidth
    

    Number of bits in each word.

  • template <typename, auto> typename Memory = memory
    

    Memory implementation.

Aliases

  • using bit_addr_t = index_t<Size> §
    

    Represents the address of a single bit.

  • using word_addr_t = index_t<bitarray::WordCount> §
    

    Represents the address of a single word.

  • using word_t = uint<WordWidth> §
    

    A single word which can be read or written.

Methods

  • inline bool read_bit(bitarray::bit_addr_t addr) §
    

    Get the value of a single bit from the bitarray.

    Arguments

  • inline void write_bit(bitarray::bit_addr_t addr, bool val) §
    

    Set the value of a single bit in the bitarray. Note that this is implemented with a read-modify write. If Memory is memory_norep then concurrent reads and writes of the bitarray are not allowed. If Memory is memory, then each call site of read_bit, write_bit, and read_word add another replica.

    Arguments

  • inline bitarray::word_t read_word(bitarray::word_addr_t addr) §
    

    Get the value of a word.

    Arguments

    • bitarray::word_addr_t addr
      

      Address of the word to read. Note that this is in terms of words, not bits.

  • inline void write_word(bitarray::word_addr_t addr, bitarray::word_t word) §
    

    Set the value of a word.

    Arguments

General

  • (0 == (Size % WordWidth))