Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: SS_Assembly.cc | |
4 | // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
5 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
6 | // | |
7 | // The above named program is free software; you can redistribute it and/or | |
8 | // modify it under the terms of the GNU General Public | |
9 | // License version 2 as published by the Free Software Foundation. | |
10 | // | |
11 | // The above named program is distributed in the hope that it will be | |
12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | // General Public License for more details. | |
15 | // | |
16 | // You should have received a copy of the GNU General Public | |
17 | // License along with this work; if not, write to the Free Software | |
18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | // | |
20 | // ========== Copyright Header End ============================================ | |
21 | ||
22 | #include <assert.h> | |
23 | #include <stdio.h> | |
24 | #include <stdlib.h> | |
25 | #include "SS_Strand.h" | |
26 | ||
27 | int main() | |
28 | { | |
29 | SS_Strand* s = 0; | |
30 | SS_Instr* i = 0; | |
31 | ||
32 | if (ptr_ofs(SS_Strand,irf) != 0) | |
33 | { | |
34 | fprintf(stderr,"SS_Strand::irf needs to be first member of SS_Strand (no virtuals allowed)\n"); | |
35 | exit(-1); | |
36 | } | |
37 | ||
38 | printf("#ifndef __SS_Assembly_h__\n"); | |
39 | printf("#define __SS_Assembly_h__\n"); | |
40 | printf("\n"); | |
41 | printf("#ifdef ARCH_V9\n"); | |
42 | printf("#define ldptr ldx\n"); | |
43 | printf("#define PTR_SIZE 8\n"); | |
44 | printf("#define PTR_SIZE_BITS 3\n"); | |
45 | printf("#else\n"); | |
46 | printf("#define ldptr ld\n"); | |
47 | printf("#define PTR_SIZE 4\n"); | |
48 | printf("#define PTR_SIZE_BITS 2\n"); | |
49 | printf("#endif\n"); | |
50 | printf("\n"); | |
51 | printf("#define R_PC %%o0\n"); | |
52 | printf("#define R_NPC %%o1\n"); | |
53 | printf("\n"); | |
54 | printf("#define S_PTR %%o2\n"); | |
55 | printf("#define S_PC %d\n",ptr_ofs(SS_Strand,pc)); | |
56 | printf("#define S_NPC %d\n",ptr_ofs(SS_Strand,npc)); | |
57 | printf("#define S_CCR %d\n",ptr_ofs(SS_Strand,ccr)); | |
58 | printf("#define S_FSR %d\n",ptr_ofs(SS_Strand,fsr)); | |
59 | printf("#define S_FSR_RUN %d\n",ptr_ofs(SS_Strand,fsr_run)); | |
60 | printf("#define S_FSR_TEM %d\n",ptr_ofs(SS_Strand,fsr_tem)); | |
61 | printf("#define S_FSR_EXC %d\n",ptr_ofs(SS_Strand,fsr_exc)); | |
62 | printf("#define S_FSR_CPU %d\n",ptr_ofs(SS_Strand,fsr_cpu)); | |
63 | printf("#define S_FSR_TMP %d\n",ptr_ofs(SS_Strand,fsr_tmp)); | |
64 | printf("#define S_GSR %d\n",ptr_ofs(SS_Strand,gsr)); | |
65 | printf("#define S_FPRS %d\n",ptr_ofs(SS_Strand,fprs)); | |
66 | printf("#define S_PSTATE %d\n",ptr_ofs(SS_Strand,pstate)); | |
67 | printf("#define S_SIM_STATE %d\n",ptr_ofs(SS_Strand,sim_state)); | |
68 | printf("#define S_Y %d\n",ptr_ofs(SS_Strand,y)); | |
69 | printf("#define S_ASI %d\n",ptr_ofs(SS_Strand,asi)); | |
70 | printf("#define S_INST_DEC %d\n",ptr_ofs(SS_Strand,inst_dec)); | |
71 | printf("#define S_V8_INST_DEC %d\n",ptr_ofs(SS_Strand,v8_inst_dec)); | |
72 | printf("#define S_TRAP %d\n",ptr_ofs(SS_Strand,trap)); | |
73 | printf("#define S_V8_TRAP %d\n",ptr_ofs(SS_Strand,v8_trap)); | |
74 | printf("#define S_INST_TRAP %d\n",ptr_ofs(SS_Strand,inst_trap)); | |
75 | printf("#define S_V8_INST_TRAP %d\n",ptr_ofs(SS_Strand,v8_inst_trap)); | |
76 | printf("#define S_INST_MMU %d\n",ptr_ofs(SS_Strand,inst_mmu)); | |
77 | printf("#define S_DATA_TRAP %d\n",ptr_ofs(SS_Strand,data_trap)); | |
78 | printf("#define S_V8_DATA_TRAP %d\n",ptr_ofs(SS_Strand,v8_data_trap)); | |
79 | printf("#define S_INVALID_ASI %d\n",ptr_ofs(SS_Strand,invalid_asi)); | |
80 | printf("#define S_V8_INVALID_ASI %d\n",ptr_ofs(SS_Strand,v8_invalid_asi)); | |
81 | printf("#define S_DATA_MMU %d\n",ptr_ofs(SS_Strand,data_mmu)); | |
82 | printf("#define S_V8_DATA_MMU %d\n",ptr_ofs(SS_Strand,v8_data_mmu)); | |
83 | printf("#define S_EXE_TABLE %d\n",ptr_ofs(SS_Strand,exe_table)); | |
84 | printf("#define S_V8_EXE_TABLE %d\n",ptr_ofs(SS_Strand,v8_exe_table)); | |
85 | printf("#define S_MEM_TABLE %d\n",ptr_ofs(SS_Strand,mem_table)); | |
86 | printf("#define S_FRF %d\n",ptr_ofs(SS_Strand,drf)); | |
87 | printf("#define S_WRF %d\n",ptr_ofs(SS_Strand,wrf)); | |
88 | printf("#define S_INST_CACHE %d\n",ptr_ofs(SS_Strand,inst_cache)); | |
89 | printf("#define S_INST_TTE %d\n",ptr_ofs(SS_Strand,inst_tte)); | |
90 | printf("#define S_FAIL_TTE %d\n",ptr_ofs(SS_Strand,fail_tte)); | |
91 | printf("#define S_STPARTIAL16 %d\n",ptr_ofs(SS_Strand,stpartial16[0])); | |
92 | printf("#define S_STPARTIAL32 %d\n",ptr_ofs(SS_Strand,stpartial32[0])); | |
93 | printf("#define S_MEM_MASK %d\n",ptr_ofs(SS_Strand,mem_mask)); | |
94 | printf("#define S_MASK_PSTATE_AM %d\n",ptr_ofs(SS_Strand,mask_pstate_am)); | |
95 | printf("\n"); | |
96 | printf("#define S_G0 %d\n",ptr_ofs(SS_Strand,irf[0])); | |
97 | printf("#define S_G1 %d\n",ptr_ofs(SS_Strand,irf[1])); | |
98 | printf("#define S_G2 %d\n",ptr_ofs(SS_Strand,irf[2])); | |
99 | printf("#define S_G3 %d\n",ptr_ofs(SS_Strand,irf[3])); | |
100 | printf("#define S_G4 %d\n",ptr_ofs(SS_Strand,irf[4])); | |
101 | printf("#define S_G5 %d\n",ptr_ofs(SS_Strand,irf[5])); | |
102 | printf("#define S_G6 %d\n",ptr_ofs(SS_Strand,irf[6])); | |
103 | printf("#define S_G7 %d\n",ptr_ofs(SS_Strand,irf[7])); | |
104 | printf("#define S_O0 %d\n",ptr_ofs(SS_Strand,irf[8])); | |
105 | printf("#define S_O1 %d\n",ptr_ofs(SS_Strand,irf[9])); | |
106 | printf("#define S_O2 %d\n",ptr_ofs(SS_Strand,irf[10])); | |
107 | printf("#define S_O3 %d\n",ptr_ofs(SS_Strand,irf[11])); | |
108 | printf("#define S_O4 %d\n",ptr_ofs(SS_Strand,irf[12])); | |
109 | printf("#define S_O5 %d\n",ptr_ofs(SS_Strand,irf[13])); | |
110 | printf("#define S_O6 %d\n",ptr_ofs(SS_Strand,irf[14])); | |
111 | printf("#define S_O7 %d\n",ptr_ofs(SS_Strand,irf[15])); | |
112 | printf("#define S_L0 %d\n",ptr_ofs(SS_Strand,irf[16])); | |
113 | printf("#define S_L1 %d\n",ptr_ofs(SS_Strand,irf[17])); | |
114 | printf("#define S_L2 %d\n",ptr_ofs(SS_Strand,irf[18])); | |
115 | printf("#define S_L3 %d\n",ptr_ofs(SS_Strand,irf[19])); | |
116 | printf("#define S_L4 %d\n",ptr_ofs(SS_Strand,irf[20])); | |
117 | printf("#define S_L5 %d\n",ptr_ofs(SS_Strand,irf[21])); | |
118 | printf("#define S_L6 %d\n",ptr_ofs(SS_Strand,irf[22])); | |
119 | printf("#define S_L7 %d\n",ptr_ofs(SS_Strand,irf[23])); | |
120 | printf("#define S_I0 %d\n",ptr_ofs(SS_Strand,irf[24])); | |
121 | printf("#define S_I1 %d\n",ptr_ofs(SS_Strand,irf[25])); | |
122 | printf("#define S_I2 %d\n",ptr_ofs(SS_Strand,irf[26])); | |
123 | printf("#define S_I3 %d\n",ptr_ofs(SS_Strand,irf[27])); | |
124 | printf("#define S_I4 %d\n",ptr_ofs(SS_Strand,irf[28])); | |
125 | printf("#define S_I5 %d\n",ptr_ofs(SS_Strand,irf[20])); | |
126 | printf("#define S_I6 %d\n",ptr_ofs(SS_Strand,irf[30])); | |
127 | printf("#define S_I7 %d\n",ptr_ofs(SS_Strand,irf[31])); | |
128 | printf("\n"); | |
129 | printf("#define I_PTR %%o3\n"); | |
130 | printf("#define I_EXE %d\n",ptr_ofs(SS_Instr,exe)); | |
131 | printf("#define I_OPC %d\n",ptr_ofs(SS_Instr,opc)); | |
132 | printf("#define I_FLG %d\n",ptr_ofs(SS_Instr,flg)); | |
133 | printf("#define I_RS1 %d\n",ptr_ofs(SS_Instr,rs1)); | |
134 | printf("#define I_RS2 %d\n",ptr_ofs(SS_Instr,rs2)); | |
135 | printf("#define I_RS3 %d\n",ptr_ofs(SS_Instr,rs3)); | |
136 | printf("#define I_ASI %d\n",ptr_ofs(SS_Instr,asi)); | |
137 | printf("#define I_RD %d\n",ptr_ofs(SS_Instr,rd)); | |
138 | printf("#define I_TTE %d\n",ptr_ofs(SS_Instr,tte)); | |
139 | printf("#define I_EXE_TBL_IDX %d\n",ptr_ofs(SS_Instr,exe_tbl_idx)); | |
140 | printf("#define I_SIZE %d\n",SS_Instr::SIZE); | |
141 | printf("#define I_BITS %d\n",SS_Instr::BITS); | |
142 | printf("\n"); | |
143 | printf("#if defined(ARCH_V9)\n"); | |
144 | printf("#define TRAP S_TRAP\n"); | |
145 | printf("#define INST_TRAP S_INST_TRAP\n"); | |
146 | printf("#define DATA_TRAP S_DATA_TRAP\n"); | |
147 | printf("#define DATA_MMU S_DATA_MMU\n"); | |
148 | printf("#define INVALID_ASI S_INVALID_ASI\n"); | |
149 | printf("#define INST_DEC S_INST_DEC\n"); | |
150 | printf("#elif defined(ARCH_V8)\n"); | |
151 | printf("#define TRAP S_V8_TRAP\n"); | |
152 | printf("#define INST_TRAP S_V8_INST_TRAP\n"); | |
153 | printf("#define DATA_TRAP S_V8_DATA_TRAP\n"); | |
154 | printf("#define DATA_MMU S_V8_DATA_MMU\n"); | |
155 | printf("#define INVALID_ASI S_V8_INVALID_ASI\n"); | |
156 | printf("#define INST_DEC S_V8_INST_DEC\n"); | |
157 | printf("#else\n"); | |
158 | printf("#error \"Oops\"\n"); | |
159 | printf("#endif\n"); | |
160 | printf("\n"); | |
161 | ||
162 | SS_SimState fp_dis; | |
163 | fp_dis = 0; | |
164 | fp_dis.fp_disabled(1); | |
165 | printf("#define F_FP_DISABLED 0x%llx\n",fp_dis()); | |
166 | ||
167 | SS_Pstate pstate; | |
168 | pstate = 0; | |
169 | pstate.am(1); | |
170 | printf("#define F_PSTATE_AM 0x%x\n",pstate()); | |
171 | ||
172 | printf("\n"); | |
173 | printf("#define X_VIRT_MASK %d\n",ptr_ofs(SS_Tte,virt_mask)); | |
174 | printf("#define X_VIRT_PAGE %d\n",ptr_ofs(SS_Tte,virt_page)); | |
175 | printf("#define X_PHYS_MASK %d\n",ptr_ofs(SS_Tte,phys_mask)); | |
176 | printf("#define X_PHYS_PAGE %d\n",ptr_ofs(SS_Tte,phys_page)); | |
177 | printf("\n"); | |
178 | printf("#define T_MEM_ADDRESS_NOT_ALIGNED %d\n",SS_Trap::MEM_ADDRESS_NOT_ALIGNED); | |
179 | printf("#define T_MEM_ADDRESS_RANGE %d\n",SS_Trap::MEM_ADDRESS_RANGE); | |
180 | printf("#define T_LDDF_MEM_ADDRESS_NOT_ALIGNED %d\n",SS_Trap::LDDF_MEM_ADDRESS_NOT_ALIGNED); | |
181 | printf("#define T_STDF_MEM_ADDRESS_NOT_ALIGNED %d\n",SS_Trap::STDF_MEM_ADDRESS_NOT_ALIGNED); | |
182 | printf("#define T_PRIVILEGED_ACTION %d\n",SS_Trap::PRIVILEGED_ACTION); | |
183 | printf("#define T_DAE_INVALID_ASI %d\n",SS_Trap::DAE_INVALID_ASI); | |
184 | printf("#define T_FP_EXCEPTION_IEEE_754 %d\n",SS_Trap::FP_EXCEPTION_IEEE_754); | |
185 | printf("#define T_FP_DISABLED %d\n",SS_Trap::FP_DISABLED); | |
186 | printf("#define T_TAG_OVERFLOW %d\n",SS_Trap::TAG_OVERFLOW); | |
187 | printf("#define T_VA_WATCHPOINT %d\n",SS_Trap::VA_WATCHPOINT); | |
188 | printf("#define T_PA_WATCHPOINT %d\n",SS_Trap::PA_WATCHPOINT); | |
189 | printf("#define T_DIVISION_BY_ZERO %d\n",SS_Trap::DIVISION_BY_ZERO); | |
190 | printf("#define T_CONTROL_TRANSFER_INSTRUCTION %d\n",SS_Trap::CONTROL_TRANSFER_INSTRUCTION); | |
191 | printf("\n"); | |
192 | printf("#define C_INST_CACHE_MASK %d\n",SS_InstrCache::MASK); | |
193 | printf("#define C_INST_CACHE_BITS %d\n",SS_InstrCache::BITS); | |
194 | printf("#define C_INST_CACHE_LINE_BITS %d\n",SS_InstrCache::LINE_BITS); | |
195 | printf("#define C_LINE_TAG_MASK %d\n",-SS_InstrCache::LINE_SIZE * 4); | |
196 | printf("#define C_LINE_IDX_MASK %d\n",SS_InstrCache::LINE_MASK << (SS_Instr::BITS - 1)); | |
197 | printf("\n"); | |
198 | printf("#endif\n"); | |
199 | ||
200 | exit(0); | |
201 | } |