Decorated Storage Memory Controller (DSMC)
30.3.1.1
Compare-and-Store (CAST)
0
1
2
3
cast.b
1 0 0 1 -
cast.h
1 0 0 1 -
cast.w
1 0 0 1
This command begins by performing a read of the referenced memory address and
comparing that data with the operand included in the decoration word. If the read data is
equal to the compare operand, the write data associated with the decorated store instruction
is placed into the memory location, else the original read data is rewritten into the memory
location. The write operand is selected from the appropriate data byte lanes in the same
manner as any memory store operation; this implies the write data operand is right justified
in the rS source register.
tmp = mem[accessAddress, size] // memory read
if (size == 8)// define compare_operand
compare_operand = CD8
else if (size == 16)
else compare_operand = {0x0, CD28}// zero-filled data
if (tmp == compare_operand)// compare - "modify"
mem[accessAddress, size] = wdata// memory write
else mem[accessAddress, size] = tmp
Note for the word size operation (cast.w), the data value specified in the low-order 28 bits of
the decoration is zero filled in the most significant bits to create the required 32 bit compare
operand.
30.3.1.1.1 Logical AND (AND)
0
1
2
3
4
and.
1 0 1 0 -
{b,h,w
}
This command performs an atomic read-modify-write of the referenced memory location.
First, the location is read; it is then modified by performing a logical AND operation using the
write operand defined by the rS register; finally, the result of the AND operation is written
back into the referenced memory location.
tmp = mem[accessAddress, size] // memory read
tmp = tmp & wdata// modify
mem[accessAddress, size] = tmp// memory write
650/2058
4
5
6
7
8
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Figure 277. Decoration Format: CAST
compare_operand = CD16
5
6
7
8
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-
-
-
-
-
-
-
Figure 278. Decoration Format: AND
-
-
-
-
-
-
-
-
-
-
-
CD28
-
-
-
-
-
-
-
DocID027809 Rev 4
-
-
-
-
-
CD16
-
-
-
-
-
-
-
-
RM0400
CD8
-
-
-
-
-
Need help?
Do you have a question about the SPC572L series and is the answer not in the manual?
Questions and answers