xref: /netbsd-src/external/gpl3/gdb.old/dist/sim/lm32/model.c (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1a5a4af3bSchristos /* Simulator model support for lm32bf.
2a5a4af3bSchristos 
3a5a4af3bSchristos THIS FILE IS MACHINE GENERATED WITH CGEN.
4a5a4af3bSchristos 
5*8b657b07Schristos Copyright 1996-2023 Free Software Foundation, Inc.
6a5a4af3bSchristos 
7a5a4af3bSchristos This file is part of the GNU simulators.
8a5a4af3bSchristos 
9a5a4af3bSchristos    This file is free software; you can redistribute it and/or modify
10a5a4af3bSchristos    it under the terms of the GNU General Public License as published by
11a5a4af3bSchristos    the Free Software Foundation; either version 3, or (at your option)
12a5a4af3bSchristos    any later version.
13a5a4af3bSchristos 
14a5a4af3bSchristos    It is distributed in the hope that it will be useful, but WITHOUT
15a5a4af3bSchristos    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16a5a4af3bSchristos    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
17a5a4af3bSchristos    License for more details.
18a5a4af3bSchristos 
19a5a4af3bSchristos    You should have received a copy of the GNU General Public License along
20a5a4af3bSchristos    with this program; if not, see <http://www.gnu.org/licenses/>.
21a5a4af3bSchristos 
22a5a4af3bSchristos */
23a5a4af3bSchristos 
24a5a4af3bSchristos #define WANT_CPU lm32bf
25a5a4af3bSchristos #define WANT_CPU_LM32BF
26a5a4af3bSchristos 
27a5a4af3bSchristos #include "sim-main.h"
28a5a4af3bSchristos 
29a5a4af3bSchristos /* The profiling data is recorded here, but is accessed via the profiling
30a5a4af3bSchristos    mechanism.  After all, this is information for profiling.  */
31a5a4af3bSchristos 
32a5a4af3bSchristos #if WITH_PROFILE_MODEL_P
33a5a4af3bSchristos 
34a5a4af3bSchristos /* Model handlers for each insn.  */
35a5a4af3bSchristos 
36a5a4af3bSchristos static int
37a5a4af3bSchristos model_lm32_add (SIM_CPU *current_cpu, void *sem_arg)
38a5a4af3bSchristos {
39a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
40a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
41a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
42a5a4af3bSchristos   int cycles = 0;
43a5a4af3bSchristos   {
44a5a4af3bSchristos     int referenced = 0;
45a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
46a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
47a5a4af3bSchristos   }
48a5a4af3bSchristos   return cycles;
49a5a4af3bSchristos #undef FLD
50a5a4af3bSchristos }
51a5a4af3bSchristos 
52a5a4af3bSchristos static int
53a5a4af3bSchristos model_lm32_addi (SIM_CPU *current_cpu, void *sem_arg)
54a5a4af3bSchristos {
55a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
56a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
57a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
58a5a4af3bSchristos   int cycles = 0;
59a5a4af3bSchristos   {
60a5a4af3bSchristos     int referenced = 0;
61a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
62a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
63a5a4af3bSchristos   }
64a5a4af3bSchristos   return cycles;
65a5a4af3bSchristos #undef FLD
66a5a4af3bSchristos }
67a5a4af3bSchristos 
68a5a4af3bSchristos static int
69a5a4af3bSchristos model_lm32_and (SIM_CPU *current_cpu, void *sem_arg)
70a5a4af3bSchristos {
71a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
72a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
73a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
74a5a4af3bSchristos   int cycles = 0;
75a5a4af3bSchristos   {
76a5a4af3bSchristos     int referenced = 0;
77a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
78a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
79a5a4af3bSchristos   }
80a5a4af3bSchristos   return cycles;
81a5a4af3bSchristos #undef FLD
82a5a4af3bSchristos }
83a5a4af3bSchristos 
84a5a4af3bSchristos static int
85a5a4af3bSchristos model_lm32_andi (SIM_CPU *current_cpu, void *sem_arg)
86a5a4af3bSchristos {
87a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
88a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
89a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
90a5a4af3bSchristos   int cycles = 0;
91a5a4af3bSchristos   {
92a5a4af3bSchristos     int referenced = 0;
93a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
94a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
95a5a4af3bSchristos   }
96a5a4af3bSchristos   return cycles;
97a5a4af3bSchristos #undef FLD
98a5a4af3bSchristos }
99a5a4af3bSchristos 
100a5a4af3bSchristos static int
101a5a4af3bSchristos model_lm32_andhii (SIM_CPU *current_cpu, void *sem_arg)
102a5a4af3bSchristos {
103a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
104a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
105a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
106a5a4af3bSchristos   int cycles = 0;
107a5a4af3bSchristos   {
108a5a4af3bSchristos     int referenced = 0;
109a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
110a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
111a5a4af3bSchristos   }
112a5a4af3bSchristos   return cycles;
113a5a4af3bSchristos #undef FLD
114a5a4af3bSchristos }
115a5a4af3bSchristos 
116a5a4af3bSchristos static int
117a5a4af3bSchristos model_lm32_b (SIM_CPU *current_cpu, void *sem_arg)
118a5a4af3bSchristos {
119a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_be.f
120a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
121a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
122a5a4af3bSchristos   int cycles = 0;
123a5a4af3bSchristos   {
124a5a4af3bSchristos     int referenced = 0;
125a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
126a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
127a5a4af3bSchristos   }
128a5a4af3bSchristos   return cycles;
129a5a4af3bSchristos #undef FLD
130a5a4af3bSchristos }
131a5a4af3bSchristos 
132a5a4af3bSchristos static int
133a5a4af3bSchristos model_lm32_bi (SIM_CPU *current_cpu, void *sem_arg)
134a5a4af3bSchristos {
135a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_bi.f
136a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
137a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
138a5a4af3bSchristos   int cycles = 0;
139a5a4af3bSchristos   {
140a5a4af3bSchristos     int referenced = 0;
141a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
142a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
143a5a4af3bSchristos   }
144a5a4af3bSchristos   return cycles;
145a5a4af3bSchristos #undef FLD
146a5a4af3bSchristos }
147a5a4af3bSchristos 
148a5a4af3bSchristos static int
149a5a4af3bSchristos model_lm32_be (SIM_CPU *current_cpu, void *sem_arg)
150a5a4af3bSchristos {
151a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_be.f
152a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
153a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
154a5a4af3bSchristos   int cycles = 0;
155a5a4af3bSchristos   {
156a5a4af3bSchristos     int referenced = 0;
157a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
158a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
159a5a4af3bSchristos   }
160a5a4af3bSchristos   return cycles;
161a5a4af3bSchristos #undef FLD
162a5a4af3bSchristos }
163a5a4af3bSchristos 
164a5a4af3bSchristos static int
165a5a4af3bSchristos model_lm32_bg (SIM_CPU *current_cpu, void *sem_arg)
166a5a4af3bSchristos {
167a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_be.f
168a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
169a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
170a5a4af3bSchristos   int cycles = 0;
171a5a4af3bSchristos   {
172a5a4af3bSchristos     int referenced = 0;
173a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
174a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
175a5a4af3bSchristos   }
176a5a4af3bSchristos   return cycles;
177a5a4af3bSchristos #undef FLD
178a5a4af3bSchristos }
179a5a4af3bSchristos 
180a5a4af3bSchristos static int
181a5a4af3bSchristos model_lm32_bge (SIM_CPU *current_cpu, void *sem_arg)
182a5a4af3bSchristos {
183a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_be.f
184a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
185a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
186a5a4af3bSchristos   int cycles = 0;
187a5a4af3bSchristos   {
188a5a4af3bSchristos     int referenced = 0;
189a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
190a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
191a5a4af3bSchristos   }
192a5a4af3bSchristos   return cycles;
193a5a4af3bSchristos #undef FLD
194a5a4af3bSchristos }
195a5a4af3bSchristos 
196a5a4af3bSchristos static int
197a5a4af3bSchristos model_lm32_bgeu (SIM_CPU *current_cpu, void *sem_arg)
198a5a4af3bSchristos {
199a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_be.f
200a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
201a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
202a5a4af3bSchristos   int cycles = 0;
203a5a4af3bSchristos   {
204a5a4af3bSchristos     int referenced = 0;
205a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
206a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
207a5a4af3bSchristos   }
208a5a4af3bSchristos   return cycles;
209a5a4af3bSchristos #undef FLD
210a5a4af3bSchristos }
211a5a4af3bSchristos 
212a5a4af3bSchristos static int
213a5a4af3bSchristos model_lm32_bgu (SIM_CPU *current_cpu, void *sem_arg)
214a5a4af3bSchristos {
215a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_be.f
216a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
217a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
218a5a4af3bSchristos   int cycles = 0;
219a5a4af3bSchristos   {
220a5a4af3bSchristos     int referenced = 0;
221a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
222a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
223a5a4af3bSchristos   }
224a5a4af3bSchristos   return cycles;
225a5a4af3bSchristos #undef FLD
226a5a4af3bSchristos }
227a5a4af3bSchristos 
228a5a4af3bSchristos static int
229a5a4af3bSchristos model_lm32_bne (SIM_CPU *current_cpu, void *sem_arg)
230a5a4af3bSchristos {
231a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_be.f
232a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
233a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
234a5a4af3bSchristos   int cycles = 0;
235a5a4af3bSchristos   {
236a5a4af3bSchristos     int referenced = 0;
237a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
238a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
239a5a4af3bSchristos   }
240a5a4af3bSchristos   return cycles;
241a5a4af3bSchristos #undef FLD
242a5a4af3bSchristos }
243a5a4af3bSchristos 
244a5a4af3bSchristos static int
245a5a4af3bSchristos model_lm32_call (SIM_CPU *current_cpu, void *sem_arg)
246a5a4af3bSchristos {
247a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_be.f
248a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
249a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
250a5a4af3bSchristos   int cycles = 0;
251a5a4af3bSchristos   {
252a5a4af3bSchristos     int referenced = 0;
253a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
254a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
255a5a4af3bSchristos   }
256a5a4af3bSchristos   return cycles;
257a5a4af3bSchristos #undef FLD
258a5a4af3bSchristos }
259a5a4af3bSchristos 
260a5a4af3bSchristos static int
261a5a4af3bSchristos model_lm32_calli (SIM_CPU *current_cpu, void *sem_arg)
262a5a4af3bSchristos {
263a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_bi.f
264a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
265a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
266a5a4af3bSchristos   int cycles = 0;
267a5a4af3bSchristos   {
268a5a4af3bSchristos     int referenced = 0;
269a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
270a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
271a5a4af3bSchristos   }
272a5a4af3bSchristos   return cycles;
273a5a4af3bSchristos #undef FLD
274a5a4af3bSchristos }
275a5a4af3bSchristos 
276a5a4af3bSchristos static int
277a5a4af3bSchristos model_lm32_cmpe (SIM_CPU *current_cpu, void *sem_arg)
278a5a4af3bSchristos {
279a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
280a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
281a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
282a5a4af3bSchristos   int cycles = 0;
283a5a4af3bSchristos   {
284a5a4af3bSchristos     int referenced = 0;
285a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
286a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
287a5a4af3bSchristos   }
288a5a4af3bSchristos   return cycles;
289a5a4af3bSchristos #undef FLD
290a5a4af3bSchristos }
291a5a4af3bSchristos 
292a5a4af3bSchristos static int
293a5a4af3bSchristos model_lm32_cmpei (SIM_CPU *current_cpu, void *sem_arg)
294a5a4af3bSchristos {
295a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
296a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
297a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
298a5a4af3bSchristos   int cycles = 0;
299a5a4af3bSchristos   {
300a5a4af3bSchristos     int referenced = 0;
301a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
302a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
303a5a4af3bSchristos   }
304a5a4af3bSchristos   return cycles;
305a5a4af3bSchristos #undef FLD
306a5a4af3bSchristos }
307a5a4af3bSchristos 
308a5a4af3bSchristos static int
309a5a4af3bSchristos model_lm32_cmpg (SIM_CPU *current_cpu, void *sem_arg)
310a5a4af3bSchristos {
311a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
312a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
313a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
314a5a4af3bSchristos   int cycles = 0;
315a5a4af3bSchristos   {
316a5a4af3bSchristos     int referenced = 0;
317a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
318a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
319a5a4af3bSchristos   }
320a5a4af3bSchristos   return cycles;
321a5a4af3bSchristos #undef FLD
322a5a4af3bSchristos }
323a5a4af3bSchristos 
324a5a4af3bSchristos static int
325a5a4af3bSchristos model_lm32_cmpgi (SIM_CPU *current_cpu, void *sem_arg)
326a5a4af3bSchristos {
327a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
328a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
329a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
330a5a4af3bSchristos   int cycles = 0;
331a5a4af3bSchristos   {
332a5a4af3bSchristos     int referenced = 0;
333a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
334a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
335a5a4af3bSchristos   }
336a5a4af3bSchristos   return cycles;
337a5a4af3bSchristos #undef FLD
338a5a4af3bSchristos }
339a5a4af3bSchristos 
340a5a4af3bSchristos static int
341a5a4af3bSchristos model_lm32_cmpge (SIM_CPU *current_cpu, void *sem_arg)
342a5a4af3bSchristos {
343a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
344a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
345a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
346a5a4af3bSchristos   int cycles = 0;
347a5a4af3bSchristos   {
348a5a4af3bSchristos     int referenced = 0;
349a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
350a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
351a5a4af3bSchristos   }
352a5a4af3bSchristos   return cycles;
353a5a4af3bSchristos #undef FLD
354a5a4af3bSchristos }
355a5a4af3bSchristos 
356a5a4af3bSchristos static int
357a5a4af3bSchristos model_lm32_cmpgei (SIM_CPU *current_cpu, void *sem_arg)
358a5a4af3bSchristos {
359a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
360a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
361a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
362a5a4af3bSchristos   int cycles = 0;
363a5a4af3bSchristos   {
364a5a4af3bSchristos     int referenced = 0;
365a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
366a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
367a5a4af3bSchristos   }
368a5a4af3bSchristos   return cycles;
369a5a4af3bSchristos #undef FLD
370a5a4af3bSchristos }
371a5a4af3bSchristos 
372a5a4af3bSchristos static int
373a5a4af3bSchristos model_lm32_cmpgeu (SIM_CPU *current_cpu, void *sem_arg)
374a5a4af3bSchristos {
375a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
376a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
377a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
378a5a4af3bSchristos   int cycles = 0;
379a5a4af3bSchristos   {
380a5a4af3bSchristos     int referenced = 0;
381a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
382a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
383a5a4af3bSchristos   }
384a5a4af3bSchristos   return cycles;
385a5a4af3bSchristos #undef FLD
386a5a4af3bSchristos }
387a5a4af3bSchristos 
388a5a4af3bSchristos static int
389a5a4af3bSchristos model_lm32_cmpgeui (SIM_CPU *current_cpu, void *sem_arg)
390a5a4af3bSchristos {
391a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
392a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
393a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
394a5a4af3bSchristos   int cycles = 0;
395a5a4af3bSchristos   {
396a5a4af3bSchristos     int referenced = 0;
397a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
398a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
399a5a4af3bSchristos   }
400a5a4af3bSchristos   return cycles;
401a5a4af3bSchristos #undef FLD
402a5a4af3bSchristos }
403a5a4af3bSchristos 
404a5a4af3bSchristos static int
405a5a4af3bSchristos model_lm32_cmpgu (SIM_CPU *current_cpu, void *sem_arg)
406a5a4af3bSchristos {
407a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
408a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
409a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
410a5a4af3bSchristos   int cycles = 0;
411a5a4af3bSchristos   {
412a5a4af3bSchristos     int referenced = 0;
413a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
414a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
415a5a4af3bSchristos   }
416a5a4af3bSchristos   return cycles;
417a5a4af3bSchristos #undef FLD
418a5a4af3bSchristos }
419a5a4af3bSchristos 
420a5a4af3bSchristos static int
421a5a4af3bSchristos model_lm32_cmpgui (SIM_CPU *current_cpu, void *sem_arg)
422a5a4af3bSchristos {
423a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
424a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
425a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
426a5a4af3bSchristos   int cycles = 0;
427a5a4af3bSchristos   {
428a5a4af3bSchristos     int referenced = 0;
429a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
430a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
431a5a4af3bSchristos   }
432a5a4af3bSchristos   return cycles;
433a5a4af3bSchristos #undef FLD
434a5a4af3bSchristos }
435a5a4af3bSchristos 
436a5a4af3bSchristos static int
437a5a4af3bSchristos model_lm32_cmpne (SIM_CPU *current_cpu, void *sem_arg)
438a5a4af3bSchristos {
439a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
440a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
441a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
442a5a4af3bSchristos   int cycles = 0;
443a5a4af3bSchristos   {
444a5a4af3bSchristos     int referenced = 0;
445a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
446a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
447a5a4af3bSchristos   }
448a5a4af3bSchristos   return cycles;
449a5a4af3bSchristos #undef FLD
450a5a4af3bSchristos }
451a5a4af3bSchristos 
452a5a4af3bSchristos static int
453a5a4af3bSchristos model_lm32_cmpnei (SIM_CPU *current_cpu, void *sem_arg)
454a5a4af3bSchristos {
455a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
456a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
457a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
458a5a4af3bSchristos   int cycles = 0;
459a5a4af3bSchristos   {
460a5a4af3bSchristos     int referenced = 0;
461a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
462a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
463a5a4af3bSchristos   }
464a5a4af3bSchristos   return cycles;
465a5a4af3bSchristos #undef FLD
466a5a4af3bSchristos }
467a5a4af3bSchristos 
468a5a4af3bSchristos static int
469a5a4af3bSchristos model_lm32_divu (SIM_CPU *current_cpu, void *sem_arg)
470a5a4af3bSchristos {
471a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
472a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
473a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
474a5a4af3bSchristos   int cycles = 0;
475a5a4af3bSchristos   {
476a5a4af3bSchristos     int referenced = 0;
477a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
478a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
479a5a4af3bSchristos   }
480a5a4af3bSchristos   return cycles;
481a5a4af3bSchristos #undef FLD
482a5a4af3bSchristos }
483a5a4af3bSchristos 
484a5a4af3bSchristos static int
485a5a4af3bSchristos model_lm32_lb (SIM_CPU *current_cpu, void *sem_arg)
486a5a4af3bSchristos {
487a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
488a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
489a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
490a5a4af3bSchristos   int cycles = 0;
491a5a4af3bSchristos   {
492a5a4af3bSchristos     int referenced = 0;
493a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
494a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
495a5a4af3bSchristos   }
496a5a4af3bSchristos   return cycles;
497a5a4af3bSchristos #undef FLD
498a5a4af3bSchristos }
499a5a4af3bSchristos 
500a5a4af3bSchristos static int
501a5a4af3bSchristos model_lm32_lbu (SIM_CPU *current_cpu, void *sem_arg)
502a5a4af3bSchristos {
503a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
504a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
505a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
506a5a4af3bSchristos   int cycles = 0;
507a5a4af3bSchristos   {
508a5a4af3bSchristos     int referenced = 0;
509a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
510a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
511a5a4af3bSchristos   }
512a5a4af3bSchristos   return cycles;
513a5a4af3bSchristos #undef FLD
514a5a4af3bSchristos }
515a5a4af3bSchristos 
516a5a4af3bSchristos static int
517a5a4af3bSchristos model_lm32_lh (SIM_CPU *current_cpu, void *sem_arg)
518a5a4af3bSchristos {
519a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
520a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
521a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
522a5a4af3bSchristos   int cycles = 0;
523a5a4af3bSchristos   {
524a5a4af3bSchristos     int referenced = 0;
525a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
526a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
527a5a4af3bSchristos   }
528a5a4af3bSchristos   return cycles;
529a5a4af3bSchristos #undef FLD
530a5a4af3bSchristos }
531a5a4af3bSchristos 
532a5a4af3bSchristos static int
533a5a4af3bSchristos model_lm32_lhu (SIM_CPU *current_cpu, void *sem_arg)
534a5a4af3bSchristos {
535a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
536a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
537a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
538a5a4af3bSchristos   int cycles = 0;
539a5a4af3bSchristos   {
540a5a4af3bSchristos     int referenced = 0;
541a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
542a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
543a5a4af3bSchristos   }
544a5a4af3bSchristos   return cycles;
545a5a4af3bSchristos #undef FLD
546a5a4af3bSchristos }
547a5a4af3bSchristos 
548a5a4af3bSchristos static int
549a5a4af3bSchristos model_lm32_lw (SIM_CPU *current_cpu, void *sem_arg)
550a5a4af3bSchristos {
551a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
552a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
553a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
554a5a4af3bSchristos   int cycles = 0;
555a5a4af3bSchristos   {
556a5a4af3bSchristos     int referenced = 0;
557a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
558a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
559a5a4af3bSchristos   }
560a5a4af3bSchristos   return cycles;
561a5a4af3bSchristos #undef FLD
562a5a4af3bSchristos }
563a5a4af3bSchristos 
564a5a4af3bSchristos static int
565a5a4af3bSchristos model_lm32_modu (SIM_CPU *current_cpu, void *sem_arg)
566a5a4af3bSchristos {
567a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
568a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
569a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
570a5a4af3bSchristos   int cycles = 0;
571a5a4af3bSchristos   {
572a5a4af3bSchristos     int referenced = 0;
573a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
574a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
575a5a4af3bSchristos   }
576a5a4af3bSchristos   return cycles;
577a5a4af3bSchristos #undef FLD
578a5a4af3bSchristos }
579a5a4af3bSchristos 
580a5a4af3bSchristos static int
581a5a4af3bSchristos model_lm32_mul (SIM_CPU *current_cpu, void *sem_arg)
582a5a4af3bSchristos {
583a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
584a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
585a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
586a5a4af3bSchristos   int cycles = 0;
587a5a4af3bSchristos   {
588a5a4af3bSchristos     int referenced = 0;
589a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
590a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
591a5a4af3bSchristos   }
592a5a4af3bSchristos   return cycles;
593a5a4af3bSchristos #undef FLD
594a5a4af3bSchristos }
595a5a4af3bSchristos 
596a5a4af3bSchristos static int
597a5a4af3bSchristos model_lm32_muli (SIM_CPU *current_cpu, void *sem_arg)
598a5a4af3bSchristos {
599a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
600a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
601a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
602a5a4af3bSchristos   int cycles = 0;
603a5a4af3bSchristos   {
604a5a4af3bSchristos     int referenced = 0;
605a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
606a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
607a5a4af3bSchristos   }
608a5a4af3bSchristos   return cycles;
609a5a4af3bSchristos #undef FLD
610a5a4af3bSchristos }
611a5a4af3bSchristos 
612a5a4af3bSchristos static int
613a5a4af3bSchristos model_lm32_nor (SIM_CPU *current_cpu, void *sem_arg)
614a5a4af3bSchristos {
615a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
616a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
617a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
618a5a4af3bSchristos   int cycles = 0;
619a5a4af3bSchristos   {
620a5a4af3bSchristos     int referenced = 0;
621a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
622a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
623a5a4af3bSchristos   }
624a5a4af3bSchristos   return cycles;
625a5a4af3bSchristos #undef FLD
626a5a4af3bSchristos }
627a5a4af3bSchristos 
628a5a4af3bSchristos static int
629a5a4af3bSchristos model_lm32_nori (SIM_CPU *current_cpu, void *sem_arg)
630a5a4af3bSchristos {
631a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
632a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
633a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
634a5a4af3bSchristos   int cycles = 0;
635a5a4af3bSchristos   {
636a5a4af3bSchristos     int referenced = 0;
637a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
638a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
639a5a4af3bSchristos   }
640a5a4af3bSchristos   return cycles;
641a5a4af3bSchristos #undef FLD
642a5a4af3bSchristos }
643a5a4af3bSchristos 
644a5a4af3bSchristos static int
645a5a4af3bSchristos model_lm32_or (SIM_CPU *current_cpu, void *sem_arg)
646a5a4af3bSchristos {
647a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
648a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
649a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
650a5a4af3bSchristos   int cycles = 0;
651a5a4af3bSchristos   {
652a5a4af3bSchristos     int referenced = 0;
653a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
654a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
655a5a4af3bSchristos   }
656a5a4af3bSchristos   return cycles;
657a5a4af3bSchristos #undef FLD
658a5a4af3bSchristos }
659a5a4af3bSchristos 
660a5a4af3bSchristos static int
661a5a4af3bSchristos model_lm32_ori (SIM_CPU *current_cpu, void *sem_arg)
662a5a4af3bSchristos {
663a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
664a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
665a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
666a5a4af3bSchristos   int cycles = 0;
667a5a4af3bSchristos   {
668a5a4af3bSchristos     int referenced = 0;
669a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
670a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
671a5a4af3bSchristos   }
672a5a4af3bSchristos   return cycles;
673a5a4af3bSchristos #undef FLD
674a5a4af3bSchristos }
675a5a4af3bSchristos 
676a5a4af3bSchristos static int
677a5a4af3bSchristos model_lm32_orhii (SIM_CPU *current_cpu, void *sem_arg)
678a5a4af3bSchristos {
679a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
680a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
681a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
682a5a4af3bSchristos   int cycles = 0;
683a5a4af3bSchristos   {
684a5a4af3bSchristos     int referenced = 0;
685a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
686a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
687a5a4af3bSchristos   }
688a5a4af3bSchristos   return cycles;
689a5a4af3bSchristos #undef FLD
690a5a4af3bSchristos }
691a5a4af3bSchristos 
692a5a4af3bSchristos static int
693a5a4af3bSchristos model_lm32_rcsr (SIM_CPU *current_cpu, void *sem_arg)
694a5a4af3bSchristos {
695a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_rcsr.f
696a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
697a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
698a5a4af3bSchristos   int cycles = 0;
699a5a4af3bSchristos   {
700a5a4af3bSchristos     int referenced = 0;
701a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
702a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
703a5a4af3bSchristos   }
704a5a4af3bSchristos   return cycles;
705a5a4af3bSchristos #undef FLD
706a5a4af3bSchristos }
707a5a4af3bSchristos 
708a5a4af3bSchristos static int
709a5a4af3bSchristos model_lm32_sb (SIM_CPU *current_cpu, void *sem_arg)
710a5a4af3bSchristos {
711a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
712a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
713a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
714a5a4af3bSchristos   int cycles = 0;
715a5a4af3bSchristos   {
716a5a4af3bSchristos     int referenced = 0;
717a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
718a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
719a5a4af3bSchristos   }
720a5a4af3bSchristos   return cycles;
721a5a4af3bSchristos #undef FLD
722a5a4af3bSchristos }
723a5a4af3bSchristos 
724a5a4af3bSchristos static int
725a5a4af3bSchristos model_lm32_sextb (SIM_CPU *current_cpu, void *sem_arg)
726a5a4af3bSchristos {
727a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
728a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
729a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
730a5a4af3bSchristos   int cycles = 0;
731a5a4af3bSchristos   {
732a5a4af3bSchristos     int referenced = 0;
733a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
734a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
735a5a4af3bSchristos   }
736a5a4af3bSchristos   return cycles;
737a5a4af3bSchristos #undef FLD
738a5a4af3bSchristos }
739a5a4af3bSchristos 
740a5a4af3bSchristos static int
741a5a4af3bSchristos model_lm32_sexth (SIM_CPU *current_cpu, void *sem_arg)
742a5a4af3bSchristos {
743a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
744a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
745a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
746a5a4af3bSchristos   int cycles = 0;
747a5a4af3bSchristos   {
748a5a4af3bSchristos     int referenced = 0;
749a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
750a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
751a5a4af3bSchristos   }
752a5a4af3bSchristos   return cycles;
753a5a4af3bSchristos #undef FLD
754a5a4af3bSchristos }
755a5a4af3bSchristos 
756a5a4af3bSchristos static int
757a5a4af3bSchristos model_lm32_sh (SIM_CPU *current_cpu, void *sem_arg)
758a5a4af3bSchristos {
759a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
760a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
761a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
762a5a4af3bSchristos   int cycles = 0;
763a5a4af3bSchristos   {
764a5a4af3bSchristos     int referenced = 0;
765a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
766a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
767a5a4af3bSchristos   }
768a5a4af3bSchristos   return cycles;
769a5a4af3bSchristos #undef FLD
770a5a4af3bSchristos }
771a5a4af3bSchristos 
772a5a4af3bSchristos static int
773a5a4af3bSchristos model_lm32_sl (SIM_CPU *current_cpu, void *sem_arg)
774a5a4af3bSchristos {
775a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
776a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
777a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
778a5a4af3bSchristos   int cycles = 0;
779a5a4af3bSchristos   {
780a5a4af3bSchristos     int referenced = 0;
781a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
782a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
783a5a4af3bSchristos   }
784a5a4af3bSchristos   return cycles;
785a5a4af3bSchristos #undef FLD
786a5a4af3bSchristos }
787a5a4af3bSchristos 
788a5a4af3bSchristos static int
789a5a4af3bSchristos model_lm32_sli (SIM_CPU *current_cpu, void *sem_arg)
790a5a4af3bSchristos {
791a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
792a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
793a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
794a5a4af3bSchristos   int cycles = 0;
795a5a4af3bSchristos   {
796a5a4af3bSchristos     int referenced = 0;
797a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
798a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
799a5a4af3bSchristos   }
800a5a4af3bSchristos   return cycles;
801a5a4af3bSchristos #undef FLD
802a5a4af3bSchristos }
803a5a4af3bSchristos 
804a5a4af3bSchristos static int
805a5a4af3bSchristos model_lm32_sr (SIM_CPU *current_cpu, void *sem_arg)
806a5a4af3bSchristos {
807a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
808a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
809a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
810a5a4af3bSchristos   int cycles = 0;
811a5a4af3bSchristos   {
812a5a4af3bSchristos     int referenced = 0;
813a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
814a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
815a5a4af3bSchristos   }
816a5a4af3bSchristos   return cycles;
817a5a4af3bSchristos #undef FLD
818a5a4af3bSchristos }
819a5a4af3bSchristos 
820a5a4af3bSchristos static int
821a5a4af3bSchristos model_lm32_sri (SIM_CPU *current_cpu, void *sem_arg)
822a5a4af3bSchristos {
823a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
824a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
825a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
826a5a4af3bSchristos   int cycles = 0;
827a5a4af3bSchristos   {
828a5a4af3bSchristos     int referenced = 0;
829a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
830a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
831a5a4af3bSchristos   }
832a5a4af3bSchristos   return cycles;
833a5a4af3bSchristos #undef FLD
834a5a4af3bSchristos }
835a5a4af3bSchristos 
836a5a4af3bSchristos static int
837a5a4af3bSchristos model_lm32_sru (SIM_CPU *current_cpu, void *sem_arg)
838a5a4af3bSchristos {
839a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
840a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
841a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
842a5a4af3bSchristos   int cycles = 0;
843a5a4af3bSchristos   {
844a5a4af3bSchristos     int referenced = 0;
845a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
846a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
847a5a4af3bSchristos   }
848a5a4af3bSchristos   return cycles;
849a5a4af3bSchristos #undef FLD
850a5a4af3bSchristos }
851a5a4af3bSchristos 
852a5a4af3bSchristos static int
853a5a4af3bSchristos model_lm32_srui (SIM_CPU *current_cpu, void *sem_arg)
854a5a4af3bSchristos {
855a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
856a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
857a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
858a5a4af3bSchristos   int cycles = 0;
859a5a4af3bSchristos   {
860a5a4af3bSchristos     int referenced = 0;
861a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
862a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
863a5a4af3bSchristos   }
864a5a4af3bSchristos   return cycles;
865a5a4af3bSchristos #undef FLD
866a5a4af3bSchristos }
867a5a4af3bSchristos 
868a5a4af3bSchristos static int
869a5a4af3bSchristos model_lm32_sub (SIM_CPU *current_cpu, void *sem_arg)
870a5a4af3bSchristos {
871a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
872a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
873a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
874a5a4af3bSchristos   int cycles = 0;
875a5a4af3bSchristos   {
876a5a4af3bSchristos     int referenced = 0;
877a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
878a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
879a5a4af3bSchristos   }
880a5a4af3bSchristos   return cycles;
881a5a4af3bSchristos #undef FLD
882a5a4af3bSchristos }
883a5a4af3bSchristos 
884a5a4af3bSchristos static int
885a5a4af3bSchristos model_lm32_sw (SIM_CPU *current_cpu, void *sem_arg)
886a5a4af3bSchristos {
887a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_addi.f
888a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
889a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
890a5a4af3bSchristos   int cycles = 0;
891a5a4af3bSchristos   {
892a5a4af3bSchristos     int referenced = 0;
893a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
894a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
895a5a4af3bSchristos   }
896a5a4af3bSchristos   return cycles;
897a5a4af3bSchristos #undef FLD
898a5a4af3bSchristos }
899a5a4af3bSchristos 
900a5a4af3bSchristos static int
901a5a4af3bSchristos model_lm32_user (SIM_CPU *current_cpu, void *sem_arg)
902a5a4af3bSchristos {
903a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
904a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
905a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
906a5a4af3bSchristos   int cycles = 0;
907a5a4af3bSchristos   {
908a5a4af3bSchristos     int referenced = 0;
909a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
910a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
911a5a4af3bSchristos   }
912a5a4af3bSchristos   return cycles;
913a5a4af3bSchristos #undef FLD
914a5a4af3bSchristos }
915a5a4af3bSchristos 
916a5a4af3bSchristos static int
917a5a4af3bSchristos model_lm32_wcsr (SIM_CPU *current_cpu, void *sem_arg)
918a5a4af3bSchristos {
919a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_wcsr.f
920a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
921a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
922a5a4af3bSchristos   int cycles = 0;
923a5a4af3bSchristos   {
924a5a4af3bSchristos     int referenced = 0;
925a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
926a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
927a5a4af3bSchristos   }
928a5a4af3bSchristos   return cycles;
929a5a4af3bSchristos #undef FLD
930a5a4af3bSchristos }
931a5a4af3bSchristos 
932a5a4af3bSchristos static int
933a5a4af3bSchristos model_lm32_xor (SIM_CPU *current_cpu, void *sem_arg)
934a5a4af3bSchristos {
935a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
936a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
937a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
938a5a4af3bSchristos   int cycles = 0;
939a5a4af3bSchristos   {
940a5a4af3bSchristos     int referenced = 0;
941a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
942a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
943a5a4af3bSchristos   }
944a5a4af3bSchristos   return cycles;
945a5a4af3bSchristos #undef FLD
946a5a4af3bSchristos }
947a5a4af3bSchristos 
948a5a4af3bSchristos static int
949a5a4af3bSchristos model_lm32_xori (SIM_CPU *current_cpu, void *sem_arg)
950a5a4af3bSchristos {
951a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
952a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
953a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
954a5a4af3bSchristos   int cycles = 0;
955a5a4af3bSchristos   {
956a5a4af3bSchristos     int referenced = 0;
957a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
958a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
959a5a4af3bSchristos   }
960a5a4af3bSchristos   return cycles;
961a5a4af3bSchristos #undef FLD
962a5a4af3bSchristos }
963a5a4af3bSchristos 
964a5a4af3bSchristos static int
965a5a4af3bSchristos model_lm32_xnor (SIM_CPU *current_cpu, void *sem_arg)
966a5a4af3bSchristos {
967a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_user.f
968a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
969a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
970a5a4af3bSchristos   int cycles = 0;
971a5a4af3bSchristos   {
972a5a4af3bSchristos     int referenced = 0;
973a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
974a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
975a5a4af3bSchristos   }
976a5a4af3bSchristos   return cycles;
977a5a4af3bSchristos #undef FLD
978a5a4af3bSchristos }
979a5a4af3bSchristos 
980a5a4af3bSchristos static int
981a5a4af3bSchristos model_lm32_xnori (SIM_CPU *current_cpu, void *sem_arg)
982a5a4af3bSchristos {
983a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_andi.f
984a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
985a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
986a5a4af3bSchristos   int cycles = 0;
987a5a4af3bSchristos   {
988a5a4af3bSchristos     int referenced = 0;
989a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
990a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
991a5a4af3bSchristos   }
992a5a4af3bSchristos   return cycles;
993a5a4af3bSchristos #undef FLD
994a5a4af3bSchristos }
995a5a4af3bSchristos 
996a5a4af3bSchristos static int
997a5a4af3bSchristos model_lm32_break (SIM_CPU *current_cpu, void *sem_arg)
998a5a4af3bSchristos {
999a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_empty.f
1000a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
1001a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
1002a5a4af3bSchristos   int cycles = 0;
1003a5a4af3bSchristos   {
1004a5a4af3bSchristos     int referenced = 0;
1005a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
1006a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
1007a5a4af3bSchristos   }
1008a5a4af3bSchristos   return cycles;
1009a5a4af3bSchristos #undef FLD
1010a5a4af3bSchristos }
1011a5a4af3bSchristos 
1012a5a4af3bSchristos static int
1013a5a4af3bSchristos model_lm32_scall (SIM_CPU *current_cpu, void *sem_arg)
1014a5a4af3bSchristos {
1015a5a4af3bSchristos #define FLD(f) abuf->fields.sfmt_empty.f
1016a5a4af3bSchristos   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
1017a5a4af3bSchristos   const IDESC * UNUSED idesc = abuf->idesc;
1018a5a4af3bSchristos   int cycles = 0;
1019a5a4af3bSchristos   {
1020a5a4af3bSchristos     int referenced = 0;
1021a5a4af3bSchristos     int UNUSED insn_referenced = abuf->written;
1022a5a4af3bSchristos     cycles += lm32bf_model_lm32_u_exec (current_cpu, idesc, 0, referenced);
1023a5a4af3bSchristos   }
1024a5a4af3bSchristos   return cycles;
1025a5a4af3bSchristos #undef FLD
1026a5a4af3bSchristos }
1027a5a4af3bSchristos 
1028a5a4af3bSchristos /* We assume UNIT_NONE == 0 because the tables don't always terminate
1029a5a4af3bSchristos    entries with it.  */
1030a5a4af3bSchristos 
1031a5a4af3bSchristos /* Model timing data for `lm32'.  */
1032a5a4af3bSchristos 
1033a5a4af3bSchristos static const INSN_TIMING lm32_timing[] = {
1034a5a4af3bSchristos   { LM32BF_INSN_X_INVALID, 0, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1035a5a4af3bSchristos   { LM32BF_INSN_X_AFTER, 0, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1036a5a4af3bSchristos   { LM32BF_INSN_X_BEFORE, 0, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1037a5a4af3bSchristos   { LM32BF_INSN_X_CTI_CHAIN, 0, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1038a5a4af3bSchristos   { LM32BF_INSN_X_CHAIN, 0, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1039a5a4af3bSchristos   { LM32BF_INSN_X_BEGIN, 0, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1040a5a4af3bSchristos   { LM32BF_INSN_ADD, model_lm32_add, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1041a5a4af3bSchristos   { LM32BF_INSN_ADDI, model_lm32_addi, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1042a5a4af3bSchristos   { LM32BF_INSN_AND, model_lm32_and, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1043a5a4af3bSchristos   { LM32BF_INSN_ANDI, model_lm32_andi, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1044a5a4af3bSchristos   { LM32BF_INSN_ANDHII, model_lm32_andhii, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1045a5a4af3bSchristos   { LM32BF_INSN_B, model_lm32_b, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1046a5a4af3bSchristos   { LM32BF_INSN_BI, model_lm32_bi, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1047a5a4af3bSchristos   { LM32BF_INSN_BE, model_lm32_be, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1048a5a4af3bSchristos   { LM32BF_INSN_BG, model_lm32_bg, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1049a5a4af3bSchristos   { LM32BF_INSN_BGE, model_lm32_bge, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1050a5a4af3bSchristos   { LM32BF_INSN_BGEU, model_lm32_bgeu, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1051a5a4af3bSchristos   { LM32BF_INSN_BGU, model_lm32_bgu, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1052a5a4af3bSchristos   { LM32BF_INSN_BNE, model_lm32_bne, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1053a5a4af3bSchristos   { LM32BF_INSN_CALL, model_lm32_call, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1054a5a4af3bSchristos   { LM32BF_INSN_CALLI, model_lm32_calli, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1055a5a4af3bSchristos   { LM32BF_INSN_CMPE, model_lm32_cmpe, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1056a5a4af3bSchristos   { LM32BF_INSN_CMPEI, model_lm32_cmpei, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1057a5a4af3bSchristos   { LM32BF_INSN_CMPG, model_lm32_cmpg, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1058a5a4af3bSchristos   { LM32BF_INSN_CMPGI, model_lm32_cmpgi, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1059a5a4af3bSchristos   { LM32BF_INSN_CMPGE, model_lm32_cmpge, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1060a5a4af3bSchristos   { LM32BF_INSN_CMPGEI, model_lm32_cmpgei, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1061a5a4af3bSchristos   { LM32BF_INSN_CMPGEU, model_lm32_cmpgeu, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1062a5a4af3bSchristos   { LM32BF_INSN_CMPGEUI, model_lm32_cmpgeui, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1063a5a4af3bSchristos   { LM32BF_INSN_CMPGU, model_lm32_cmpgu, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1064a5a4af3bSchristos   { LM32BF_INSN_CMPGUI, model_lm32_cmpgui, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1065a5a4af3bSchristos   { LM32BF_INSN_CMPNE, model_lm32_cmpne, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1066a5a4af3bSchristos   { LM32BF_INSN_CMPNEI, model_lm32_cmpnei, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1067a5a4af3bSchristos   { LM32BF_INSN_DIVU, model_lm32_divu, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1068a5a4af3bSchristos   { LM32BF_INSN_LB, model_lm32_lb, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1069a5a4af3bSchristos   { LM32BF_INSN_LBU, model_lm32_lbu, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1070a5a4af3bSchristos   { LM32BF_INSN_LH, model_lm32_lh, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1071a5a4af3bSchristos   { LM32BF_INSN_LHU, model_lm32_lhu, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1072a5a4af3bSchristos   { LM32BF_INSN_LW, model_lm32_lw, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1073a5a4af3bSchristos   { LM32BF_INSN_MODU, model_lm32_modu, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1074a5a4af3bSchristos   { LM32BF_INSN_MUL, model_lm32_mul, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1075a5a4af3bSchristos   { LM32BF_INSN_MULI, model_lm32_muli, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1076a5a4af3bSchristos   { LM32BF_INSN_NOR, model_lm32_nor, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1077a5a4af3bSchristos   { LM32BF_INSN_NORI, model_lm32_nori, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1078a5a4af3bSchristos   { LM32BF_INSN_OR, model_lm32_or, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1079a5a4af3bSchristos   { LM32BF_INSN_ORI, model_lm32_ori, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1080a5a4af3bSchristos   { LM32BF_INSN_ORHII, model_lm32_orhii, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1081a5a4af3bSchristos   { LM32BF_INSN_RCSR, model_lm32_rcsr, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1082a5a4af3bSchristos   { LM32BF_INSN_SB, model_lm32_sb, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1083a5a4af3bSchristos   { LM32BF_INSN_SEXTB, model_lm32_sextb, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1084a5a4af3bSchristos   { LM32BF_INSN_SEXTH, model_lm32_sexth, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1085a5a4af3bSchristos   { LM32BF_INSN_SH, model_lm32_sh, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1086a5a4af3bSchristos   { LM32BF_INSN_SL, model_lm32_sl, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1087a5a4af3bSchristos   { LM32BF_INSN_SLI, model_lm32_sli, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1088a5a4af3bSchristos   { LM32BF_INSN_SR, model_lm32_sr, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1089a5a4af3bSchristos   { LM32BF_INSN_SRI, model_lm32_sri, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1090a5a4af3bSchristos   { LM32BF_INSN_SRU, model_lm32_sru, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1091a5a4af3bSchristos   { LM32BF_INSN_SRUI, model_lm32_srui, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1092a5a4af3bSchristos   { LM32BF_INSN_SUB, model_lm32_sub, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1093a5a4af3bSchristos   { LM32BF_INSN_SW, model_lm32_sw, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1094a5a4af3bSchristos   { LM32BF_INSN_USER, model_lm32_user, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1095a5a4af3bSchristos   { LM32BF_INSN_WCSR, model_lm32_wcsr, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1096a5a4af3bSchristos   { LM32BF_INSN_XOR, model_lm32_xor, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1097a5a4af3bSchristos   { LM32BF_INSN_XORI, model_lm32_xori, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1098a5a4af3bSchristos   { LM32BF_INSN_XNOR, model_lm32_xnor, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1099a5a4af3bSchristos   { LM32BF_INSN_XNORI, model_lm32_xnori, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1100a5a4af3bSchristos   { LM32BF_INSN_BREAK, model_lm32_break, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1101a5a4af3bSchristos   { LM32BF_INSN_SCALL, model_lm32_scall, { { (int) UNIT_LM32_U_EXEC, 1, 1 } } },
1102a5a4af3bSchristos };
1103a5a4af3bSchristos 
1104a5a4af3bSchristos #endif /* WITH_PROFILE_MODEL_P */
1105a5a4af3bSchristos 
1106a5a4af3bSchristos static void
1107a5a4af3bSchristos lm32_model_init (SIM_CPU *cpu)
1108a5a4af3bSchristos {
1109a5a4af3bSchristos   CPU_MODEL_DATA (cpu) = (void *) zalloc (sizeof (MODEL_LM32_DATA));
1110a5a4af3bSchristos }
1111a5a4af3bSchristos 
1112a5a4af3bSchristos #if WITH_PROFILE_MODEL_P
1113a5a4af3bSchristos #define TIMING_DATA(td) td
1114a5a4af3bSchristos #else
1115a5a4af3bSchristos #define TIMING_DATA(td) 0
1116a5a4af3bSchristos #endif
1117a5a4af3bSchristos 
1118e5cb852cSchristos static const SIM_MODEL lm32_models[] =
1119a5a4af3bSchristos {
1120a5a4af3bSchristos   { "lm32", & lm32_mach, MODEL_LM32, TIMING_DATA (& lm32_timing[0]), lm32_model_init },
1121a5a4af3bSchristos   { 0 }
1122a5a4af3bSchristos };
1123a5a4af3bSchristos 
1124a5a4af3bSchristos /* The properties of this cpu's implementation.  */
1125a5a4af3bSchristos 
1126e5cb852cSchristos static const SIM_MACH_IMP_PROPERTIES lm32bf_imp_properties =
1127a5a4af3bSchristos {
1128a5a4af3bSchristos   sizeof (SIM_CPU),
1129a5a4af3bSchristos #if WITH_SCACHE
1130a5a4af3bSchristos   sizeof (SCACHE)
1131a5a4af3bSchristos #else
1132a5a4af3bSchristos   0
1133a5a4af3bSchristos #endif
1134a5a4af3bSchristos };
1135a5a4af3bSchristos 
1136a5a4af3bSchristos 
1137a5a4af3bSchristos static void
1138a5a4af3bSchristos lm32bf_prepare_run (SIM_CPU *cpu)
1139a5a4af3bSchristos {
1140a5a4af3bSchristos   if (CPU_IDESC (cpu) == NULL)
1141a5a4af3bSchristos     lm32bf_init_idesc_table (cpu);
1142a5a4af3bSchristos }
1143a5a4af3bSchristos 
1144a5a4af3bSchristos static const CGEN_INSN *
1145a5a4af3bSchristos lm32bf_get_idata (SIM_CPU *cpu, int inum)
1146a5a4af3bSchristos {
1147a5a4af3bSchristos   return CPU_IDESC (cpu) [inum].idata;
1148a5a4af3bSchristos }
1149a5a4af3bSchristos 
1150a5a4af3bSchristos static void
1151a5a4af3bSchristos lm32_init_cpu (SIM_CPU *cpu)
1152a5a4af3bSchristos {
1153a5a4af3bSchristos   CPU_REG_FETCH (cpu) = lm32bf_fetch_register;
1154a5a4af3bSchristos   CPU_REG_STORE (cpu) = lm32bf_store_register;
1155a5a4af3bSchristos   CPU_PC_FETCH (cpu) = lm32bf_h_pc_get;
1156a5a4af3bSchristos   CPU_PC_STORE (cpu) = lm32bf_h_pc_set;
1157a5a4af3bSchristos   CPU_GET_IDATA (cpu) = lm32bf_get_idata;
1158a5a4af3bSchristos   CPU_MAX_INSNS (cpu) = LM32BF_INSN__MAX;
1159a5a4af3bSchristos   CPU_INSN_NAME (cpu) = cgen_insn_name;
1160a5a4af3bSchristos   CPU_FULL_ENGINE_FN (cpu) = lm32bf_engine_run_full;
1161a5a4af3bSchristos #if WITH_FAST
1162a5a4af3bSchristos   CPU_FAST_ENGINE_FN (cpu) = lm32bf_engine_run_fast;
1163a5a4af3bSchristos #else
1164a5a4af3bSchristos   CPU_FAST_ENGINE_FN (cpu) = lm32bf_engine_run_full;
1165a5a4af3bSchristos #endif
1166a5a4af3bSchristos }
1167a5a4af3bSchristos 
1168e5cb852cSchristos const SIM_MACH lm32_mach =
1169a5a4af3bSchristos {
1170a5a4af3bSchristos   "lm32", "lm32", MACH_LM32,
1171a5a4af3bSchristos   32, 32, & lm32_models[0], & lm32bf_imp_properties,
1172a5a4af3bSchristos   lm32_init_cpu,
1173a5a4af3bSchristos   lm32bf_prepare_run
1174a5a4af3bSchristos };
1175a5a4af3bSchristos 
1176