1 /* Simulator header for cgen parallel support.
2 Copyright (C) 1999-2018 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
5 This file is part of the GNU instruction set simulator.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* Kinds of writes stored on the write queue. */
24 enum cgen_write_queue_kind {
25 CGEN_BI_WRITE, CGEN_QI_WRITE, CGEN_SI_WRITE, CGEN_SF_WRITE,
27 CGEN_FN_HI_WRITE, CGEN_FN_SI_WRITE, CGEN_FN_SF_WRITE,
28 CGEN_FN_DI_WRITE, CGEN_FN_DF_WRITE,
29 CGEN_FN_XI_WRITE, CGEN_FN_PC_WRITE,
30 CGEN_MEM_QI_WRITE, CGEN_MEM_HI_WRITE, CGEN_MEM_SI_WRITE, CGEN_MEM_DI_WRITE,
31 CGEN_MEM_DF_WRITE, CGEN_MEM_XI_WRITE,
32 CGEN_FN_MEM_QI_WRITE, CGEN_FN_MEM_HI_WRITE, CGEN_FN_MEM_SI_WRITE,
33 CGEN_FN_MEM_DI_WRITE, CGEN_FN_MEM_DF_WRITE, CGEN_FN_MEM_XI_WRITE,
37 /* Element of the write queue. */
39 enum cgen_write_queue_kind kind; /* Used to select union member below. */
40 IADDR insn_address; /* Address of the insn performing the write. */
41 unsigned32 flags; /* Target specific flags. */
42 long word1; /* Target specific field. */
66 void (*function)(SIM_CPU *, UINT, UHI);
71 void (*function)(SIM_CPU *, UINT, USI);
76 void (*function)(SIM_CPU *, UINT, SF);
81 void (*function)(SIM_CPU *, UINT, DI);
86 void (*function)(SIM_CPU *, UINT, DF);
91 void (*function)(SIM_CPU *, UINT, SI *);
95 void (*function)(SIM_CPU *, USI);
124 void (*function)(SIM_CPU *, IADDR, SI, QI);
129 void (*function)(SIM_CPU *, IADDR, SI, HI);
134 void (*function)(SIM_CPU *, IADDR, SI, SI);
139 void (*function)(SIM_CPU *, IADDR, SI, DI);
144 void (*function)(SIM_CPU *, IADDR, SI, DF);
149 void (*function)(SIM_CPU *, IADDR, SI, SI *);
152 } CGEN_WRITE_QUEUE_ELEMENT;
154 #define CGEN_WRITE_QUEUE_ELEMENT_KIND(element) ((element)->kind)
155 #define CGEN_WRITE_QUEUE_ELEMENT_IADDR(element) ((element)->insn_address)
156 #define CGEN_WRITE_QUEUE_ELEMENT_FLAGS(element) ((element)->flags)
157 #define CGEN_WRITE_QUEUE_ELEMENT_WORD1(element) ((element)->word1)
159 extern void cgen_write_queue_element_execute (
160 SIM_CPU *, CGEN_WRITE_QUEUE_ELEMENT *
163 /* Instance of the queue for parallel write-after support. */
164 /* FIXME: Should be dynamic? */
165 #define CGEN_WRITE_QUEUE_SIZE (64 * 4) /* 64 writes x 4 insns -- for now. */
169 CGEN_WRITE_QUEUE_ELEMENT q[CGEN_WRITE_QUEUE_SIZE];
172 #define CGEN_WRITE_QUEUE_CLEAR(queue) ((queue)->index = 0)
173 #define CGEN_WRITE_QUEUE_INDEX(queue) ((queue)->index)
174 #define CGEN_WRITE_QUEUE_ELEMENT(queue, ix) (&(queue)->q[(ix)])
176 #define CGEN_WRITE_QUEUE_NEXT(queue) ( \
177 (queue)->index < CGEN_WRITE_QUEUE_SIZE \
178 ? &(queue)->q[(queue)->index++] \
179 : cgen_write_queue_overflow (queue) \
182 extern CGEN_WRITE_QUEUE_ELEMENT *cgen_write_queue_overflow (CGEN_WRITE_QUEUE *);
184 /* Functions for queuing writes. Used by semantic code. */
185 extern void sim_queue_bi_write (SIM_CPU *, BI *, BI);
186 extern void sim_queue_qi_write (SIM_CPU *, UQI *, UQI);
187 extern void sim_queue_si_write (SIM_CPU *, SI *, SI);
188 extern void sim_queue_sf_write (SIM_CPU *, SI *, SF);
190 extern void sim_queue_pc_write (SIM_CPU *, USI);
192 extern void sim_queue_fn_hi_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, UHI), UINT, UHI);
193 extern void sim_queue_fn_si_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, USI), UINT, USI);
194 extern void sim_queue_fn_sf_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, SF), UINT, SF);
195 extern void sim_queue_fn_di_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, DI), UINT, DI);
196 extern void sim_queue_fn_df_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, DF), UINT, DF);
197 extern void sim_queue_fn_xi_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, SI *), UINT, SI *);
198 extern void sim_queue_fn_pc_write (SIM_CPU *, void (*)(SIM_CPU *, USI), USI);
200 extern void sim_queue_mem_qi_write (SIM_CPU *, SI, QI);
201 extern void sim_queue_mem_hi_write (SIM_CPU *, SI, HI);
202 extern void sim_queue_mem_si_write (SIM_CPU *, SI, SI);
203 extern void sim_queue_mem_di_write (SIM_CPU *, SI, DI);
204 extern void sim_queue_mem_df_write (SIM_CPU *, SI, DF);
205 extern void sim_queue_mem_xi_write (SIM_CPU *, SI, SI *);
207 extern void sim_queue_fn_mem_qi_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, QI), SI, QI);
208 extern void sim_queue_fn_mem_hi_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, HI), SI, HI);
209 extern void sim_queue_fn_mem_si_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, SI), SI, SI);
210 extern void sim_queue_fn_mem_di_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, DI), SI, DI);
211 extern void sim_queue_fn_mem_df_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, DF), SI, DF);
212 extern void sim_queue_fn_mem_xi_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, SI *), SI, SI *);
214 #endif /* CGEN_PAR_H */