OpenCores
URL https://opencores.org/ocsvn/amber/amber/trunk

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [sub.S] - Blame information for rev 53

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 csantifort
/*****************************************************************
2
//                                                              //
3
//  Amber 2 Core Instruction Test                               //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  Tests sub and subs                                          //
10
//                                                              //
11
//  Author(s):                                                  //
12
//      - Conor Santifort, csantifort.amber@gmail.com           //
13
//                                                              //
14 11 csantifort
/*****************************************************************
15
//                                                              //
16
//  Amber 2 Core Instruction Test                               //
17
//                                                              //
18
//  This file is part of the Amber project                      //
19
//  http://www.opencores.org/project,amber                      //
20
//                                                              //
21
//  Description                                                 //
22
//  Tests sub and subs instructions                             //
23
//                                                              //
24
//  Author(s):                                                  //
25
//      - Conor Santifort, csantifort.amber@gmail.com           //
26
//                                                              //
27 2 csantifort
//////////////////////////////////////////////////////////////////
28
//                                                              //
29
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
30
//                                                              //
31
// This source file may be used and distributed without         //
32
// restriction provided that this copyright statement is not    //
33
// removed from the file and that any derivative work contains  //
34
// the original copyright notice and the associated disclaimer. //
35
//                                                              //
36
// This source file is free software; you can redistribute it   //
37
// and/or modify it under the terms of the GNU Lesser General   //
38
// Public License as published by the Free Software Foundation; //
39
// either version 2.1 of the License, or (at your option) any   //
40
// later version.                                               //
41
//                                                              //
42
// This source is distributed in the hope that it will be       //
43
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
44
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
45
// PURPOSE.  See the GNU Lesser General Public License for more //
46
// details.                                                     //
47
//                                                              //
48
// You should have received a copy of the GNU Lesser General    //
49
// Public License along with this source; if not, download it   //
50
// from http://www.opencores.org/lgpl.shtml                     //
51
//                                                              //
52
*****************************************************************/
53
 
54
#include "amber_registers.h"
55
 
56
        .section .text
57
        .globl  main
58
main:
59 11 csantifort
        ldr     r0, =Data1
60
        ldr     r6, Data2
61
        ldr     lr, =1f
62
        mov     pc, lr
63
 
64
        @ Test subs
65
1:      ldr     r3, [r0]
66
        subs    r2,  r3,  #1
67
        cmpcs   r2,  r6
68
        movcs   r3,  #0
69
        cmp     r3,  #0
70 2 csantifort
 
71 11 csantifort
        movne   r10, #10
72
        bne     testfail
73 2 csantifort
 
74
 
75 11 csantifort
        @ Test sub
76
/* 1 - 0x7fffffff */
77
        ldr     r1, MaxPos
78
        mov     r2, #1
79
        sub     r3, r2, r1
80
        ldr     r4, MaxNeg
81
        add     r4, r4, #2
82
        cmp     r4, r3
83
        movne   r10, #20
84
        bne     testfail
85
 
86
        b       testpass
87 2 csantifort
 
88 11 csantifort
 
89 2 csantifort
testfail:
90
        ldr     r11, AdrTestStatus
91
        str     r10, [r11]
92
        b       testfail
93
 
94
testpass:
95
        ldr     r11, AdrTestStatus
96
        mov     r10, #17
97
        str     r10, [r11]
98
        b       testpass
99
 
100
 
101
/* Write 17 to this address to generate a Test Passed message */
102
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
103
MaxPos:         .word  0x7fffffff
104 11 csantifort
MaxNeg:         .word  0x80000000
105
Data1:          .word  0x03000000
106
Data2:          .word  0x020febed
107 2 csantifort
/* ========================================================================= */
108
/* ========================================================================= */
109
 
110
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.