Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / common / pli / global_chkr / c / src / global_chkr.h
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: global_chkr.h
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#include <stdio.h>
39#include <stdlib.h>
40#include <strings.h>
41
42#include "veriuser.h"
43#include "vcsuser.h"
44
45#define MAX_CORES 8
46#define MAX_BANKS 8
47#define MAX_PANELS 8
48#define DC_ENTRIES_PER_PANEL 8
49#define IC_ENTRIES_PER_PANEL 8
50#define DC_WAYS 4
51#define IC_WAYS 8
52#define DC 1
53#define IC 0
54
55struct dcache_dir
56{
57 int valid;
58 int l2_index;
59 int l2_way;
60 int l2_pa;
61};
62
63struct icache_dir
64{
65 int valid;
66 int l2_index;
67 int l2_way;
68 int l2_pa;
69};
70
71//created for debug. Shows the actual cache contents for a particular l2 bank
72struct cache
73{
74 int valid;
75 int way;
76 int l1_tag;
77 int l1_index;
78};
79
80struct l1dump_variables
81{
82 char *dtag[MAX_CORES][DC_WAYS]; //L1-dtags for 8 cores
83 char *itag[MAX_CORES][IC_WAYS]; //L1-itags for 8 cores
84 int dtag_ngroups;
85 int dtag_mem_size;
86 int itag_ngroups;
87 int itag_mem_size;
88 char *dvld[MAX_CORES]; //L1-dvld array for 8 cores
89 char *ivld[MAX_CORES]; //L1-ivld array for 8 cores
90 int dvld_ngroups;
91 int dvld_mem_size;
92 int ivld_ngroups;
93 int ivld_mem_size;
94 struct dcache_dir dc[MAX_CORES][DC_ENTRIES_PER_PANEL]; //D$ created for chkr comparison
95 struct icache_dir ic[MAX_CORES][IC_ENTRIES_PER_PANEL]; //I$ created for chkr comparison
96};
97
98struct l2tag_dir_variables
99{
100 char *l2t_lft[MAX_BANKS][8]; //l2t left array for 8 quad/bank for the 8 banks
101 char *l2t_rgt[MAX_BANKS][8]; //l2t right array for 8 quad/bank for the 8 banks
102 int l2t_lft_ngroups;
103 int l2t_lft_mem_size;
104 int l2t_rgt_ngroups;
105 int l2t_rgt_mem_size;
106
107 char *l2_ddir[MAX_BANKS][MAX_PANELS]; // l2-D directory data for 8 panels for 8 banks
108 p_vecval l2_dvld[MAX_BANKS][MAX_PANELS]; // l2-dvld data for 8 panels for 8 banks
109 int l2ddir_ngroups;
110 int l2ddir_mem_size;
111 int l2dvld_ngroups;
112
113 char *l2_idir[MAX_BANKS][MAX_PANELS]; // l2-I directory data for 8 panels for 8 banks
114 p_vecval l2_ivld[MAX_BANKS][MAX_PANELS]; //l2-ivld data for 8 panels for 8 banks
115 int l2idir_ngroups;
116 int l2idir_mem_size;
117 int l2ivld_ngroups;
118};
119
120
121static struct l1dump_variables l1vars;
122static struct l2tag_dir_variables l2vars;
123static int core_present;
124static int gchkr_debug;
125static int hash_on;
126static long long int good_trap_addr[8];
127
128void init_chkr_caches(int bank, int panel);
129void create_dcdir(int bank, int panel);
130void create_icdir(int bank, int panel);
131int get_l2tag(int bank, int l2index, int l2way);
132int get_lword(int in_val);
133int get_rword(int in_val);
134int cmp_dcdir(int bank, int panel);
135int cmp_icdir(int bank, int panel);
136int cmp_dc_core_data(int core, int bank, int panel, struct cache dc[]);
137int cmp_ic_core_data(int core, int bank, int panel, struct cache ic[]);
138int get_l2dir_vld(int bank, int panel, int addr, int type);
139int get_dc_vld_data(int core, int addr);
140int get_ic_vld_data(int core, int addr);
141void display_cache_entry(int core, int entry, int type);
142void dump_l2dcdir(int bank, int panel);
143void dump_l2icdir(int bank, int panel);
144void dump_dc(int core, int bank, int panel, struct cache dc[]);
145void dump_ic(int core, int bank, int panel, struct cache ic[]);
146void disp_chkr_caches(void);
147int chk_ic_dc_exclusion(int bank, int panel);
148void sample_plusargs(void);
149int is_reset_addr(long long l2pa);
150int get_unhashed_index(int l2_pa, int l2_ind);