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

Subversion Repositories amber

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

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 83 csantifort
        // Check the V flag is still set, the Z flag is clear, the C flag
64
        // gets cleared, and the N flag gets cleared
65 82 csantifort
        bvc     testfail
66
        beq     testfail
67 83 csantifort
        bcs     testfail
68 82 csantifort
        bmi     testfail
69
 
70
        tst     r2, #0x00000050
71
        beq     testfail
72
 
73
        b       testpass
74
 
75
testfail:
76
        ldr     r11, AdrTestStatus
77
        str     r10, [r11]
78
        b       testfail
79
 
80
testpass:
81
        ldr     r11, AdrTestStatus
82
        mov     r10, #17
83
        str     r10, [r11]
84
        b       testpass
85
 
86
 
87
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
88
 

powered by: WebSVN 2.1.0

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