sync
Synchronize - 4C 00 00 64
sync

Instruction Syntax

Mnemonic Format Flags
sync None None

Instruction Encoding

0
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0

Field Bits Description
Primary Opcode 0-5 010011 (0x13)
Reserved 6-10 00000
Reserved 11-15 00000
Reserved 16-20 00000
Reserved 21-29 000000000
Reserved 30-31 00

Operation

Wait for all previous memory operations to complete

The sync instruction ensures that all memory operations issued before the sync instruction have completed before any memory operations after the sync instruction are issued.

Note: The sync instruction is used to enforce memory ordering in multiprocessor systems and to ensure that memory operations are visible to other processors.

Affected Registers

None

The sync instruction does not affect any registers.

Examples

Basic Synchronization

sync                # Wait for all previous memory operations to complete

Memory Barrier

# Ensure memory operations are visible to other processors
stw r3, 0(r4)       # Store value to memory
sync                # Synchronize memory operations
lwz r5, 8(r4)       # Load value from memory

Multiprocessor Coordination

# Coordinate between processors
stw r3, flag_addr   # Set flag
sync                # Ensure flag is visible to other processors
# Continue with next operation

Related Instructions

isync, eieio

Back to Index