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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [barrel_shift_rs.S] - Blame information for rev 2

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
//  Test Rs barrel shifts                                       //
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
        @ ------------------------------------------------
47
        @ lsr
48
        @ test that shift of 0 leaves Rm unchanged
49
        @ ------------------------------------------------
50
        mov     r1, #8
51
        mov     r3, #0
52
        mov     r1, r1, lsr r3
53
 
54
        cmp     r1, #8
55
        movne   r10, #10
56
        bne     testfail
57
 
58
 
59
        @ ------------------------------------------------
60
        @ lsr
61
        @ test that shift of > 32 sets Rm and Cout to 0
62
        @ ------------------------------------------------
63
 
64
        @ set C Flag to 1
65
        mov     r4, pc
66
        orr     r4, r4, #0x20000000
67
        teqp    pc, r4
68
 
69
        @ check that the C Flag to 1
70
        mov     r7, pc
71
        ands    r7, r7, #0x20000000
72
        moveq   r10, #20
73
        beq     testfail
74
 
75
 
76
        mov     r1, #0xC0000003
77
        mov     r3, #255
78
        movs    r1, r1, lsr r3
79
 
80
        @ check that the carry flag has been cleared by the mov lsr operation
81
        mov     r4, pc
82
        ands    r4, r4, #0x20000000
83
        movne   r10, #30
84
        bne     testfail
85
 
86
 
87
@ ------------------------------------------------
88
@ ------------------------------------------------
89
        b       testpass
90
 
91
testfail:
92
        ldr     r11, AdrTestStatus
93
        str     r10, [r11]
94
        b       testfail
95
 
96
testpass:
97
        ldr     r11, AdrTestStatus
98
        mov     r10, #17
99
        str     r10, [r11]
100
        b       testpass
101
 
102
 
103
/* Write 17 to this address to generate a Test Passed message */
104
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
105
 
106
 
107
/* ========================================================================= */
108
/* ========================================================================= */
109
 
110
 

powered by: WebSVN 2.1.0

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