sync
Synchronize shared memory
Orders the loads and stores around it, so that another processor observes them in program order.
Forms
syncsyncLike 'sync', but the operand selects which accesses to order. This simulator completes every access immediately, so the type is ignored and the instruction does nothing.
Operands
imm5- An unsigned 5-bit immediate,
0to31, used for values such as a shift count.
This simulator runs a single processor and completes every access immediately, so there is nothing to reorder and 'sync' does nothing. It is accepted so that compiler output and real-world code assemble unchanged.
.data
.align 2
value: .word 0
.text
# Store 7, execute sync, then read value back. Inspect $t1: 7; memory still contains the little-endian bytes 07 00 00 00.
la $t2, value
li $t0, 7
sw $t0, 0($t2)
sync
lw $t1, 0($t2)