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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [bl.S] - Blame information for rev 89

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 branch and link instruction                           //
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     r10, #100
48
        mov     r1, #37
49
        mov     r2, #47
50
        cmp     r1, r2
51
        movne   r3, #42
52
        moveq   r3, #0
53
        mov     r5, #0
54
 
55
        @ branch and link
56
        blne    1f
57
ret:
58
 
59
        cmp     r5, #0xff
60
        movne   r10, #10
61
        bne     testfail
62
 
63
        cmp     r1, #37
64
        movne   r10, #20
65
        bne     testfail
66
 
67
        cmp     r2, #47
68
        movne   r10, #30
69
        bne     testfail
70
 
71
        cmp     r3, #42
72
        movne   r10, #40
73
        bne     testfail
74
 
75
        b       testpass
76
 
77
 
78
        b       testfail
79
        b       testfail
80
 
81
        @ check that the link register gets the correct return address
82
1:      ldr     r6, =ret
83
        ldr     r7, PCMask
84
        and     r7, lr, r7
85
        cmp     r6, r7
86
        movne   r10, #80
87
        bne     testfail
88
 
89
        @ check that the value in r5 survives the jump back
90
        mov     r5, #0xff
91
        mov     pc, lr
92
        b       testfail
93
        b       testfail
94
 
95
 
96
testfail:
97
        ldr     r11, AdrTestStatus
98
        str     r10, [r11]
99
        b       testfail
100
 
101
testpass:
102
        ldr     r11, AdrTestStatus
103
        mov     r10, #17
104
        str     r10, [r11]
105
        b       testpass
106
 
107
 
108
/* Write 17 to this address to generate a Test Passed message */
109
AdrTestStatus:  .word ADR_AMBER_TEST_STATUS
110
PCMask:         .word 0x03fffffc
111
 
112
/* ========================================================================= */
113
/* ========================================================================= */
114
 
115
 

powered by: WebSVN 2.1.0

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