]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/mips/configure.ac
sim: unify reserved instruction bits settings
[thirdparty/binutils-gdb.git] / sim / mips / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(Makefile.in)
3 AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
4
5 # DEPRECATED
6 #
7 # Instead of defining a `subtarget' macro, code should be checking
8 # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
9 # in question.
10 #
11 case "${target}" in
12 mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
13 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
14 mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
15 mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
16 mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
17 mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
18 *) SIM_SUBTARGET="";;
19 esac
20 AC_SUBST(SIM_SUBTARGET)
21
22
23
24 #
25 # Select the bitsize of the target
26 #
27 mips_addr_bitsize=
28 case "${target}" in
29 mips*-sde-elf*) mips_bitsize=64 ; mips_msb=63 ;;
30 mips*-mti-elf*) mips_bitsize=64 ; mips_msb=63 ;;
31 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
32 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
33 mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
34 mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
35 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
36 *) mips_bitsize=64 ; mips_msb=63 ;;
37 esac
38 SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
39
40
41
42 #
43 # Select the floating hardware support of the target
44 #
45 mips_fpu=HARDWARE_FLOATING_POINT
46 mips_fpu_bitsize=
47 case "${target}" in
48 mips*tx39*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
49 mips*-sde-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
50 mips*-mti-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
51 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
52 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
53 mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
54 mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
55 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
56 *) mips_fpu=HARD_FLOATING_POINT ;;
57 esac
58 SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
59
60
61
62 #
63 # Select the IGEN architecture
64 #
65 sim_gen=IGEN
66 sim_igen_machine="-M mipsIV"
67 sim_m16_machine="-M mips16,mipsIII"
68 sim_igen_filter="32,64,f"
69 sim_m16_filter="16"
70 sim_mach_default="mips8000"
71
72 case "${target}" in
73 mips*tx39*) sim_gen=IGEN
74 sim_igen_filter="32,f"
75 sim_igen_machine="-M r3900"
76 ;;
77 mips64vr43*-*-*) sim_gen=IGEN
78 sim_igen_machine="-M mipsIV"
79 sim_mach_default="mips8000"
80 ;;
81 mips64vr5*-*-*) sim_gen=IGEN
82 sim_igen_machine="-M vr5000"
83 sim_mach_default="mips5000"
84 ;;
85 mips64vr41*) sim_gen=M16
86 sim_igen_machine="-M vr4100"
87 sim_m16_machine="-M vr4100"
88 sim_igen_filter="32,64,f"
89 sim_m16_filter="16"
90 sim_mach_default="mips4100"
91 ;;
92 mips64vr-*-* | mips64vrel-*-*)
93 sim_gen=MULTI
94 sim_multi_configs="\
95 vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
96 vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
97 vr5000:mipsIV:32,64,f:mips4300,mips5000\
98 vr5400:mipsIV,vr5400:32,64,f:mips5400\
99 vr5500:mipsIV,vr5500:32,64,f:mips5500"
100 sim_multi_default=mips5000
101 ;;
102 mips*-sde-elf* | mips*-mti-elf*)
103 sim_gen=MULTI
104 sim_multi_configs="\
105 micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
106 mips64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,64,f:mipsisa64r2"
107 sim_multi_default=mipsisa64r2
108 ;;
109 mips64*-*-*) sim_igen_filter="32,64,f"
110 sim_gen=IGEN
111 ;;
112 mips16*-*-*) sim_gen=M16
113 sim_igen_filter="32,64,f"
114 sim_m16_filter="16"
115 ;;
116 mipsisa32r2*-*-*) sim_gen=MULTI
117 sim_multi_configs="\
118 micromips:micromips32,micromipsdsp:32,f:mips_micromips\
119 mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
120 sim_multi_default=mipsisa32r2
121 ;;
122 mipsisa32*-*-*) sim_gen=M16
123 sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
124 sim_m16_machine="-M mips16,mips16e,mips32"
125 sim_igen_filter="32,f"
126 sim_mach_default="mipsisa32"
127 ;;
128 mipsisa64r2*-*-*) sim_gen=M16
129 sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
130 sim_m16_machine="-M mips16,mips16e,mips64r2"
131 sim_igen_filter="32,64,f"
132 sim_mach_default="mipsisa64r2"
133 ;;
134 mipsisa64sb1*-*-*) sim_gen=IGEN
135 sim_igen_machine="-M mips64,mips3d,sb1"
136 sim_igen_filter="32,64,f"
137 sim_mach_default="mips_sb1"
138 ;;
139 mipsisa64*-*-*) sim_gen=M16
140 sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
141 sim_m16_machine="-M mips16,mips16e,mips64"
142 sim_igen_filter="32,64,f"
143 sim_mach_default="mipsisa64"
144 ;;
145 mips*lsi*) sim_gen=M16
146 sim_igen_machine="-M mipsIII,mips16"
147 sim_m16_machine="-M mips16,mipsIII"
148 sim_igen_filter="32,f"
149 sim_m16_filter="16"
150 sim_mach_default="mips4000"
151 ;;
152 mips*-*-*) sim_gen=IGEN
153 sim_igen_filter="32,f"
154 ;;
155 esac
156
157 # The MULTI generator can combine several simulation engines into one.
158 # executable. A configuration which uses the MULTI should set two
159 # variables: ${sim_multi_configs} and ${sim_multi_default}.
160 #
161 # ${sim_multi_configs} is the list of engines to build. Each
162 # space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
163 # where:
164 #
165 # - NAME is a C-compatible prefix for the engine,
166 # - MACHINE is a -M argument,
167 # - FILTER is a -F argument, and
168 # - BFDMACHS is a comma-separated list of bfd machines that the
169 # simulator can run.
170 #
171 # Each entry will have a separate simulation engine whose prefix is
172 # m32<NAME>. If the machine list includes "mips16", there will also
173 # be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
174 # generated using the same machine list as the 32-bit version,
175 # but the filter will be "16" instead of FILTER.
176 #
177 # The simulator compares the bfd mach against BFDMACHS to decide
178 # which engine to use. Entries in BFDMACHS should be bfd_mach
179 # values with "bfd_mach_" removed. ${sim_multi_default} says
180 # which entry should be the default.
181 if test ${sim_gen} = MULTI; then
182
183 # Simple sanity check.
184 if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
185 AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
186 fi
187
188 # Start in a known state.
189 rm -f multi-include.h multi-run.c
190 sim_multi_flags=
191 sim_multi_src=
192 sim_multi_obj=
193 sim_multi_igen_configs=
194 sim_seen_default=no
195
196 cat << __EOF__ > multi-run.c
197 /* Main entry point for MULTI simulators.
198 Copyright (C) 2003-2021 Free Software Foundation, Inc.
199
200 This program is free software; you can redistribute it and/or modify
201 it under the terms of the GNU General Public License as published by
202 the Free Software Foundation; either version 3 of the License, or
203 (at your option) any later version.
204
205 This program is distributed in the hope that it will be useful,
206 but WITHOUT ANY WARRANTY; without even the implied warranty of
207 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
208 GNU General Public License for more details.
209
210 You should have received a copy of the GNU General Public License
211 along with this program. If not, see <http://www.gnu.org/licenses/>.
212
213 --
214
215 This file was generated by sim/mips/configure. */
216
217 #include "sim-main.h"
218 #include "multi-include.h"
219 #include "elf-bfd.h"
220 #include "elf/mips.h"
221
222 #define SD sd
223 #define CPU cpu
224
225 void
226 sim_engine_run (SIM_DESC sd,
227 int next_cpu_nr,
228 int nr_cpus,
229 int signal) /* ignore */
230 {
231 int mach;
232
233 if (STATE_ARCHITECTURE (sd) == NULL)
234 mach = bfd_mach_${sim_multi_default};
235 else if (elf_elfheader (STATE_PROG_BFD (sd))->e_flags
236 & EF_MIPS_ARCH_ASE_MICROMIPS)
237 mach = bfd_mach_mips_micromips;
238 else
239 mach = STATE_ARCHITECTURE (SD)->mach;
240
241 switch (mach)
242 {
243 __EOF__
244
245 for fc in ${sim_multi_configs}; do
246
247 # Split up the entry. ${c} contains the first three elements.
248 # Note: outer sqaure brackets are m4 quotes.
249 c=`echo ${fc} | sed ['s/:[^:]*$//']`
250 bfdmachs=`echo ${fc} | sed 's/.*://'`
251 name=`echo ${c} | sed 's/:.*//'`
252 machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
253 filter=`echo ${c} | sed 's/.*://'`
254
255 # Build the following lists:
256 #
257 # sim_multi_flags: all -M and -F flags used by the simulator
258 # sim_multi_src: all makefile-generated source files
259 # sim_multi_obj: the objects for ${sim_multi_src}
260 # sim_multi_igen_configs: igen configuration strings.
261 #
262 # Each entry in ${sim_multi_igen_configs} is a prefix (m32
263 # or m16) followed by the NAME, MACHINE and FILTER part of
264 # the ${sim_multi_configs} entry.
265 sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
266
267 # Check whether special handling is needed.
268 case ${c} in
269 *:*mips16*:*)
270 # Run igen twice, once for normal mode and once for mips16.
271 ws="m32 m16"
272
273 # The top-level function for the mips16 simulator is
274 # in a file m16${name}_run.c, generated by the
275 # tmp-run-multi Makefile rule.
276 sim_multi_src="${sim_multi_src} m16${name}_run.c"
277 sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
278 sim_multi_flags="${sim_multi_flags} -F 16"
279 ;;
280 *:*micromips32*:*)
281 # Run igen thrice, once for micromips32, once for micromips16,
282 # and once for m32.
283 ws="micromips_m32 micromips16 micromips32"
284
285 # The top-level function for the micromips simulator is
286 # in a file micromips${name}_run.c, generated by the
287 # tmp-run-multi Makefile rule.
288 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
289 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
290 sim_multi_flags="${sim_multi_flags} -F 16,32"
291 ;;
292 *:*micromips64*:*)
293 # Run igen thrice, once for micromips64, once for micromips16,
294 # and once for m64.
295 ws="micromips_m64 micromips16 micromips64"
296
297 # The top-level function for the micromips simulator is
298 # in a file micromips${name}_run.c, generated by the
299 # tmp-run-multi Makefile rule.
300 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
301 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
302 sim_multi_flags="${sim_multi_flags} -F 16,32,64"
303 ;;
304 *)
305 ws=m32
306 ;;
307 esac
308
309 # Now add the list of igen-generated files to ${sim_multi_src}
310 # and ${sim_multi_obj}.
311 for w in ${ws}; do
312 for base in engine icache idecode model semantics support; do
313 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
314 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
315 sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
316 done
317 sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
318 done
319
320 # Add an include for the engine.h file. This file declares the
321 # top-level foo_engine_run() function.
322 echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
323
324 # Add case statements for this engine to sim_engine_run().
325 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
326 echo " case bfd_mach_${mach}:" >> multi-run.c
327 if test ${mach} = ${sim_multi_default}; then
328 echo " default:" >> multi-run.c
329 sim_seen_default=yes
330 fi
331 done
332 echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
333 >> multi-run.c
334 echo " break;" >> multi-run.c
335 done
336
337 # Check whether we added a 'default:' label.
338 if test ${sim_seen_default} = no; then
339 AC_MSG_ERROR(Error in configure.ac: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
340 fi
341
342 cat << __EOF__ >> multi-run.c
343 }
344 }
345
346 int
347 mips_mach_multi (SIM_DESC sd)
348 {
349 if (STATE_ARCHITECTURE (sd) == NULL)
350 return bfd_mach_${sim_multi_default};
351
352 switch (STATE_ARCHITECTURE (SD)->mach)
353 {
354 __EOF__
355
356 # Add case statements for this engine to mips_mach_multi().
357 for fc in ${sim_multi_configs}; do
358
359 # Split up the entry. ${c} contains the first three elements.
360 # Note: outer sqaure brackets are m4 quotes.
361 c=`echo ${fc} | sed ['s/:[^:]*$//']`
362 bfdmachs=`echo ${fc} | sed 's/.*://'`
363
364 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
365 echo " case bfd_mach_${mach}:" >> multi-run.c
366 done
367 done
368
369 cat << __EOF__ >> multi-run.c
370 return (STATE_ARCHITECTURE (SD)->mach);
371 default:
372 return bfd_mach_${sim_multi_default};
373 }
374 }
375 __EOF__
376
377 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
378 else
379 # For clean-extra
380 sim_multi_src=doesnt-exist.c
381
382 if test x"${sim_mach_default}" = x""; then
383 AC_MSG_ERROR(Error in configure.ac: \${sim_mach_default} not defined)
384 fi
385 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
386 fi
387 sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
388 sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
389 sim_micromips16_flags=" -F ${sim_micromips16_filter} ${sim_micromips16_machine} ${sim_igen_smp}"
390 sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${sim_igen_smp}"
391 AC_SUBST(sim_igen_flags)
392 AC_SUBST(sim_m16_flags)
393 AC_SUBST(sim_micromips_flags)
394 AC_SUBST(sim_micromips16_flags)
395 AC_SUBST(sim_gen)
396 AC_SUBST(sim_multi_flags)
397 AC_SUBST(sim_multi_igen_configs)
398 AC_SUBST(sim_multi_src)
399 AC_SUBST(sim_multi_obj)
400
401 SIM_AC_OUTPUT