I confused about Atomic Instruction

56 views
Skip to first unread message

Kamer Kırali

unread,
Mar 13, 2024, 7:53:51 AMMar 13
to RISC-V HW Dev
Hello, I am designing a RISC-V processor with Verilog. But when I read the Atomic instruction structure, I was very confused. I couldn't figure out which unit I should add for this and what I should do. I can understand other plugins. But Atomic is very confusing. Is there a Verilog processor model made for this? For me to look at and understand. Or I will design a data path according to any instruction structure that explains exactly what this is. But I think this would be wrong and I get confused because it is a memory-based situation. Maybe I'm asking a very simple question for others, for which I apologize. I'm actually new to this. I designed a simple rv32im processor. But I want to see further.

Tommy Murphy

unread,
Mar 13, 2024, 8:15:24 AMMar 13
to Kamer Kırali, RISC-V HW Dev
> I am designing a RISC-V processor with Verilog. But when I read the Atomic instruction structure, I was very confused. I couldn't figure out which unit I should add for this and what I should do. I can understand other plugins. But Atomic is very confusing.

What's the context here?
What are you referring to?
The Rocket Chip RISC-V implementation generator perhaps?


Or something else?

Robert Finch

unread,
Mar 13, 2024, 8:53:28 AMMar 13
to RISC-V HW Dev, tommy_...@hotmail.com, kamer....@gmail.com

Atomic memory instructions are indivisible operations performed with memory like swap or add. They are usually done outside of the CPU itself perhaps at the memory controller to guarantee the operation will be atomic. The memory controller needs to be able to process commands given to it by the CPU beyond LOAD or STORE. Normally for a CPU that only performs loads and stores the two are distinguished by a write enable signal. To support atomics more signals are needed. For my own CPU, I have it output a five-bit command code which includes all the atomic operations in addition to load and store, also output is the data associated with the command. The memory controller then takes care of the atomic part and sends back results if needed.

Probably the best place to put atomic memory operations is in the mem unit of the CPU.

Kamer Kırali

unread,
Mar 13, 2024, 9:33:53 AMMar 13
to RISC-V HW Dev, robf...@gmail.com, tommy_...@hotmail.com, Kamer Kırali
thanks for answer.

13 Mart 2024 Çarşamba tarihinde saat 15:53:28 UTC+3 itibarıyla robf...@gmail.com şunları yazdı:
Reply all
Reply to author
Forward
0 new messages