Andes Workshop
http://forum.andestech.com/

LLW and SCW instruction
http://forum.andestech.com/viewtopic.php?f=14&t=672
Page 1 of 1

Author:  cindy [ Mon Feb 18, 2013 12:30 pm ]
Post subject:  LLW and SCW instruction

llw and scw 是配對的指令, 但是對 llw and scw 指定的位址並沒有保護防寫的機制, 所以你可以用 swi 去寫相同的位址, 那如何確保 llw and scw 的 atomic operation 是正常的, 就是當你用 scw 將 regiter (在你的例子是 $r1)寫回 memory 之後, 你要在判斷這個 register, 如果等於 1 表示成功, 如果等於 0, 表示 atomic operation 動作 fail, 你需要重新執行 llw and scw 的動作來完成 atomic operation.

llw $r1,[$r0+$r3<<0]
li $r1,0xacbd1234
scw $r1,[$r0+$r3<<0]
beqz $r1,#12


如果要驗證$r1的數值,
不要用single step就可以得到正確的結果。
直接在scw執行結束後的點下breakpoint。可以正確的寫入。

The test result of the code you provide is successful. The r1 is 1 after
executing SCW.

By the way, if you execute hardware single step, the result of SCW will always
be 0 because of interrupt.

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/