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

Subversion Repositories amber

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

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

powered by: WebSVN 2.1.0

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