NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_cpu_amo.c File Reference

Atomic memory access (read-modify-write) emulation functions using LR/SC pairs - source file. More...

#include "neorv32.h"
#include "neorv32_cpu_amo.h"

Functions

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)
 

Detailed Description

Atomic memory access (read-modify-write) emulation functions using LR/SC pairs - source file.

See also
https://stnolting.github.io/neorv32/sw/files.html

Function Documentation

◆ 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]addr32-bit memory address, word-aligned.
[in]wdataData 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]addr32-bit memory address, word-aligned.
[in]wdataData word to be atomically AND-ed with original data at address (32-bit).
Returns
Pre-operation data loaded from address (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]addr32-bit memory address, word-aligned.
[in]wdataData 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]addr32-bit memory address, word-aligned.
[in]wdataData 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]addr32-bit memory address, word-aligned.
[in]wdataData 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]addr32-bit memory address, word-aligned.
[in]wdataData 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]addr32-bit memory address, word-aligned.
[in]wdataData word to be atomically OR-ed with original data at address (32-bit).
Returns
Pre-operation data loaded from address (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]addr32-bit memory address, word-aligned.
[in]wdataData 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]addr32-bit memory address, word-aligned.
[in]wdataData word to be atomically XOR-ed with original data at address (32-bit).
Returns
Pre-operation data loaded from address (32-bit)