Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / cmp / ncu_ssi_clk_ratio_test.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: ncu_ssi_clk_ratio_test.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#define MAIN_PAGE_HV_ALSO
40
41#include "hboot.s"
42#include "asi_s.h"
43
44.text
45.global main
46
47main:
48 ta T_CHANGE_HPRIV
49
50get_th_id:
51 ta T_RD_THID
52 wr %g0,ASI_CMP_CORE,%asi
53
54 cmp %o1,0x0
55 bne test_fail
56 nop
57
58 setx 0x8000003040,%g7,%g1
59 ldx [%g1],%g2
60 cmp %g2,0x1
61 be new_clk_ratio
62 nop
63
64!Write words to the SSI interface
65 setx 0x000000ffffff0000,%g7,%g1
66 setx data_word,%g7,%g2
67 set 0x08,%g3
68loop0:
69 lduw [%g2],%g4
70 stw %g4,[%g1]
71 add %g1,4,%g1
72 add %g2,4,%g2
73 sub %g3,1,%g3
74 cmp %g3,%g0
75 bne loop0
76 nop
77
78! Reset to new clock ratio and warm reset
79 set 0x1,%g2
80 setx 0x8000003040,%g7,%g1
81 stx %g2,[%g1]
82 setx 0x8900000808,%g7,%g1
83 stx %g2,[%g1]
84
85halt:
86 ba halt
87 nop
88
89new_clk_ratio:
90!Read back and confirm
91 setx 0x000000ffffff0000,%g7,%g1
92 setx data_word,%g7,%g2
93 set 0x08,%g3
94loop1:
95 lduw [%g1],%g4
96 lduw [%g2],%g5
97 cmp %g4,%g5
98 bne %xcc,test_fail
99 nop
100 add %g1,4,%g1
101 add %g2,4,%g2
102 sub %g3,1,%g3
103 cmp %g3,%g0
104 bne loop1
105 nop
106
107 ba test_pass
108 nop
109
110/******************************************************
111 * Exit code
112 *******************************************************/
113
114test_pass:
115EXIT_GOOD
116
117test_fail:
118EXIT_BAD
119
120.data
121.align 0x100
122data_word:
123 .word 0x239232ab
124 .word 0x3923badf
125 .word 0x482ba83a
126 .word 0xa62ed082
127 .word 0xab667bdc
128 .word 0xc3923bef
129 .word 0x8faa9832
130 .word 0xdea02003
131 .word 0xb202023b
132 .word 0x2035723b
133 .word 0x9923ced7
134 .word 0x8a29823b
135 .word 0x33eeee9e
136 .word 0x5beaf092
137 .word 0xbfabfe22
138 .word 0xa0aaccde
139 .word 0x10a0a993
140 .word 0x02fccbef
141 .word 0xbcc553f3
142 .word 0xad20833f
143 .word 0xae29083a
144 .word 0x92298235
145 .word 0x447034b5
146 .word 0x3c3b24fd
147 .word 0xffce09df
148 .word 0xf198122f
149 .word 0x9fa32782
150 .word 0x6d329263
151 .word 0xeb887611
152 .word 0xda340823
153 .word 0xd3219bd7
154 .word 0xa8293200
155.end