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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [mov_rrx.S] - Blame information for rev 87

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 87 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 mov with RRX                                          //
10
//  Checks that the carry flag value is rotated into            //
11
//  target register                                             //
12
//  Author(s):                                                  //
13
//      - Conor Santifort, csantifort.amber@gmail.com           //
14
//                                                              //
15
//////////////////////////////////////////////////////////////////
16
//                                                              //
17
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
18
//                                                              //
19
// This source file may be used and distributed without         //
20
// restriction provided that this copyright statement is not    //
21
// removed from the file and that any derivative work contains  //
22
// the original copyright notice and the associated disclaimer. //
23
//                                                              //
24
// This source file is free software; you can redistribute it   //
25
// and/or modify it under the terms of the GNU Lesser General   //
26
// Public License as published by the Free Software Foundation; //
27
// either version 2.1 of the License, or (at your option) any   //
28
// later version.                                               //
29
//                                                              //
30
// This source is distributed in the hope that it will be       //
31
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
32
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
33
// PURPOSE.  See the GNU Lesser General Public License for more //
34
// details.                                                     //
35
//                                                              //
36
// You should have received a copy of the GNU Lesser General    //
37
// Public License along with this source; if not, download it   //
38
// from http://www.opencores.org/lgpl.shtml                     //
39
//                                                              //
40
*****************************************************************/
41
 
42
#include "amber_registers.h"
43
#include "amber_macros.h"
44
 
45
        .section .text
46
        .globl  main
47
main:
48
        // sets the carry big
49
        // Cant use p version of instrustion in 32-bit CPU because it writes the upper 4 bits of PC
50
        teqp    pc, #0x20000000
51
        mov     r0, #0
52
        // without the 's' the rotation does not change the carry flag
53
        mov     r0, r0, rrx
54
        // carry flag should still be set
55
        bcc     testfail
56
        // check that r0 got the carry flag into bit 31
57
        cmp     r0, #0x80000000
58
        bne     testfail
59
 
60
        // same again, except with movs so the carry flag gets set to bit 0 of r0
61
        mov     r0, #0
62
        movs    r0, r0, rrx
63
        // carry flag should be cleared now
64
        bcs     testfail
65
        // check that r0 got the carry flag into bit 31
66
        cmp     r0, #0x80000000
67
        bne     testfail
68
 
69
        // check that carry flag can be set to 1 with same sequence
70
        mov     r0, #1
71
        teqp    pc, #0x00000000
72
        bcs     testfail
73
        movs    r0, r0, rrx
74
        bcc     testfail
75
        cmp     r0, #0x00000000
76
        bne     testfail
77
 
78
        b       testpass
79
 
80
testfail:
81
        ldr     r11, AdrTestStatus
82
        str     r10, [r11]
83
        b       testfail
84
 
85
testpass:
86
        ldr     r11, AdrTestStatus
87
        mov     r10, #17
88
        str     r10, [r11]
89
        b       testpass
90
 
91
 
92
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
93
 

powered by: WebSVN 2.1.0

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