关于 ULP 的 SUB 指令产生 ALU overflow 的问题
Posted: Wed Dec 26, 2018 1:11 pm
[中文]
在 ULP 中使用 SUB 指令进行一个正数减去一个负数的操作,会产生 ALU overflow,按理 SUB 指令进行的是有符号的运算,应该不会产生
ALU overflow.
在 ULP 中添加如下代码即可复现:
说明:使用 SUB 指令完成 1-(-1) 运算,发现会跳转到 wake_up 运行。
[EN]
When I use the ULP, I found a problem as below:
When I use `SUB` instruction to do the caculation that a positive number minus a negtive number, it seems that ALU will set overflow flag. And the `SUB` instruction can do sighed value caculation, so I think the ALU will not set overflow.
Add the code below can reproduce the issue:
Note: use `SUB` instruction to do the caculation that `1-(-1)`, and the system will jump to `wake_up`
在 ULP 中使用 SUB 指令进行一个正数减去一个负数的操作,会产生 ALU overflow,按理 SUB 指令进行的是有符号的运算,应该不会产生
ALU overflow.
在 ULP 中添加如下代码即可复现:
Code: Select all
move r2, 1
sub r2, r2, -1
jump wake_up, ov
[EN]
When I use the ULP, I found a problem as below:
When I use `SUB` instruction to do the caculation that a positive number minus a negtive number, it seems that ALU will set overflow flag. And the `SUB` instruction can do sighed value caculation, so I think the ALU will not set overflow.
Add the code below can reproduce the issue:
Code: Select all
move r2, 1
sub r2, r2, -1
jump wake_up, ov