72 atomic operations – Intel NETWORK PROCESSOR IXP2800 User Manual

Page 212

Advertising
background image

212

Hardware Reference Manual

Intel

®

IXP2800 Network Processor

SRAM Interface

Up to two Microengine signals are assigned to each read-modify-write reference. Microcode
should always tag the read-modify-write reference with an even-numbered signal. If the operation

requires a pull, the requested signal is sent on the pull. If the pre-modified data is to be returned to

the Microengine, then the Microengine is sent (requested signal OR 1) when that data is pushed.

In

Example 28

, the version of Test_and_Set requires both a pull and a push:

In

Example 29

, the version of Test_and_Set does not require a pull, but does issue a push. A signal

is generated when the push is complete.

In

Example 30

, an Increment operation does not require a pull:

Table 72. Atomic Operations

Instruction

Pull Operand

Value Written to SRAM

Set_bits

Optional

1

1.

There are two versions of the Set, Clear, Add, and Swap instructions. One version pulls operand data from the Microengine
transfer registers, and the second version passes the operand data to the SRAM unit as part of the command.

SRAM_Read_Data or Pull_Data

Clear_bits

Optional

SRAM_Read_Data and not Pull_Data

Increment

No

SRAM_Read_Data + 0x00000001

Decrement

No

SRAM_Read_Data - 0x00000001

Add

Optional

SRAM_Read_Data + Pull_Data

Swap

Optional

Pull_Data

Example 28. SRAM Test_and_Set with Pull Data

immed [$xfer0, 0x1]

SRAM[test_and_set, $xfer0, test_address, 0, 1], sig_done_2

// SIGNAL_2 is set when $xfer0 is pulled from this ME. SIGNAL_3 is
// set when $xfer0 is written with the test value. Sleep until both
// SIGNALS have arrived.

CTX_ARB[signal_2, signal_3]

Example 29. SRAM Test_and_Set with Optional No-Pull Data

#define no_pull_mode_bit 24
#define byte_mask_override_bit 20
#define no_pull_data_bit 12
#define upper_part_bit 21

// This constant can be created once at init time
ALU[no_pull_constant, --, b, 0x3, <<no_pull_mode_bit]
ALU[no_pull_constant, no_pull_constant, or, 1, <<byte_mask_override_bit]

// Here is a no_pull test_and_add
ALU[temp, no_pull_constant, or, 0xfe, <<no_pull_data_bit]
ALU[temp, temp, or, 0x5, <<upper_part_bit]
SRAM[test_and_add, $x0, addra, 0], indirect_ref, sig_done[sig2]

CTX_ARB[sig2]

Example 30. SRAM Increment without Pull Data

SRAM [incr, $xfer0, incr_address, 0, 1], signal_2

// SIGNAL_2 is set when $xfer0 is written with the pre-increment value.

CTX_ARB[signal_2]

Advertising