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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [adc.S] - Blame information for rev 35

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 add 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 35 csantifort
#include "amber_macros.h"
43 2 csantifort
 
44
        .section .text
45
        .globl  main
46
main:
47
        ldr     r0, Data0
48
        ldr     r1, Data1
49
        ldr     r2, Data2
50
        ldr     r3, Data3
51
        ldr     r4, Result0
52
 
53
        adcs    r8, r0, r1
54
        adc     r8, r8, r3
55
 
56
        @ check that overflow flag has been set
57
        mov     r5, pc
58
        and     r5, r5, #0xf0000000 @ clear non-flag bits
59 35 csantifort
        expect  r5, 0x90000000, __LINE__
60 2 csantifort
 
61 35 csantifort
        @ fail if r4 not equal to r8
62
        compare r8, r4, __LINE__
63 2 csantifort
 
64
        b       testpass
65
 
66
 
67
testfail:
68
        ldr     r11, AdrTestStatus
69
        str     r10, [r11]
70
        b       testfail
71
 
72
testpass:
73
        ldr     r11, AdrTestStatus
74
        mov     r10, #17
75
        str     r10, [r11]
76
        b       testpass
77
 
78
 
79
/* Write 17 to this address to generate a Test Passed message */
80
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
81
Data0:          .word  0x40000000
82
Data1:          .word  0x40000000
83
Data2:          .word  0x10000000
84
Data3:          .word  0x10000000
85
Result0:        .word  0x90000000
86
 
87
/* ========================================================================= */
88
/* ========================================================================= */
89
 
90
 

powered by: WebSVN 2.1.0

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