Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / isa3 / isa3_pmu_e2_t1.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: isa3_pmu_e2_t1.s
5* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
6* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
7*
8* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9*
10* This program is free software; you can redistribute it and/or modify
11* it under the terms of the GNU General Public License as published by
12* the Free Software Foundation; version 2 of the License.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License
20* along with this program; if not, write to the Free Software
21* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*
23* For the avoidance of doubt, and except that if any non-GPL license
24* choice is available it will apply instead, Sun elects to use only
25* the General Public License version 2 (GPLv2) at this time for any
26* software where a choice of GPL license versions is made
27* available with the language indicating that GPLv2 or any later version
28* may be used, or where a choice of which version of the GPL is applied is
29* otherwise unspecified.
30*
31* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
32* CA 95054 USA or visit www.sun.com if you need additional information or
33* have any questions.
34*
35*
36* ========== Copyright Header End ============================================
37*/
38#define MAIN_PAGE_NUCLEUS_ALSO
39#include "hboot.s"
40/************************************************************************
41 Test case code start
42 ************************************************************************/
43
44.text
45.global main
46
47main: /* test begin */
48
49!
50! Thread 0 Start
51!
52!main_t0:
53 !# Initialize registers ..
54
55 !# Global registers
56 !# Input registers
57 !# Local registers
58 set 0x10088042, %l0 ! count completed branches
59 set 0x10108082, %l1 ! count taken branches (mispredicted)
60 set 0x10208102, %l2 ! count floats
61 set 0x10408202, %l3 ! count loads
62 set 0x10808402, %l4 ! count stores
63 set 0x11008802, %l5 ! count sethi (software count instr)
64 set 0x12009002, %l6 ! count other instructions
65 !# Output registers
66 !# Float registers
67 !# Other state
68
69 !# Execute Main Diag ..
70 ta T_CHANGE_PRIV ! Should cause Watchdog_reset trap
71
72 rd %pic, %g2 ! load the current pic value into %g2
73 wr %g0, %g0, %pic ! zero out the counter
74
75
76 ! before sending branches, update the PCR to be in UT.?
77 rd %pcr, %g3 ! load the current pcr value into %g3
78
79cnt_br:
80 wr %l0, %g0, %pcr ! count branches
81
82 cmp %g0, %g2
83 bne,pn %icc, fail ! no branching
84 brz %l0, fail ! no branching
85 rd %pic, %g2 ! load the current pic value into %g2
86
87 addcc %g0, 0x0002, %g5! keep track of counts
88
89cnt_taken_br:
90 wr %l1, %g0, %pcr ! count taken branches
91 inc %g5
92 brz %g0, cnt_float ! branching
93 sub %g0, 0x0001, %g2
94 inc %g5 ! this does not get executed
95
96cnt_float:
97 wr %l2, %g0, %pcr ! count floats
98 rd %pic, %g2 ! load the current pic value into %g2
99
100 fadds %f0, %f1, %f2
101 rd %pic, %g2 ! load the current pic value into %g2
102 addcc %g0, 0x0001, %g2
103 inc %g5
104
105 faddd %f2, %f4, %f6
106 rd %pic, %g2 ! load the current pic value into %g2
107 inc %g5
108
109 !testing... inserting other instructions
110 addcc %g0, 0x0000, %g2
111 setx 0xDEADBEEF11111111, %g2, %g4
112 addcc %g0, 0x0000, %g2
113 setx load_1, %g2, %g3
114
115
116 ld [%g3 + %g0], %g6
117
118cnt_ld:
119 wr %l3, %g0, %pcr !count loads
120 ld [%g3 + 0x0], %g2
121 ld [%g3 + 0x10], %g6
122 inc %g5
123 inc %g5
124
125cnt_st:
126 wr %l4, %g0, %pcr !count stores
127 add %g0, 0x0000, %g2
128 setx store_1, %g2, %o6
129 rd %pic, %g2 ! load the current pic value into %g2
130 stx %o6, [%g3 + 0x10]
131 rd %pic, %g2 ! load the current pic value into %g2
132 !ldd [%l7 + 0x28], %g6 !this fails the test in boot.s mode... ??? debug soon.
133 inc %g5
134 inc %g5 ! this one to take the wrasr into account... need to revisit
135
136cnt_sethi:
137 wr %l5, %g0, %pcr !count sethi
138 rd %pic, %g2 ! load the current pic value into %g2
139
140 ! this sethi is not counted... not recognized by DEC
141 sethi %hi(0x0fc000), %g0 !software count inst
142 inc %g5
143 rd %pic, %g2 ! load the current pic value into %g2
144
145cnt_other_inst:
146 wr %l6, %g0, %pcr !count other inst
147 inc %g5
148 inc %g5
149
150stop_cnt:
151 wr %g0, %g0, %pcr !stop counting
152
153 add %g0, 0x0003, %g4
154 rd %pic, %g2 !check pic value
155 cmp %g2, %g5
156 bne,pn %icc, fail
157
158 nop
159
160done:
161 EXIT_GOOD /* test finish */
162fail:
163 EXIT_BAD /* bad count */
164
165/************************************************************************
166 Test case data start
167 ************************************************************************/
168.data
169user_data_start:
170scratch_area:
171.align 16
172load_1:
173.word 0xFFFF2e2d
174.word 0x2e2dFFFF
175.align 16
176
177store_1:
178.align 16
179.word 0xDEADBEEF
180.word 0xAAAAAAAA
181.align 16
182
183.end