1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/* Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
Copyright (C) 1998, Cygnus Solutions
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _ENGINE_C_
#define _ENGINE_C_
#include "sim-inline.c"
#include "sim-main.h"
#include "itable.h"
#include "idecode.h"
#include "semantics.h"
#include "icache.h"
#include "engine.h"
#include "support.h"
#include "sim-assert.h"
#include "hardware.h"
enum {
/* greater or equal to zero => table */
function_entry = -1,
boolean_entry = -2,
};
typedef struct _idecode_table_entry {
int shift;
unsigned32 mask;
unsigned32 value;
void *function_or_table;
} idecode_table_entry;
INLINE_ENGINE\
(void) engine_run
(SIM_DESC sd,
int next_cpu_nr,
int siggnal)
{
sim_cpu *processor = NULL;
instruction_address cia;
int current_cpu = next_cpu_nr;
instruction_word instruction_0;
/* Hard coded main loop. Not pretty, but should work. */
ASSERT(current_cpu >= 0 && current_cpu < NUMBER_CPUS);
cia = CPU_CIA (0); /* Only the 5900 uses this. */
processor = STATE_CPU (sd, 0); /* Only the 5900 uses this. */
switch(current_cpu)
{
case 0:
goto cpu_0;
case 1:
goto cpu_1;
case 2:
goto cpu_2;
case 3:
goto cpu_3;
case 4:
goto cpu_4;
}
while (1)
{
cpu_0:
cia = CPU_CIA (processor);
instruction_0 = IMEM (cia);
#if defined (ENGINE_ISSUE_PREFIX_HOOK)
ENGINE_ISSUE_PREFIX_HOOK();
#endif
cia = idecode_issue(sd, instruction_0, cia);
#if defined (ENGINE_ISSUE_POSTFIX_HOOK)
ENGINE_ISSUE_POSTFIX_HOOK();
#endif
/* Update the instruction address */
CPU_CIA (processor) = cia;
cpu_1:
pke0_issue();
cpu_2:
pke1_issue();
cpu_3:
vu0_issue();
cpu_4:
vu1_issue();
events:
/* process any events */
if (sim_events_tick (sd))
{
sim_events_process (sd);
}
}
}
#endif /* _ENGINE_C_*/
|