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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [and.S] - Blame information for rev 82

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

Line No. Rev Author Line
1 82 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
#include "amber_macros.h"
43
 
44
        .section .text
45
        .globl  main
46
main:
47
        // sets all four flags
48
        // Cant use p version of instrustion in 32-bit CPU because it writes the upper 4 bits of PC
49
        teqp    pc, #0xf0000000
50
 
51
        //
52
        // Check that they are set
53
        bvc     testfail  // V flag
54
        bpl     testfail  // N flag
55
        bne     testfail  // Z flag
56
        bcc     testfail  // C flag
57
 
58
        mov     r1, #0x0000005a
59
 
60
        // should not unset the V flag value
61
        ands    r2, r1, #0x00000055
62
 
63
        // Check the V flag is still set, the Z flag is clear the C flag
64
        // gets the carry out value from the barrel shifter, which is
65
        // the C flag in this case, and the N flag gets cleared
66
        bvc     testfail
67
        beq     testfail
68
        bcc     testfail
69
        bmi     testfail
70
 
71
        tst     r2, #0x00000050
72
        beq     testfail
73
 
74
        b       testpass
75
 
76
testfail:
77
        ldr     r11, AdrTestStatus
78
        str     r10, [r11]
79
        b       testfail
80
 
81
testpass:
82
        ldr     r11, AdrTestStatus
83
        mov     r10, #17
84
        str     r10, [r11]
85
        b       testpass
86
 
87
 
88
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
89
 

powered by: WebSVN 2.1.0

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