Andes Workshop

It is currently Thu Mar 28, 2024 9:04 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: LLW and SCW instruction
PostPosted: Mon Feb 18, 2013 12:30 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
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.


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group