A method of extracting bits of a bit stream including retrieving bits from
the bit stream into an accumulator, specifying a size value specifying a
number of bits to extract, storing a position value into a control
register, and executing a bit extraction instruction. The bit extraction
instruction includes copying the size value number of bits from the
accumulator beginning at the position value into a target register,
setting any remaining bits of the target register to zero, and
decrementing the position value by an amount based on the size value. The
method may include loading bits from a bit stream into a register and
moving the contents of the register into the accumulator to replenish the
accumulator. The method may include determining, based on the position
value, whether the accumulator needs to be replenished, and if not,
branching to bypass replenishing functions.