1 |
82 |
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 add with carry //
|
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 |
|
|
// Test "Strange issue with r12 after TEQLSP"
|
42 |
|
|
// Tests for bug where testlsp command would switch the core
|
43 |
|
|
// from supervisor into FIRQ mode if it were executed. However the condition is not
|
44 |
|
|
// met so it is not executed. Thje bug is the next instrument works in FIRQ mode anyway.
|
45 |
|
|
// This was caused because the mode bits used in the ececute stage were not conditional on the
|
46 |
|
|
// teq instrumention being executed.
|
47 |
|
|
|
48 |
|
|
#include "amber_registers.h"
|
49 |
|
|
#include "amber_macros.h"
|
50 |
|
|
|
51 |
|
|
.section .text
|
52 |
|
|
.globl main
|
53 |
|
|
main:
|
54 |
|
|
|
55 |
|
|
// Test "Strange issue with r12 after TEQLSP"
|
56 |
|
|
mov r1, #0x0
|
57 |
|
|
mov r2, #0x1
|
58 |
|
|
mov r6, #10
|
59 |
|
|
mov r12, #100
|
60 |
|
|
nop
|
61 |
|
|
|
62 |
|
|
// this next instrument does not get executed because 'ls' condition is false
|
63 |
|
|
teqlsp r1, r2 // r1 XOR r2 = 0x1 -> sets the mode bits of the PC to 1
|
64 |
|
|
mov r12, r6 // user r12 or FIRQ r12 ?
|
65 |
|
|
|
66 |
|
|
cmp r12, r6 // error if user mode r12 was not updated with new value
|
67 |
|
|
bne testfail
|
68 |
|
|
|
69 |
|
|
b testpass
|
70 |
|
|
|
71 |
|
|
testfail:
|
72 |
|
|
ldr r11, AdrTestStatus
|
73 |
|
|
str r10, [r11]
|
74 |
|
|
b testfail
|
75 |
|
|
|
76 |
|
|
testpass:
|
77 |
|
|
ldr r11, AdrTestStatus
|
78 |
|
|
mov r10, #17
|
79 |
|
|
str r10, [r11]
|
80 |
|
|
b testpass
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
AdrTestStatus: .word ADR_AMBER_TEST_STATUS
|
84 |
|
|
|