Andes Workshop

It is currently Fri Mar 29, 2024 5:03 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: inline assembly的example
PostPosted: Wed Jun 06, 2012 6:15 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
例如demo-int裡的檔案ag101_16mb.h,
有幾個example。您可以用asm這個key word來搜尋。


Code:
#define NDS32_SET_BITS(addr, mask) \
__asm__ __volatile__(\
" sethi $r1, hi20(%1) \n\t" \
" ori $r1, $r1, lo12(%1) \n\t" \
" sethi $r2, hi20(%0) \n\t" \
" ori $r2, $r2, lo12(%0) \n\t" \
" lwi $r0, [$r2] \n\t" \
" or $r0, $r0, $r1 \n\t" \
" sw $r0, [$r2] \n\t" \
::"i"(addr),"i"(mask):"$r0", "$r1", "$r2")


Code:
#define NDS32_REG_WAIT4_BIT_ON(addr, mask) \
__asm__ __volatile__(\
" sethi $r1, hi20(%1) \n\t" \
" ori $r1, $r1, lo12(%1) \n\t" \
" sethi $r2, hi20(%0) \n\t" \
" ori $r2, $r2, lo12(%0) \n\t" \
"1: lwi $r0, [$r2] \n\t" \
" and $r0, $r0, $r1 \n\t" \
" beqz $r0, 1b \n\t" \
::"i"(addr),"i"(mask):"$r0", "$r1", "$r2")


Inline assembly的用法,
請參考文件programming guide的19.9. Inline Assembly Programming的說明。


Top
 Profile Send private message E-mail  
 
 Post subject: Re: inline assembly的example
PostPosted: Fri Dec 08, 2017 3:42 pm 
Offline

Joined: Thu Apr 03, 2014 4:27 pm
Posts: 43
The AndeSight V3.0.0 programing guide V1.6 is shown on the 19.10 section.
Please refer to the following attached file.
Attachment:
Andes_Programming_Guide_for_ISA_V3_PG010_V1.6.pdf [1.66 MiB]
Downloaded 1239 times


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

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 15 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group