Andes Workshop

It is currently Fri Mar 29, 2024 1:07 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Overflow flag substitute
PostPosted: Thu Sep 29, 2011 10:43 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
For overflow detection issue, Andes use some instructions to judge overflow instead of overflow flag.

1) In case signed value overflow detection, you can use "sva" and "svs" instructions. For detail instruction description, please refer to AndeStar_ISA_UM025_V1.6.pdf.

2) In case unsigned value overflow detection, assume A and B are unsigned variable, overflow will happen
A + B < A
So, if you want to know if it is overflow of the result of A + B, you can use instructions like "slt" (Set on Less Than) to judge overflow.


Top
 Profile Send private message E-mail  
 
 Post subject: Re: Overflow flag substitute
PostPosted: Thu Sep 29, 2011 10:52 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
這一篇是講如何知道overflow(溢位)的方法,
Andes core有上述的指令可以用。
有號數和無號數分別有上面2個方法。

大家也可以試一試下面的程式碼,
這個code會overflow,r2的值為1。
Code:
    li $r0,#0x7FFFFFFF
   li $r1,#0xffff
   sva  $r2,$r0,$r1


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: No registered users and 3 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