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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [bic_bug.S] - Blame information for rev 53

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
//  Test added to catch specific bug with bic during Linux      //
10
//  kernel_init. The following instruction stored the result    //
11
//  in r3, instead of r2                                        //
12
//  c00b229c:   e1120310        tst     r2, r0, lsl r3          //
13
//  c00b22a0:   11c22310        bicne   r2, r2, r0, lsl r3      //
14
//                                                              //
15
//  Author(s):                                                  //
16
//      - Conor Santifort, csantifort.amber@gmail.com           //
17
//                                                              //
18
//////////////////////////////////////////////////////////////////
19
//                                                              //
20
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
21
//                                                              //
22
// This source file may be used and distributed without         //
23
// restriction provided that this copyright statement is not    //
24
// removed from the file and that any derivative work contains  //
25
// the original copyright notice and the associated disclaimer. //
26
//                                                              //
27
// This source file is free software; you can redistribute it   //
28
// and/or modify it under the terms of the GNU Lesser General   //
29
// Public License as published by the Free Software Foundation; //
30
// either version 2.1 of the License, or (at your option) any   //
31
// later version.                                               //
32
//                                                              //
33
// This source is distributed in the hope that it will be       //
34
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
35
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
36
// PURPOSE.  See the GNU Lesser General Public License for more //
37
// details.                                                     //
38
//                                                              //
39
// You should have received a copy of the GNU Lesser General    //
40
// Public License along with this source; if not, download it   //
41
// from http://www.opencores.org/lgpl.shtml                     //
42
//                                                              //
43
*****************************************************************/
44
 
45
#include "amber_registers.h"
46
 
47
        .section .text
48
        .globl  main
49
main:
50
 
51
/* bicne   r2, r2, r0, lsl r3  with r3 = 0 */
52
        mov     r3, #0
53
        mov     r0, #0x01
54
        mov     r2, #0xff
55
        tst         r2, r0, lsl r3   /* r2 and  ( r0 << r3 ) */
56
        bicne   r2, r2, r0, lsl r3
57
 
58
        cmp     r2, #0xfe
59
        movne   r10, #10
60
        bne     testfail
61
 
62
        cmp     r3, #0x0
63
        movne   r10, #20
64
        bne     testfail
65
 
66
/* bicne   r2, r2, r0, lsl r3  with r3 = 1 */
67
        mov     r3, #1
68
        mov     r2, #0xff
69
        tst         r2, r0, lsl r3   /* r2 and  ( r0 << r3 ) */
70
        bicne   r2, r2, r0, lsl r3
71
 
72
        cmp     r2, #0xfd
73
        movne   r10, #30
74
        bne     testfail
75
 
76
        cmp     r3, #0x1
77
        movne   r10, #40
78
        bne     testfail
79
 
80
 
81
/* bicne   r2, r2, r0, lsl r3  with r3 = 1, r2 = 0xf0 */
82
/* So bit 1 of r2 is already a zero, the bic should
83
   not execute */
84
        mov     r3, #1
85
        mov     r2, #0xf0
86
        tst         r2, r0, lsl r3   /* r2 and  ( r0 << r3 ) */
87
        bicne   r2, r2, r0, lsl r3
88
        movne   r2, #0x00            /* add the mov here, just so I can verify
89
                                        that the NE condition is false and neither
90
                                        bic or mov execute */
91
 
92
        cmp     r2, #0xf0
93
        movne   r10, #50
94
        bne     testfail
95
 
96
        cmp     r3, #0x1
97
        movne   r10, #60
98
        bne     testfail
99
 
100
 
101
 
102
@ ------------------------------------------------
103
@ ------------------------------------------------
104
        b       testpass
105
 
106
testfail:
107
        ldr     r11, AdrTestStatus
108
        str     r10, [r11]
109
        b       testfail
110
 
111
testpass:
112
        ldr     r11, AdrTestStatus
113
        mov     r10, #17
114
        str     r10, [r11]
115
        b       testpass
116
 
117
 
118
/* Write 17 to this address to generate a Test Passed message */
119
AdrTestStatus:  .word ADR_AMBER_TEST_STATUS
120
 
121
/* ========================================================================= */
122
/* ========================================================================= */
123
 
124
 

powered by: WebSVN 2.1.0

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