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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [movs_bug.S] - Blame information for rev 19

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 linux memcpy          //
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
#include "amber_registers.h"
41
 
42
        .section .text
43
        .globl  main
44
main:
45
        @ setup
46
        ldr     r0,  AdrCopyDest
47
        ldr     r1,  AdrCopySource
48
        mov     r2,  #2
49
 
50
        @ memcpy code for 3 bytes or less
51
        subs    r2, r2, #4
52
        blt     bytes
53
 
54
        mov     r10, #10
55
        b       testfail
56
 
57
bytes:
58
        movs    r2, r2, lsl #31
59
        ldrneb  r3,  [r1], #1
60
        ldrcsb  r4,  [r1], #1
61
        ldrcsb  r12, [r1], #1
62
        strneb  r3,  [r0], #1
63
        strcsb  r4,  [r0], #1
64
        strcsb  r12, [r0], #1
65
 
66
 
67
        @ test that move worked
68
        ldr     r0, AdrCopyDest
69
        ldrb    r1, [r0], #1
70
        cmp     r1, #0x31
71
        movne   r10, #20
72
        bne     testfail
73
 
74
        ldrb    r1, [r0], #1
75
        cmp     r1, #0x0
76
        movne   r10, #30
77
        bne     testfail
78
 
79
@ ------------------------------------------------
80
@ ------------------------------------------------
81
        b       testpass
82
 
83
testfail:
84
        ldr     r11, AdrTestStatus
85
        str     r10, [r11]
86
        b       testfail
87
 
88
testpass:
89
        ldr     r11, AdrTestStatus
90
        mov     r10, #17
91
        str     r10, [r11]
92
        b       testpass
93
 
94
 
95
 
96
/* Write 17 to this address to generate a Test Passed message */
97
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
98
AdrCopyDest:    .word  Text2
99
AdrCopySource:  .word  Text1
100
 
101
Text1:          .ascii  "1\000"
102
                .align 2
103
Text2:          .ascii  "2222\000"
104
 
105
/* ========================================================================= */
106
/* ========================================================================= */
107
 
108
 

powered by: WebSVN 2.1.0

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