1 /* Simulator header for cgen parallel support.
2 Copyright (C) 1999 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 2, or (at your option)
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 along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24 /* Kinds of writes stored on the write queue. */
25 enum cgen_write_queue_kind
{
26 CGEN_BI_WRITE
, CGEN_QI_WRITE
, CGEN_SI_WRITE
, CGEN_SF_WRITE
,
28 CGEN_FN_SI_WRITE
, CGEN_FN_DI_WRITE
, CGEN_FN_DF_WRITE
,
29 CGEN_MEM_QI_WRITE
, CGEN_MEM_HI_WRITE
, CGEN_MEM_SI_WRITE
,
33 /* Element of the write queue. */
35 enum cgen_write_queue_kind kind
; /* Used to select union member below. */
59 void (*function
)(SIM_CPU
*, UINT
, USI
);
64 void (*function
)(SIM_CPU
*, UINT
, DI
);
69 void (*function
)(SIM_CPU
*, UINT
, DI
);
84 } CGEN_WRITE_QUEUE_ELEMENT
;
86 #define CGEN_WRITE_QUEUE_ELEMENT_KIND(element) ((element)->kind)
88 extern void cgen_write_queue_element_execute (
89 SIM_CPU
*, CGEN_WRITE_QUEUE_ELEMENT
*
92 /* Instance of the queue for parallel write-after support. */
93 /* FIXME: Should be dynamic? */
94 #define CGEN_WRITE_QUEUE_SIZE (4 * 4) /* 4 writes x 4 insns -- for now. */
98 CGEN_WRITE_QUEUE_ELEMENT q
[CGEN_WRITE_QUEUE_SIZE
];
101 #define CGEN_WRITE_QUEUE_CLEAR(queue) ((queue)->index = 0)
102 #define CGEN_WRITE_QUEUE_INDEX(queue) ((queue)->index)
103 #define CGEN_WRITE_QUEUE_ELEMENT(queue, ix) (&(queue)->q[(ix)])
105 #define CGEN_WRITE_QUEUE_NEXT(queue) ( \
106 (queue)->index < CGEN_WRITE_QUEUE_SIZE \
107 ? &(queue)->q[(queue)->index++] \
108 : cgen_write_queue_overflow (queue) \
111 extern CGEN_WRITE_QUEUE_ELEMENT
*cgen_write_queue_overflow (CGEN_WRITE_QUEUE
*);
113 /* Functions for queuing writes. Used by semantic code. */
114 extern void sim_queue_bi_write (SIM_CPU
*, BI
*, BI
);
115 extern void sim_queue_qi_write (SIM_CPU
*, UQI
*, UQI
);
116 extern void sim_queue_si_write (SIM_CPU
*, SI
*, SI
);
117 extern void sim_queue_sf_write (SIM_CPU
*, SI
*, SF
);
119 extern void sim_queue_pc_write (SIM_CPU
*, USI
);
121 extern void sim_queue_fn_si_write (SIM_CPU
*, void (*)(SIM_CPU
*, UINT
, USI
), UINT
, SI
);
122 extern void sim_queue_fn_di_write (SIM_CPU
*, void (*)(SIM_CPU
*, UINT
, DI
), UINT
, DI
);
123 extern void sim_queue_fn_df_write (SIM_CPU
*, void (*)(SIM_CPU
*, UINT
, DI
), UINT
, DF
);
125 extern void sim_queue_mem_qi_write (SIM_CPU
*, SI
, QI
);
126 extern void sim_queue_mem_hi_write (SIM_CPU
*, SI
, HI
);
127 extern void sim_queue_mem_si_write (SIM_CPU
*, SI
, SI
);
129 #endif /* CGEN_PAR_H */