Hard Processor System Technical Reference Manual: Agilex™ 5 SoCs

ID 814346
Date 4/01/2024
Public
Document Table of Contents

5.3.6.4.2.2. Thread Synchronization Mechanism

The synchronization mechanism allows data transfers in different command execution threads. The different threads to synchronize share a sync buffer flag located in system memory. This structure enables all threads to synchronize data transfer and command activity based upon any number of sync buffers and command DMA execution threads. The Sync Flag Pointer field in the command descriptor indicates the address of sync buffer flag. This address must be accessible by the AXI manager interface and is one byte long (the controller actually accesses a full data word but discards the most significant bytes). The sync buffer flags are logically associated with the CDMA descriptors, and they are the global data transfer communication structure.

The address of the sync buffer flag is always required when the valid bit is set in the Sync arguments field. Also, in the Sync arguments field the conditions needed to start the execution of the command in this descriptor are defined. When this operation in the description is complete the state in the sync buffer flag is updated also using the information in the Sync arguments field. This new state in the sync buffer flag can be used as a start condition to execute any other descriptor in a different thread. This mechanism is shown in the following figure. Here using and sharing sync buffers, operations in two independent execution threads can synchronize their data transfers or command activity.

Figure 100. Thread Synchronization Mechanism in CDMA Work Mode

The following table describes the fields in the Sync arguments field in the CDMA descriptor.

Table 189.  Structure of Sync Arguments Field in CDMA Descriptor
Bits Name Description
31:24 Start Value Value required in sync buffer flag to start the operation in the descriptor. See Greater field.
23:16 End Value Value to be stored to the sync buffer flag upon the successful completion of the operation (only when Increment field is 0).
15:3 Reserved Must be set to zero by firmware.
2 Valid Sync information is valid in this descriptor.
1 Greater

This defines the start condition that allows proceeding with the operation in the descriptor. When set to zero, there should be a match between the value in the sync buffer flag and the value in the Start value field (bits 31:24). When set to one, the start condition is equal to or greater than the value in Start value field.

8-bit Modulo arithmetic is used. The sync buffer flag is considered "equal to or greater than" Start value field when value in sync buffer flag minus start value is between 0 and 127.

0 Increment When set to zero, the value to write in the sync buffer flag after the operation in the descriptor is completed corresponds to the value set in the End value field (bits 23:16). When set to one, the value in the sync buffer flag is incremented by 1 and the value in End value field is ignored.

The following steps describe the Command Engine execution thread operations.

1. The command engine fetches a new descriptor and tests for the valid flag in the Sync Arguments field. If valid bit is 0, this continues with the flash operation present in the descriptor and continues normal processing.

2. If valid bit is set in the Sync Argument field, the value in sync buffer flag must be equal to or greater than the specified value in Start value field. The command engine reads sync buffer flag from memory. If the start condition is met, the command engine moves to step execute Flash operation in the selected thread.

3. If the sync buffer flag does not meet the start condition, the command engine waits for an update on the sync buffer flag pointer from operation in other execution thread. The command engine then proceeds to read the sync buffer flag as in the above step.

4. Execute Flash operation contained in the descriptor.

5. Perform status update of the descriptor.

6. If the valid bit was set in the Sync argument field, set the value in the sync buffer flag to a new value or an increment by 1 depending on the value in the Increment field in the Sync argument field of the descriptor.

7. Command engine issues an interrupt if Int bit is set in Command Flags field. This concludes the processing of the current descriptor, and the next descriptor is fetched.

Note: If the Greater bit in the Sync argument field is set then the Start Value defines the beginning of a valid window that has 128 elements and wrap inside 256 values set. If the sync buffer flag value is inside this window, then sync triggering condition is meet.