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

Overflow flag substitute
http://forum.andestech.com/viewtopic.php?f=14&t=156
Page 1 of 1

Author:  cindy [ Thu Sep 29, 2011 10:43 am ]
Post subject:  Overflow flag substitute

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.

Author:  cindy [ Thu Sep 29, 2011 10:52 am ]
Post subject:  Re: Overflow flag substitute

這一篇是講如何知道overflow(溢位)的方法,
Andes core有上述的指令可以用。
有號數和無號數分別有上面2個方法。

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

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