Bmtset.w, Bit-masked test and set a, Operation assembler syntax – Freescale Semiconductor StarCore SC140 User Manual

Page 400

Advertising
background image

A-86

SC140 DSP Core Reference Manual

BMTSET.W

BMTSET.W

Bit-Masked Test and Set a

BMTSET.W

16-Bit Operand in Memory (BMU)

Description

These operations use an unsigned 16-bit immediate data mask to test and set selected bits in the destination
operand. For each bit i that is set (selected) in the mask, the bit i in the destination operand’s corresponding
bit position is set. Unselected bits are unaffected. These operations read from memory, modify the
retrieved value, and attempt to write the new value back to that memory address. These operations result in
two memory accesses.

This instruction is intended for semaphore support in a multi-process shared memory environment.
Typically, the process that wants to get exclusive control of a semaphore tries to set bits in the memory
using this instruction. This action can fail if all of the bits are already set. It can also fail in case of
protection violation, or if another process has locked the bus or written to the same memory address
between the read and write cycles of this instruction. It is the responsibility of the memory system to
inform the core of failures due to the latter case. Both failures cause the T bit to be set. The process
attempting to set the semaphore should test the T bit after the instruction is executed in order to determine
if the semaphore is set or not. The absolute addresses, offsets, and address register values must be
word-aligned.

Although this instruction is designed with semaphores in mind, it can be used for other applications.

Operation

Assembler Syntax

1

→ (SP–u5)

i

(i denotes bits=1 in #u16)

if (all selected bits were set), then 1

→ T, else 0 → T

BMTSET.W #u16,(SP–u5){0

≤ u16 < 2

16

}

{0

≤ u5 < 64,W}

1

→ (SP+s16)

i

if (all selected bits were set), then 1

→ T, else 0 → T

BMTSET.W #u16,(SP+s16){0

≤ u16 < 2

16

}

{–2

15

≤ s16 < 2

15

,W}

1

→ (Rn)

i

if (all selected bits were set), then 1

→ T, else 0 → T

BMTSET.W #u16,(Rn){0

≤ u16 < 2

16

}

1

→ (a16)

i

if (all selected bits were set), then 1

→ T, else 0 → T

BMTSET.W #u16,(a16){0

≤ u16 < 2

16

}

{0

≤ a16 < 2

16

,W}

BMTSET.W #u16,(SP–u5)

Tests and sets selected bits in the contents of a memory address pointed to by the active stack pointer (SP)
with an unsigned 5-bit offset.

BMTSET.W #u16,(SP+s16)

Tests and sets selected bits in the contents of a memory address pointed to by the active stack pointer (SP)
with a 16-bit signed offset.

BMTSET.W #u16,(Rn)

Tests and sets selected bits in the contents of a memory address pointed to by an address register (Rn).

BMTSET.W #u16,(a16)

Tests and sets selected bits in the contents of a memory address pointed to by an absolute 16-bit address.

Advertising