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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [sbc.S] - Blame information for rev 57

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 64-bit subtractions using sbc (subtract with carry)   //
10
//                                                              //
11
//  Author(s):                                                  //
12
//      - Conor Santifort, csantifort.amber@gmail.com           //
13
//                                                              //
14
//////////////////////////////////////////////////////////////////
15
//                                                              //
16
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
17
//                                                              //
18
// This source file may be used and distributed without         //
19
// restriction provided that this copyright statement is not    //
20
// removed from the file and that any derivative work contains  //
21
// the original copyright notice and the associated disclaimer. //
22
//                                                              //
23
// This source file is free software; you can redistribute it   //
24
// and/or modify it under the terms of the GNU Lesser General   //
25
// Public License as published by the Free Software Foundation; //
26
// either version 2.1 of the License, or (at your option) any   //
27
// later version.                                               //
28
//                                                              //
29
// This source is distributed in the hope that it will be       //
30
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
31
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
32
// PURPOSE.  See the GNU Lesser General Public License for more //
33
// details.                                                     //
34
//                                                              //
35
// You should have received a copy of the GNU Lesser General    //
36
// Public License along with this source; if not, download it   //
37
// from http://www.opencores.org/lgpl.shtml                     //
38
//                                                              //
39
*****************************************************************/
40
 
41
#include "amber_registers.h"
42
 
43
        .section .text
44
        .globl  main
45
main:
46
 
47
        mov     r12, #0
48
 
49
 
50
loop:   ldr     r0, AdrData1
51
        add     r0, r0, r12, lsl #3  @ double-word elements
52
        ldr     r1, [r0], #4
53
        ldr     r2, [r0]
54
 
55
        ldr     r3, AdrData2
56
        add     r3, r3, r12, lsl #3  @ double-word elements
57
        ldr     r4, [r3], #4
58
        ldr     r5, [r3]
59
 
60
        @ {r1, r2} - {r4, r5}
61
        subs    r6, r2, r5
62
        sbc     r7, r1, r4
63
 
64
        ldr     r0, AdrAnswers
65
        add     r0, r0, r12, lsl #3  @ double-word elements
66
        ldr     r1, [r0], #4
67
        ldr     r2, [r0]
68
 
69
        cmp     r1, r7
70
        movne   r10, #10
71
        bne     testfail
72
        cmp     r2, r6
73
        movne   r10, #20
74
        bne     testfail
75
 
76
        @ increment loop counter
77
        cmp     r12, #2
78
        beq     testpass
79
        add     r12, r12, #1
80
        b       loop
81
 
82
testfail:
83
        ldr     r11, AdrTestStatus
84
        str     r10, [r11]
85
        b       testfail
86
 
87
testpass:
88
        ldr     r11, AdrTestStatus
89
        mov     r10, #17
90
        str     r10, [r11]
91
        b       testpass
92
 
93
 
94
 
95
/* Write 17 to this address to generate a Test Passed message */
96
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
97
AdrData1:       .word  Data1
98
AdrData2:       .word  Data2
99
AdrAnswers:     .word  Answers
100
 
101
Data1:
102
@ HiWord, LoWord
103
.word 0x10000000
104
.word 0x00000001
105
.word 0x10000000
106
.word 0x00000000
107
.word 0x00000001
108
.word 0xc8d14800
109
 
110
Data2:
111
@ HiWord, LoWord
112
.word 0x08000000
113
.word 0x00000001
114
.word 0x08000000
115
.word 0xffffffff
116
.word 0x00000000
117
.word 0x3b9aca00
118
 
119
Answers:
120
@ HiWord, LoWord
121
.word 0x08000000
122
.word 0x00000000
123
.word 0x07ffffff
124
.word 0x00000001
125
.word 0x00000001
126
.word 0x8d367e00
127
 
128
 
129
/* ========================================================================= */
130
/* ========================================================================= */
131
 
132
 

powered by: WebSVN 2.1.0

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