Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / cpu / sparc / memtest.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: memtest.fth
4\
5\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6\
7\ - Do no alter or remove copyright notices
8\
9\ - Redistribution and use of this software in source and binary forms, with
10\ or without modification, are permitted provided that the following
11\ conditions are met:
12\
13\ - Redistribution of source code must retain the above copyright notice,
14\ this list of conditions and the following disclaimer.
15\
16\ - Redistribution in binary form must reproduce the above copyright notice,
17\ this list of conditions and the following disclaimer in the
18\ documentation and/or other materials provided with the distribution.
19\
20\ Neither the name of Sun Microsystems, Inc. or the names of contributors
21\ may be used to endorse or promote products derived from this software
22\ without specific prior written permission.
23\
24\ This software is provided "AS IS," without a warranty of any kind.
25\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
26\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
27\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
28\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
29\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
31\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
32\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
33\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
34\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
35\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36\
37\ You acknowledge that this software is not designed, licensed or
38\ intended for use in the design, construction, operation or maintenance of
39\ any nuclear facility.
40\
41\ ========== Copyright Header End ============================================
42id: @(#)memtest.fth 1.3 94/05/30
43purpose: Fast memory test
44copyright: Copyright 1992 Sun Microsystems, Inc. All Rights Reserved
45
46headerless
47code test-memory ( start-addr count -- obs-data exp-data fail-adr true | false )
48
49 tos scr move \ count in scr
50 sp 0 sc1 nget \ start in sc1
51
52 \ Backwards fill with 0
53 scr sc2 move
54 0 F: bra \ jump to the until branch
55 nop
56 begin
57 %g0 sc1 sc2 st
58 0 L:
59 sc2 4 sc2 subcc
60 0< until
61 nop \ Delay slot
62
63 \ Forward test for 0 and fill with -1
64 -1 sc4 set
65 %g0 sc2 move
66 0 F: bra \ jump to the until branch
67 nop
68 begin
69 sc1 sc2 sc3 ld
70 sc3 %g0 %g0 subcc
71 0<> if nop
72 -1 tos move \ fail
73 sp 2 /n* sp sub \ Make room on the stack
74 sc1 sc2 sc1 add \ failed address
75 sc1 sp 0 /n* nput \ failed adr
76 %g0 sp 1 /n* nput \ expected data
77 sc3 sp 2 /n* nput \ observed data
78 next \ exit
79 then
80 sc4 sc1 sc2 st
81 sc2 4 sc2 add
82 0 L:
83 scr sc2 %g0 subcc
84 0<= until
85 nop \ Delay slot
86
87 \ Backwards check for -1 and fill with 0
88 -1 sc4 set
89 scr sc2 move
90 0 F: bra \ jump to the until branch
91 nop
92 begin
93 sc1 sc2 sc3 ld
94 sc3 sc4 %g0 subcc
95 0<> if nop
96 -1 tos move \ fail
97 sc1 sc2 sc1 add \ failed address
98 sc1 sp 0 /n* nput
99 sc4 sp 1 /n* nput \ expected data
100 sc3 sp 2 /n* nput \ observed data
101 next \ exit
102 then
103 %g0 sc1 sc2 st
104 0 L:
105 sc2 4 sc2 subcc
106 0< until
107 nop \ Delay slot
108
109 0 tos move \ put false (=pass) on stack
110 sp /n sp add \ "
111c;
112headers
113