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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [mlas_bug.S] - Blame information for rev 70

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
//  Bug with Multiply Accumulate. The flags were gettting set   //
10
//  1 cycle early. So in an operation with ( 0 x n ) + 1, the   //
11
//  Z flag was set because it didn't take into account the      //
12
//  addition done right at the end.                             //
13
//                                                              //
14
//  Author(s):                                                  //
15
//      - Conor Santifort, csantifort.amber@gmail.com           //
16
//                                                              //
17
//////////////////////////////////////////////////////////////////
18
//                                                              //
19
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
20
//                                                              //
21
// This source file may be used and distributed without         //
22
// restriction provided that this copyright statement is not    //
23
// removed from the file and that any derivative work contains  //
24
// the original copyright notice and the associated disclaimer. //
25
//                                                              //
26
// This source file is free software; you can redistribute it   //
27
// and/or modify it under the terms of the GNU Lesser General   //
28
// Public License as published by the Free Software Foundation; //
29
// either version 2.1 of the License, or (at your option) any   //
30
// later version.                                               //
31
//                                                              //
32
// This source is distributed in the hope that it will be       //
33
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
34
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
35
// PURPOSE.  See the GNU Lesser General Public License for more //
36
// details.                                                     //
37
//                                                              //
38
// You should have received a copy of the GNU Lesser General    //
39
// Public License along with this source; if not, download it   //
40
// from http://www.opencores.org/lgpl.shtml                     //
41
//                                                              //
42
*****************************************************************/
43
 
44
#include "amber_registers.h"
45
 
46
 
47
        .section .text
48
        .globl  main
49
main:
50
 
51
  @ r6 = mode
52
  @ r3 = inode->i_mode
53
 
54
        @ setup
55
        mov     r0, #0
56
        mov     r1, #4
57 70 csantifort
        mov     sp, #StackArea
58 2 csantifort
 
59
        @ -------------------------------------
60
        @ Replicated code from Linux Kernel
61
        @ chip.c / set_irq_chip
62
 
63
        stmda   sp,{r4, r5, r6, lr}
64
        ldr     r3, [pc, #120]  @ 2e53ac 
65
        ldr     r3, [r3]
66
        cmp     r0, r3
67
        mov     r5, r1
68
        bcs     j1
69
        ldr     r2, [pc, #104]  @ 2e53b0 
70
        mov     r3, #60 @ 0x3c
71
        mlas    r6, r0, r3, r2  @ if result == 0 -> warn_slowpath
72
        bne     j2
73
j1:
74
        mov     r3, r0
75
        mov     r1, #95 @ 0x5f
76
        ldr     r0, [pc, #84]   @ 2e53b4 
77
        ldr     r2, [pc, #84]   @ 2e53b8 
78
        bl      warn_slowpath
79
        mvn     r0, #21 @ 0x15
80
        ldmib   sp, {r4, r5, r6, pc}
81
j2:
82
        ldr     r3, [pc, #72]   @ 2e53bc 
83
        cmp     r1, #0  @ 0x0
84
        moveq   r5, r3
85
        mov     r4, pc
86
        orr     r3, r4, #128    @ 0x80
87
        teqp    pc, r3
88
        mov     r0, r5
89
        bl      irq_chip_set_defaults
90
        ands    r0, r4, #128    @ 0x80
91
        str     r5, [r6, #8]
92
        beq     j3
93
        teqp    pc, r4
94
        mov     r0, #0  @ 0x0
95
        ldmib   sp, {r4, r5, r6, pc}
96
j3:
97
        teqp    pc, r4
98
        ldmib   sp,     {r4, r5, r6, pc}
99
        .word   nr_irqs
100
        .word   0xc04c6ce4
101
        .word   0xc0482c14
102
        .word   0xc0482c28
103
        .word   0xc04c77e8
104
 
105
nr_irqs:
106
        .word   47
107
 
108
        b       testpass
109
 
110
        @ -------------------------------------
111
warn_slowpath:
112
        mov     r10, #20
113
        b       testfail
114
 
115
irq_chip_set_defaults:
116
        b       testpass
117
 
118
 
119
testfail:
120
        ldr     r11, AdrTestStatus
121
        str     r10, [r11]
122
        b       testfail
123
 
124
testpass:
125
        ldr     r11, AdrTestStatus
126
        mov     r10, #17
127
        str     r10, [r11]
128
        b       testpass
129
 
130
 
131
/* Write 17 to this address to generate a Test Passed message */
132
AdrTestStatus:              .word ADR_AMBER_TEST_STATUS
133
 
134 70 csantifort
        .word   0
135
        .word   0
136
        .word   0
137
        .word   0
138
StackArea:

powered by: WebSVN 2.1.0

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