# The implication of atomicity of CSR instructions

**URL:** <https://forums.sifive.com/t/the-implication-of-atomicity-of-csr-instructions/1815>\
**Category:** RISC-V\
**Created:** [November 26, 2018, 4:37pm UTC](https://forums.sifive.com/t/the-implication-of-atomicity-of-csr-instructions/1815 "2018-11-26T16:37:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhwu](https://avatars.discourse-cdn.com/v4/letter/z/49beb7/32.png) [@zhwu](https://forums.sifive.com/u/zhwu)\
**Post date:** [November 26, 2018, 4:37pm UTC](https://forums.sifive.com/t/the-implication-of-atomicity-of-csr-instructions/1815/1 "2018-11-26T16:37:16Z")

</div>

Hi, I am trying to implement the CSR operations and read in the spec that CSR[W|S|C] instructions should perform atomic Read-Modify-Write on CSRs.

My question is what the **atomic** here means? Is it from the perspective of single core or multi-core?

For example, if I am doing a classical 5-stage pipeline, can I read the values from CSR in the decode stage and do the set/clear in the execution stage (with possible forwarding logic)?

---

<div class="post-metadata">

**Author:** ![Krste](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/krste/32/11_2.png) [@Krste](https://forums.sifive.com/u/Krste)\
**Post date:** [December 16, 2018, 7:11pm UTC](https://forums.sifive.com/t/the-implication-of-atomicity-of-csr-instructions/1815/2 "2018-12-16T19:11:34Z")

</div>

Answered in main RISC-V mailing lists, which is correct place to discuss general RISC-V questions and issues.
