]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/common/cgen-par.h
import gdb-1999-09-08 snapshot
[thirdparty/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 {
26 CGEN_QI_WRITE, CGEN_SI_WRITE, CGEN_SF_WRITE,
27 CGEN_PC_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,
30 CGEN_NUM_WRITE_KINDS
31};
32
33/* Element of the write queue. */
34typedef struct {
35 enum cgen_write_queue_kind kind; /* Used to select union member below. */
36 union {
37 struct {
38 UQI *target;
39 QI value;
40 } qi_write;
41 struct {
42 SI *target;
43 SI value;
44 } si_write;
45 struct {
46 SI *target;
47 SF value;
48 } sf_write;
49 struct {
50 USI value;
51 } pc_write;
52 struct {
53 UINT regno;
54 SI value;
55 void (*function)(SIM_CPU *, UINT, USI);
56 } fn_si_write;
57 struct {
58 UINT regno;
59 DI value;
60 void (*function)(SIM_CPU *, UINT, DI);
61 } fn_di_write;
62 struct {
63 UINT regno;
64 DI value;
65 void (*function)(SIM_CPU *, UINT, DI);
66 } fn_df_write;
67 struct {
68 SI address;
69 QI value;
70 } mem_qi_write;
71 struct {
72 SI address;
73 HI value;
74 } mem_hi_write;
75 struct {
76 SI address;
77 SI value;
78 } mem_si_write;
79 } kinds;
80} CGEN_WRITE_QUEUE_ELEMENT;
81
82#define CGEN_WRITE_QUEUE_ELEMENT_KIND(element) ((element)->kind)
83
84extern void cgen_write_queue_element_execute (
85 SIM_CPU *, CGEN_WRITE_QUEUE_ELEMENT *
86);
87
88/* Instance of the queue for parallel write-after support. */
89/* FIXME: Should be dynamic? */
90#define CGEN_WRITE_QUEUE_SIZE (4 * 4) /* 4 writes x 4 insns -- for now. */
91
92typedef struct {
93 int index;
94 CGEN_WRITE_QUEUE_ELEMENT q[CGEN_WRITE_QUEUE_SIZE];
95} CGEN_WRITE_QUEUE;
96
97#define CGEN_WRITE_QUEUE_CLEAR(queue) ((queue)->index = 0)
98#define CGEN_WRITE_QUEUE_INDEX(queue) ((queue)->index)
99#define CGEN_WRITE_QUEUE_ELEMENT(queue, ix) (&(queue)->q[(ix)])
100
101#define CGEN_WRITE_QUEUE_NEXT(queue) ( \
102 (queue)->index < CGEN_WRITE_QUEUE_SIZE \
103 ? &(queue)->q[(queue)->index++] \
104 : cgen_write_queue_overflow (queue) \
105)
106
107extern CGEN_WRITE_QUEUE_ELEMENT *cgen_write_queue_overflow (CGEN_WRITE_QUEUE *);
108
109/* Functions for queuing writes. Used by semantic code. */
110extern void sim_queue_qi_write (SIM_CPU *, UQI *, UQI);
111extern void sim_queue_si_write (SIM_CPU *, SI *, SI);
112extern void sim_queue_sf_write (SIM_CPU *, SI *, SF);
113
114extern void sim_queue_pc_write (SIM_CPU *, USI);
115
116extern void sim_queue_fn_si_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, USI), UINT, SI);
117extern void sim_queue_fn_di_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, DI), UINT, DI);
118extern void sim_queue_fn_df_write (SIM_CPU *, void (*)(SIM_CPU *, UINT, DI), UINT, DF);
119
120extern void sim_queue_mem_qi_write (SIM_CPU *, SI, QI);
121extern void sim_queue_mem_hi_write (SIM_CPU *, SI, HI);
122extern void sim_queue_mem_si_write (SIM_CPU *, SI, SI);
123
124#endif /* CGEN_PAR_H */