URL
https://opencores.org/ocsvn/amber/amber/trunk
[/] [amber/] [trunk/] [hw/] [tests/] [add.S] - Diff between revs 2 and 35
Show entire file |
Details |
Blame |
View Log
Rev 2 |
Rev 35 |
Line 37... |
Line 37... |
// from http://www.opencores.org/lgpl.shtml //
|
// from http://www.opencores.org/lgpl.shtml //
|
// //
|
// //
|
*****************************************************************/
|
*****************************************************************/
|
|
|
#include "amber_registers.h"
|
#include "amber_registers.h"
|
|
#include "amber_macros.h"
|
|
|
.section .text
|
.section .text
|
.globl main
|
.globl main
|
main:
|
main:
|
|
|
/* 3 + 1 */
|
/* 3 + 1 */
|
mov r1, #3
|
mov r1, #3
|
mov r2, #1
|
mov r2, #1
|
add r3, r1, r2
|
add r3, r1, r2
|
cmp r3, #4
|
expect r3, 4, __LINE__
|
movne r10, #10
|
|
bne testfail
|
|
|
|
/* 0 + 0 */
|
/* 0 + 0 */
|
mov r4, #0
|
mov r4, #0
|
mov r5, #0
|
mov r5, #0
|
add r6, r5, r4
|
add r6, r5, r4
|
cmp r6, #0
|
expect r6, 0, __LINE__
|
movne r10, #20
|
|
bne testfail
|
|
|
|
/* 0 + -1 */
|
/* 0 + -1 */
|
mov r7, #0
|
mov r7, #0
|
mov r8, #-1
|
mov r8, #-1
|
add r9, r7, r8
|
add r9, r7, r8
|
cmp r9, #-1
|
expect r9, -1, __LINE__
|
movne r10, #30
|
|
bne testfail
|
|
|
|
/* -1 + 0 */
|
/* -1 + 0 */
|
mov r1, #-1
|
mov r1, #-1
|
mov r2, #0
|
mov r2, #0
|
add r3, r1, r2
|
add r3, r1, r2
|
cmp r3, #-1
|
expect r3, -1, __LINE__
|
movne r10, #40
|
|
bne testfail
|
|
|
|
/* -1 + -1 */
|
/* -1 + -1 */
|
mov r4, #-1
|
mov r4, #-1
|
mov r5, #-1
|
mov r5, #-1
|
add r6, r4, r5
|
add r6, r4, r5
|
cmp r6, #-2
|
expect r6, -2, __LINE__
|
movne r10, #50
|
|
bne testfail
|
|
|
|
/* -1 + -255 */
|
/* -1 + -255 */
|
mov r7, #-1
|
mov r7, #-1
|
mov r8, #-255
|
mov r8, #-255
|
add r9, r7, r8
|
add r9, r7, r8
|
cmp r9, #-256
|
expect r9, -256, __LINE__
|
movne r10, #60
|
|
bne testfail
|
|
|
|
/* 1 + 0x7fffffff */
|
/* 1 + 0x7fffffff */
|
ldr r1, MaxPos
|
ldr r1, MaxPos
|
mov r2, #1
|
mov r2, #1
|
adds r3, r1, r2
|
adds r3, r1, r2
|
/* this should generate an overflow */
|
/* this should generate an overflow */
|
/* so if the V flag is Clear then fail */
|
/* so if the V flag is Clear then fail */
|
bvc testfail
|
bvc testfail
|
ldr r0, MaxNeg
|
ldr r0, MaxNeg
|
cmp r0, r3
|
compare r0, r3, __LINE__
|
movne r10, #70
|
|
bne testfail
|
|
b testpass
|
b testpass
|
|
|
testfail:
|
testfail:
|
ldr r11, AdrTestStatus
|
ldr r11, AdrTestStatus
|
str r10, [r11]
|
str r10, [r11]
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.