import gdb-1999-11-08 snapshot
[deliverable/binutils-gdb.git] / sim / common / cgen-par.h
CommitLineData
d4f3574e
SS
1/* Simulator header for cgen parallel support.
2 Copyright (C) 1999 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
4
5This file is part of the GNU instruction set simulator.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License along
18with this program; if not, write to the Free Software Foundation, Inc.,
1959 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#ifndef CGEN_PAR_H
22#define CGEN_PAR_H
23
24/* Kinds of writes stored on the write queue. */
25enum cgen_write_queue_kind {
c2c6d25f 26 CGEN_BI_WRITE, CGEN_QI_WRITE, CGEN_SI_WRITE, CGEN_SF_WRITE,
d4f3574e 27 CGEN_PC_WRITE,
2df3850c 28 CGEN_FN_HI_WRITE, CGEN_FN_SI_WRITE, CGEN_FN_DI_WRITE, CGEN_FN_DF_WRITE,
11cf8741 29 CGEN_FN_XI_WRITE, CGEN_FN_PC_WRITE,
917317f4 30 CGEN_MEM_QI_WRITE, CGEN_MEM_HI_WRITE, CGEN_MEM_SI_WRITE, CGEN_MEM_DI_WRITE,
11cf8741 31 CGEN_MEM_DF_WRITE, CGEN_MEM_XI_WRITE,
d4f3574e
SS
32 CGEN_NUM_WRITE_KINDS
33};
34
35/* Element of the write queue. */
36typedef struct {
37 enum cgen_write_queue_kind kind; /* Used to select union member below. */
e514a9d6 38 IADDR insn_address; /* Address of the insn performing the write. */
d4f3574e 39 union {
c2c6d25f
JM
40 struct {
41 BI *target;
42 BI value;
43 } bi_write;
d4f3574e
SS
44 struct {
45 UQI *target;
46 QI value;
47 } qi_write;
48 struct {
49 SI *target;
50 SI value;
51 } si_write;
52 struct {
53 SI *target;
54 SF value;
55 } sf_write;
56 struct {
57 USI value;
58 } pc_write;
2df3850c
JM
59 struct {
60 UINT regno;
61 UHI value;
62 void (*function)(SIM_CPU *, UINT, UHI);
63 } fn_hi_write;
d4f3574e
SS
64 struct {
65 UINT regno;
66 SI value;
67 void (*function)(SIM_CPU *, UINT, USI);
68 } fn_si_write;
69 struct {
70 UINT regno;
71 DI value;
72 void (*function)(SIM_CPU *, UINT, DI);
73 } fn_di_write;
74 struct {
75 UINT regno;
76 DI value;
77 void (*function)(SIM_CPU *, UINT, DI);
78 } fn_df_write;
11cf8741
JM
79 struct {
80 UINT regno;
81 SI value[4];
82 void (*function)(SIM_CPU *, UINT, SI *);
83 } fn_xi_write;
e514a9d6
JM
84 struct {
85 USI value;
86 void (*function)(SIM_CPU *, USI);
87 } fn_pc_write;
d4f3574e
SS
88 struct {
89 SI address;
90 QI value;
91 } mem_qi_write;
92 struct {
93 SI address;
94 HI value;
95 } mem_hi_write;
96 struct {
97 SI address;
98 SI value;
99 } mem_si_write;
917317f4
JM
100 struct {
101 SI address;
102 DI value;
103 } mem_di_write;
104 struct {
105 SI address;
106 DI value;
107 } mem_df_write;
11cf8741
JM
108 struct {
109 SI address;
110 SI value[4];
111 } mem_xi_write;
d4f3574e
SS
112 } kinds;
113} CGEN_WRITE_QUEUE_ELEMENT;
114
115#define CGEN_WRITE_QUEUE_ELEMENT_KIND(element) ((element)->kind)
e514a9d6 116#define CGEN_WRITE_QUEUE_ELEMENT_IADDR(element) ((element)->insn_address)
d4f3574e
SS
117
118extern void cgen_write_queue_element_execute (
119 SIM_CPU *, CGEN_WRITE_QUEUE_ELEMENT *
120);
121
122/* Instance of the queue for parallel write-after support. */
123/* FIXME: Should be dynamic? */
124#define CGEN_WRITE_QUEUE_SIZE (4 * 4) /* 4 writes x 4 insns -- for now. */
125
126typedef struct {
127 int index;
128 CGEN_WRITE_QUEUE_ELEMENT q[CGEN_WRITE_QUEUE_SIZE];
129} CGEN_WRITE_QUEUE;
130
131#define CGEN_WRITE_QUEUE_CLEAR(queue) ((queue)->index = 0)
132#define CGEN_WRITE_QUEUE_INDEX(queue) ((queue)->index)
133#define CGEN_WRITE_QUEUE_ELEMENT(queue, ix) (&(queue)->q[(ix)])
134
135#define CGEN_WRITE_QUEUE_NEXT(queue) ( \
136 (queue)->index < CGEN_WRITE_QUEUE_SIZE \
137 ? &(queue)->q[(queue)->index++] \
138 : cgen_write_queue_overflow (queue) \
139)
140
141extern CGEN_WRITE_QUEUE_ELEMENT *cgen_write_queue_overflow (CGEN_WRITE_QUEUE *);
142
143/* Functions for queuing writes. Used by semantic code. */
c2c6d25f 144extern void sim_queue_bi_write (SIM_CPU *, BI *, BI);
d4f3574e
SS
145extern void sim_queue_qi_write (SIM_CPU *, UQI *, UQI);
146extern void sim_queue_si_write (SIM_CPU *, SI *, SI);
147extern void sim_queue_sf_write (SIM_CPU *, SI *, SF);
148
149extern void sim_queue_pc_write (SIM_CPU *, USI);
150
2df3850c 151extern void sim_queue_fn_hi_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, UHI), UINT, UHI);
d4f3574e
SS
152extern void sim_queue_fn_si_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, USI), UINT, SI);
153extern void sim_queue_fn_di_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, DI), UINT, DI);
154extern void sim_queue_fn_df_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, DI), UINT, DF);
11cf8741 155extern void sim_queue_fn_xi_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, SI *), UINT, SI *);
e514a9d6 156extern void sim_queue_fn_pc_write (SIM_CPU *, void (*)(SIM_CPU *, USI), USI);
d4f3574e
SS
157
158extern void sim_queue_mem_qi_write (SIM_CPU *, SI, QI);
159extern void sim_queue_mem_hi_write (SIM_CPU *, SI, HI);
160extern void sim_queue_mem_si_write (SIM_CPU *, SI, SI);
917317f4
JM
161extern void sim_queue_mem_di_write (SIM_CPU *, SI, DI);
162extern void sim_queue_mem_df_write (SIM_CPU *, SI, DF);
11cf8741 163extern void sim_queue_mem_xi_write (SIM_CPU *, SI, SI *);
d4f3574e
SS
164
165#endif /* CGEN_PAR_H */
This page took 0.034289 seconds and 4 git commands to generate.