cva6 icon indicating copy to clipboard operation
cva6 copied to clipboard

[Question] Atomic instruction AMOSWAP

Open Nicolas-Gaudin opened this issue 3 years ago • 0 comments

Hello !

I am intrigued by the behavior of an atomic instruction: amoswap. I observe the following behavior for amoswap rd, rs2, (rs1):

rd = M[rs1];
M[rs1]' = rs2;
rd' = rs2;

with at the end : rd' = rs2 M[rs1]' = rs2 rs2 not updated So at no time is rs2 updated with the old value present in memory at address rs1.

I excepted to have the following behavior :

rd = M[rs1];
swap(rd , rs2); => rd' = rs2; rs2' = M[rs1];
M[rs1]' = rd' = rs2;

with at the end : rd' = rs2 M[rs1]' = rs2 rs2' = M[rs1] Should we have this behavior?

* M[x] => It is the data present at the address x ry => initial value of the y register ry' => final value of the y register

Nicolas-Gaudin avatar Jun 07 '22 15:06 Nicolas-Gaudin