Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12609 Discussions

NIOS V/g version 1.0 vs 2.0 Atomic instruction

tcmichals_home
Beginner
1,098 Views

Using NIOS/g 1.0  the following code works:

 

00001604: lw a5,-20(s0)
00001608: lw a4,-24(s0)
0000160c: fence iorw,ow
00001610: amoswap.w.aq zero,a4,(a5)

 

Using NIOS/g 2.0 an exception occurs when 1610 executes, amoswap.   The mcause register value is 2, stating it is an illegal instruction. 

Recompile the code, did not fix issue.  Validated the memory location is accessible.  

According to the web site, A (atomic instructions should be supported).    The API C/C++ API is std::atomic<uint32_t>  value being updated. 

 

_GLIBCXX_ALWAYS_INLINE void

store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept

{

memory_order __b __attribute__ ((__unused__))

= __m & __memory_order_mask;

__glibcxx_assert(__b != memory_order_acquire);

__glibcxx_assert(__b != memory_order_acq_rel);

__glibcxx_assert(__b != memory_order_consume);

 

__atomic_store_n(&_M_i, __i, int(__m)); <--- the function calling the fence/swap

 

 

   From https://www.intel.com/content/www/us/en/docs/programmable/683632/23-4/processor-73511.html the processor should support Atomic instructions.  Version 1.0 did. 

 

Tim

0 Kudos
8 Replies
tcmichals_home
Beginner
1,095 Views

OK, looking see link:

  • RV32IAZicsr (Pipelined) & RV32IZicsr (Non-Pipelined)

Another web has:

 States:

 

  • Pipelined
    • Applies RV32IZicsr instruction set.
    • Supports five-stages pipeline datapath.
  • Non-pipelined
    • Applies RV32IZicsr instruction set.
    • Supports non-pipeline datapath.

This post is having the same issue

 

 

So, Atomic is not supported?  Or is it?

 

 

0 Kudos
tcmichals_home
Beginner
1,083 Views

according to the toolchain.cmake generated by niosv-bsp-editor  there is -march=rv32ia  this should be rv32i if the processor does not support Atomic.  Using this option the code now works. 

0 Kudos
Kevin26
Beginner
1,027 Views

That's what I changed also but your original question about does the RISC V/m Pipelined and RISC V/g support atomic instructions is still valid.  The documentation says it should.

0 Kudos
EBERLAZARE_I_Intel
1,012 Views

Hi,


Let me quick check with our internal team.


0 Kudos
EBERLAZARE_I_Intel
938 Views

Hi,


Unfortunately, our Nios V currently does not support Atomic instruction yet.


I will channel this to our internal team as feedback request.


Is there any other questions from your side?


tcmichals_home
Beginner
919 Views

Issue resolved.  

niosv-bsp-editor needs to be updated to remove atomic support from compiler option

0 Kudos
EBERLAZARE_I_Intel
888 Views

Hi,


Thank you for your feedback, I will check that out and send this feedback to our internal team as feedback request to make the proper changes.


0 Kudos
EBERLAZARE_I_Intel
835 Views

Hi,


Thanks for your feedback, I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.



p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.


0 Kudos
Reply