Bit Field Operations - Motorola MC68030 User Manual

Enhanced 32-bit microprocessor
Hide thumbs Also See for MC68030:
Table of Contents

Advertisement

Instruction Set Summary

3.5.3 Bit Field Operations

One data type provided by the MC68030 is the bit field, consisting of as many as 32
consecutive bits. A bit field is defined by an offset from an effective address and a width
31
31
value. The offset is a value in the range of 2
through 2
1 from the most significant bit
(bit 7) at the effective address. The width is a positive number, 1–32. The most significant
bit of a bit field is bit 0; the bits number in a direction opposite to the bits of an integer.
The instruction set includes eight instructions that have bit field operands. The insert bit field
(BFINS) instruction inserts a bit field stored in a register into a bit field. The extract bit field
signed (BFEXTS) instruction loads a bit field into the least significant bits of a register and
extends the sign to the left, filling the register. The extract bit field unsigned (BFEXTU) also
loads a bit field, but zero fills the unused portion of the destination register.
The set bit field (BFSET) instruction sets all the bits of a field to ones. The clear bit field
(BFCLR) instruction clears a field. The change bit field (BFCHG) instruction complements
all the bits in a bit field. These three instructions all test the previous value of the bit field,
setting the condition codes accordingly. The test bit field (BFTST) instruction tests the value
in the field, setting the condition codes appropriately without altering the bit field. The find
first one in bit field (BFFFO) instruction scans a bit field from bit 0 to the right until it finds a
bit set to one and loads the bit offset of the first set bit into the specified data register. If no
bits in the field are set, the field offset and the field width is loaded into the register.
An important application of bit field instructions is the manipulation of the exponent field in a
floating-point number. In the IEEE standard format, the most significant bit is the sign bit of
the mantissa. The exponent value begins at the next most significant bit position; the
exponent field does not begin on a byte boundary. The extract bit field (BFEXTU) instruction
and the BFTST instruction are the most useful for this application, but other bit field
instructions can also be used.
Programming of input and output operations to peripherals requires testing, setting, and
inserting of bit fields in the control registers of the peripherals, which is another application
for bit field instructions. However, control register locations are not memory locations;
therefore, it is not always possible to insert or extract bit fields of a register without affecting
other fields within the register.
MOTOROLA
MC68030 USER'S MANUAL
3-31

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents