-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
216 lines (166 loc) · 6.65 KB
/
README
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
This is the README for CGEN 1.1.
If you just want to read up on cgen, I suggest going directly to the
doc directory, and in particular doc/intro.texi.
What is it?
-----------
In a nutshell, CGEN is a project to provide a uniform framework for doing
binutils and simulator ports without explicitly closing any doors on anything
else one might want to do with the cpu description (i.e. application
independence). The "cpu description" as defined here includes anything useful.
To this end CGEN is a very open-ended and ambitious project.
The core of CGEN is a cpu description file and code to slurp it in and
build a database describing the cpu. From this the Binutils opcodes table
can be generated for example, as well as an ISA simulator decoder/executor.
CGEN is not a new idea. Other GNU ports have done this (e.g. `sh' in its
early days). However, the idea never really "caught on". CGEN was started
because I think it should be.
CGEN is short for "Cpu tools GENerator".
Copyright
--------
CGEN is Copyright 2000, 2009 Red Hat, Inc.
The full text of the copyright for CGEN is contained in the file
COPYING.CGEN. The copyright of CGEN uses the Autoconf copyright
as a guide. The intent is to have CGEN under a GNU-style copyright but
place no restrictions on the output of CGEN.
Installation
------------
CGEN has been in use since 2000 with all releases of GNU Binutils and GDB.
GNU Binutils/GDB users will never "use" CGEN though. The generated sources
are shipped with GNU Binutils/GDB releases.
Binutils/GDB developers wishing to use CGEN must configure Binutils/GDB with
--enable-cgen-maint. This will add the necessary dependencies to
opcodes/Makefile and sim/<arch>/Makefile for the supported processors.
CGEN uses Guile so Guile must be installed.
CGEN has been tested with Guile 1.4.1, 1.6.8, and 1.8.5.
Support for older versions of Guile will be removed in time.
Source Layout
-------------
CGEN sources are divided into several categories:
- documentation
- code to read .cpu files
- application source generators
- opcodes
- gas testsuite
- sim
- sim testsuite
- sid
- intrinsics
- html
- misc support scripts
- cpu specific files
- C support code
File naming rules:
1. The top level script for each application shall be named
cgen-<appl>.scm. No other files shall be named cgen-*.scm.
2. Files implementing a particular class (or related collection of
classes) shall be named <class-name>.scm, or a reasonable
abbreviation thereof.
3. CPU description files shall be named <arch>.cpu and placed in the
`cpu' sub-directory (either src/cpu or src/cgen/cpu).
4. CPU opcode support files shall be named <arch>.opc and similarly
placed in the `cpu' sub-directory.
Documentation
-------------
Documentation uses texinfo.
See doc/*.texi.
doc/cgen.texi - top level .texi file, includes the others
doc/cgenint.texi - top level .texi file for cgen internals
Code to read .cpu files
-----------------------
These files provide the basic support for reading in .cpu files. They contain
no application specific code (and ideally as little C generating code as
possible too), they are intended to be application independent. Applications
(e.g. the opcode table generator and the simulator support generator) are
built on top of these files.
attr.scm - attribute support
enum.scm - enum support
hardware.scm - hardware description reader
ifield.scm - instruction field reader
iformat.scm - computes instruction formats
insn.scm - instruction description reader
mach.scm - architecture/cpu/machine reader
minsn.scm - macro-instruction description reader
mode.scm - mode support
model.scm - model reader
operand.scm - instruction operand reader
read.scm - top level script for .cpu file reading
rtl.scm - basic rtl support
rtl-traverse.scm - support for processing rtl
rtx-funcs.scm - defines all standard rtx functions
semantics.scm - routines for semantic analysis
types.scm - misc utilities related to types
Applications
------------
opcode table generator
----------------------
cgen-opc.scm - top level script to generate the opcode table + support
opcodes.scm
opc-asmdis.scm
opc-ibld.scm
opc-itab.scm
opc-opinst.scm
Additional support lives in the opcodes directory.
opcodes/cgen-ibld.in - input file for <arch>-ibld.c
opcodes/cgen-asm.in - input file for <arch>-asm.c
opcodes/cgen-dis.in - input file for <arch>-dis.c
opcodes/cgen-opc.c - architecture independent opcode table support
opcodes/cgen-asm.c - architecture independent assembler support
opcodes/cgen-dis.c - architecture independent disassembler support
opcodes/cgen.sh - shell script invoked by opcodes/Makefile to build
<arch>-opc.h, <arch>-opc.c, <arch>-asm.c, <arch>-dis.c.
The header file that defines the interface to the opcodes table is
include/opcode/cgen.h.
gas testsuite generator
-----------------------
cgen-gas.scm - top level script to generate gas testcases
gas-test.scm - generate gas testcases
simulator generator
-------------------
cgen-sim.scm - top level script to generate simulator files
sim-arch.scm - generator for architecture-wide support files
sim-cpu.scm - generator for cpu specific simulator files
sim-decode.scm - decoder generator
sim-model.scm - generates model support
sim.scm - interface between simulator generator and cpu database
Additional support lives in sim/common/cgen-*.[ch].
Architectures specific files live in sim/<arch>.
sim testsuite generator
-----------------------
cgen-stest.scm - top level script to generate simulator testcases
sim-test.scm - generate simulator testcases
sid (another architectural simulator)
-------------------------------------
cgen-sid.scm - top level script to generate sid files
sid-cpu.scm
sid-decode.scm
sid-model.scm
sid.scm
html
----
cgen-doc.scm - top level script to generate html files
html.scm
intrinsics
----------
cgen-intrinsics.scm - top level script to generate intrinsics files
intrinsics.scm
Misc. support scripts
---------------------
dev.scm - top level script for doing interactive development
guile.scm - Guile-specific definitions, and adaptations to specific
versions of Guile
cos.scm - OOP implementation
pmacros.scm - preprocessor-style macro package
profile.scm - Guile profiling tool [eventually wish to move this to
Guile distribution when finished]
utils-cgen.scm - various utilities specific to cgen
utils.scm - generic Scheme utilities [non cgen specific]
slib/genwrite.scm - generic-write routine
slib/logical.scm - utilities for boolean operations
slib/pp.scm - pretty printer
slib/random.scm - random number generator
slib/sort.scm - sort routine, from slib
CPU specific files
------------------
<arch>.cpu - <arch> description file
<arch>.opc - <arch> opcode support
null.cpu - minimal .cpu file for debugging purposes