Atomic memory access (read-modify-write) emulation functions using LR/SC pairs - header file.
More...
#include <stdint.h>
Go to the source code of this file.
|
uint32_t | neorv32_cpu_amolr (uint32_t addr) |
|
uint32_t | neorv32_cpu_amosc (uint32_t addr, uint32_t wdata) |
|
|
uint32_t | neorv32_cpu_amoswapw (uint32_t addr, uint32_t wdata) |
|
uint32_t | neorv32_cpu_amoaddw (uint32_t addr, uint32_t wdata) |
|
uint32_t | neorv32_cpu_amoandw (uint32_t addr, uint32_t wdata) |
|
uint32_t | neorv32_cpu_amoorw (uint32_t addr, uint32_t wdata) |
|
uint32_t | neorv32_cpu_amoxorw (uint32_t addr, uint32_t wdata) |
|
int32_t | neorv32_cpu_amomaxw (uint32_t addr, int32_t wdata) |
|
uint32_t | neorv32_cpu_amomaxuw (uint32_t addr, uint32_t wdata) |
|
int32_t | neorv32_cpu_amominw (uint32_t addr, int32_t wdata) |
|
uint32_t | neorv32_cpu_amominuw (uint32_t addr, uint32_t wdata) |
|
Atomic memory access (read-modify-write) emulation functions using LR/SC pairs - header file.
- See also
- https://stnolting.github.io/neorv32/sw/files.html
◆ neorv32_cpu_amoaddw()
uint32_t neorv32_cpu_amoaddw |
( |
uint32_t | addr, |
|
|
uint32_t | wdata ) |
Atomic ADD (AMOADD.W). return <= MEM[addr]; MEM[addr] <= MEM[addr] + wdata
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically added to original data at address (32-bit). |
- Returns
- Pre-operation data loaded from address (32-bit)
◆ neorv32_cpu_amoandw()
uint32_t neorv32_cpu_amoandw |
( |
uint32_t | addr, |
|
|
uint32_t | wdata ) |
Atomic AND (AMOAND.W). return <= MEM[addr]; MEM[addr] <= MEM[addr] and wdata
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically AND-ed with original data at address (32-bit). |
- Returns
- Pre-operation data loaded from address (32-bit)
◆ neorv32_cpu_amolr()
uint32_t neorv32_cpu_amolr |
( |
uint32_t | addr | ) |
|
|
inline |
Atomic memory access: load-reservate word.
- Note
- The address has to be word-aligned - otherwise an alignment exception will be raised.
- Warning
- This function requires the A ISA extension.
- Parameters
-
[in] | addr | Address (32-bit). |
- Returns
- Read data word (32-bit).
◆ neorv32_cpu_amomaxuw()
uint32_t neorv32_cpu_amomaxuw |
( |
uint32_t | addr, |
|
|
uint32_t | wdata ) |
Atomic unsigned MAX (AMOMAXU.W). return <= MEM[addr]; MEM[addr] <= maximum_unsigned(MEM[addr], wdata)
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically MAX-ed with original data at address (unsigned 32-bit). |
- Returns
- Pre-operation data loaded from address (unsigned 32-bit)
◆ neorv32_cpu_amomaxw()
int32_t neorv32_cpu_amomaxw |
( |
uint32_t | addr, |
|
|
int32_t | wdata ) |
Atomic signed MAX (AMOMAX.W). return <= MEM[addr]; MEM[addr] <= maximum_signed(MEM[addr], wdata)
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically MAX-ed with original data at address (signed 32-bit). |
- Returns
- Pre-operation data loaded from address (signed 32-bit)
◆ neorv32_cpu_amominuw()
uint32_t neorv32_cpu_amominuw |
( |
uint32_t | addr, |
|
|
uint32_t | wdata ) |
Atomic unsigned MIN (AMOMINU.W). return <= MEM[addr]; MEM[addr] <= minimum_unsigned(MEM[addr], wdata)
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically MIN-ed with original data at address (unsigned 32-bit). |
- Returns
- Pre-operation data loaded from address (unsigned 32-bit)
◆ neorv32_cpu_amominw()
int32_t neorv32_cpu_amominw |
( |
uint32_t | addr, |
|
|
int32_t | wdata ) |
Atomic signed MIN (AMOMIN.W). return <= MEM[addr]; MEM[addr] <= minimum_signed(MEM[addr], wdata)
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically MIN-ed with original data at address (signed 32-bit). |
- Returns
- Pre-operation data loaded from address (signed 32-bit)
◆ neorv32_cpu_amoorw()
uint32_t neorv32_cpu_amoorw |
( |
uint32_t | addr, |
|
|
uint32_t | wdata ) |
Atomic OR (AMOOR.W). return <= MEM[addr]; MEM[addr] <= MEM[addr] or wdata
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically OR-ed with original data at address (32-bit). |
- Returns
- Pre-operation data loaded from address (32-bit)
◆ neorv32_cpu_amosc()
uint32_t neorv32_cpu_amosc |
( |
uint32_t | addr, |
|
|
uint32_t | wdata ) |
|
inline |
Atomic memory access: store-conditional word.
- Note
- The address has to be word-aligned - otherwise an alignment exception will be raised.
- Warning
- This function requires the A ISA extension.
- Parameters
-
[in] | addr | Address (32-bit). |
[in] | wdata | Data word to-be-written conditionally (32-bit). |
- Returns
- Status: 0 = ok, 1 = failed (32-bit).
◆ neorv32_cpu_amoswapw()
uint32_t neorv32_cpu_amoswapw |
( |
uint32_t | addr, |
|
|
uint32_t | wdata ) |
Atomic SWAP (AMOSWAP.W). return <= MEM[addr]; MEM[addr] <= wdata
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically stored to address (32-bit). |
- Returns
- Pre-operation data loaded from address (32-bit)
◆ neorv32_cpu_amoxorw()
uint32_t neorv32_cpu_amoxorw |
( |
uint32_t | addr, |
|
|
uint32_t | wdata ) |
Atomic XOR (AMOXOR.W). return <= MEM[addr]; MEM[addr] <= MEM[addr] xor wdata
- Note
- This function requires the CPU A ISA extension.
- Parameters
-
[in] | addr | 32-bit memory address, word-aligned. |
[in] | wdata | Data word to be atomically XOR-ed with original data at address (32-bit). |
- Returns
- Pre-operation data loaded from address (32-bit)