1
Fork 0
mirror of https://sourceware.org/git/cgen.git synced 2025-11-15 15:33:43 +00:00
No description
Find a file
2025-01-01 18:24:35 +10:30
cpu Move cpu files from cgen/cpu to top level cpu directory. 2011-08-22 15:25:10 +00:00
doc Update to autotools used by binutils 2020-02-12 12:02:21 +10:30
slib Update the address and phone number of the FSF organization 2005-05-10 10:21:04 +00:00
testsuite Update to autotools used by binutils 2020-02-12 12:02:21 +10:30
.gitignore Add a .gitignore 2023-08-19 11:40:54 -06:00
aclocal.m4 Update to autotools used by binutils 2020-02-12 12:02:21 +10:30
attr.scm Specify isa(s) when doing ifield, operand, insn lookups. 2009-11-03 16:24:02 +00:00
AUTHORS Add copyright notices 2012-12-17 16:55:42 +00:00
cgen-doc.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
cgen-gas.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
cgen-intrinsics.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
cgen-opc.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
cgen-sid.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
cgen-sim.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
cgen-stest.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
cgen-testsuite.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
ChangeLog Compute correct mask and values when offset in define-ifield is not 0. 2021-09-15 18:47:40 +02:00
co-for-gen-all Add copyright notices 2012-12-17 16:55:42 +00:00
configure Update to autotools used by binutils 2020-02-12 12:02:21 +10:30
configure.ac Update to autotools used by binutils 2020-02-12 12:02:21 +10:30
COPYING.CGEN Change source files over to GPLv3. 2007-07-05 09:49:03 +00:00
cos.scm Hack cos.scm to work with new Guile 2023-08-22 10:52:33 -06:00
decode.scm tweak comment 2009-12-03 03:03:17 +00:00
desc-cpu.scm cgen: remove use of PTR 2022-05-11 09:39:22 +09:30
desc.scm cgen: remove use of PTR 2022-05-11 09:39:22 +09:30
dev-utils.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
dev.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
enum.scm Remove =? and >=? aliases 2023-08-22 10:52:33 -06:00
gas-test.scm * utils.scm (reduce): Delete. 2009-11-05 16:55:33 +00:00
gen-all Add copyright notices 2012-12-17 16:55:42 +00:00
gen-all-desc Add copyright notices 2012-12-17 16:55:42 +00:00
gen-all-doc gen-doc: Updates for latest cpu definitions 2019-06-12 11:00:15 -04:00
gen-all-intrinsics Add copyright notices 2012-12-17 16:55:42 +00:00
gen-all-opcodes Add copyright notices 2012-12-17 16:55:42 +00:00
gen-all-sid Add copyright notices 2012-12-17 16:55:42 +00:00
gen-all-sim Add copyright notices 2012-12-17 16:55:42 +00:00
guile.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
hardware.scm * hardware.scm (hw-pc?): New function. 2009-11-23 09:03:01 +00:00
html.scm gen-doc: Updates for latest cpu definitions 2019-06-12 11:00:15 -04:00
ifield.scm Compute correct mask and values when offset in define-ifield is not 0. 2021-09-15 18:47:40 +02:00
iformat.scm * iformat.scm (/sfmt-search-key): Use iformat key instead of list 2010-02-13 04:34:49 +00:00
insn.scm Fix bug in insn.scm 2023-08-22 10:52:33 -06:00
INSTALL Update to autotools used by binutils 2020-02-12 12:02:21 +10:30
intrinsics.scm * utils.scm (reduce): Delete. 2009-11-05 16:55:33 +00:00
mach.scm update copyright year 2010-02-13 03:39:15 +00:00
MAINTAINERS start a simple MAINTAINERS file 2021-09-14 20:35:22 -04:00
Makefile.am Update to autotools used by binutils 2020-02-12 12:02:21 +10:30
Makefile.in Update to autotools used by binutils 2020-02-12 12:02:21 +10:30
minsn.scm Specify isa(s) when doing ifield, operand, insn lookups. 2009-11-03 16:24:02 +00:00
mode.scm * utils-cgen.scm (<location>): Define using new define-class. 2010-01-25 00:40:29 +00:00
model.scm * utils-cgen.scm (<location>): Define using new define-class. 2010-01-25 00:40:29 +00:00
NEWS Add copyright notices 2012-12-17 16:55:42 +00:00
opc-asmdis.scm cgen: remove use of PTR 2022-05-11 09:39:22 +09:30
opc-ibld.scm binutils opcodes error messages 2018-03-03 01:31:31 +00:00
opc-itab.scm cgen: remove use of PTR 2022-05-11 09:39:22 +09:30
opc-opinst.scm 2016-04-14 Trevor Saunders <tbsaunde@tbsaunde.org> 2016-04-14 15:27:54 +00:00
opcodes.scm Remove =? and >=? aliases 2023-08-22 10:52:33 -06:00
operand.scm update copyright year 2010-02-13 03:39:15 +00:00
pgmr-tools.scm Remove define-in-define 2023-08-22 10:52:33 -06:00
pmacros.scm update copyright year 2010-02-13 03:39:15 +00:00
profile.scm * All *.scm files: Update copyright year. 2009-06-24 15:03:09 +00:00
read.scm Enable the Guile compiler 2023-08-22 12:51:05 -06:00
README Remove support for old versions of Guile 2023-08-22 10:52:33 -06:00
rtl-c.scm cgen: Add unordered compare operation 2019-06-12 10:59:59 -04:00
rtl-traverse.scm Invalid code in rtx-traverse.scm 2023-08-22 10:52:33 -06:00
rtl-xform.scm * rtl-traverse.scm (/rtx-canon-anycexprmode): New function. 2010-01-21 07:34:56 +00:00
rtl.scm Use define-macro in rtl.scm 2023-08-22 10:52:33 -06:00
rtx-funcs.scm Remove let bindings of macros 2023-08-22 10:52:33 -06:00
sem-frags.scm Remove some 'fastcall' code 2023-08-22 10:52:09 -06:00
semantics.scm * hardware.scm (hw-pc?): New function. 2009-11-23 09:03:01 +00:00
sid-cpu.scm update copyright year 2010-02-13 03:39:15 +00:00
sid-decode.scm Specify isa(s) when doing ifield, operand, insn lookups. 2009-11-03 16:24:02 +00:00
sid-model.scm * insn.scm (/parse-insn-format): New arg `verify?', all callers updated. 2009-09-10 07:23:29 +00:00
sid.scm sid/sim: constify sim_machs storage 2021-09-14 15:34:55 -04:00
sim-arch.scm or1k support 2014-05-19 01:24:00 +00:00
sim-cpu.scm sim: update to reduce generated file differences 2023-08-10 12:04:17 +09:30
sim-decode.scm sim: mark local insn var as unused [PR sim/31181] 2023-12-21 12:27:23 -05:00
sim-model.scm cgen: sim: Updates to sim files to match gdb types 2016-05-09 21:50:25 +00:00
sim-test.scm Remove =? and >=? aliases 2023-08-22 10:52:33 -06:00
sim.scm sim: tighten up generated whitespace 2022-11-01 19:49:26 +05:45
stamp-h.in *** empty log message *** 2000-07-28 04:11:53 +00:00
testsuite.scm Extend pmacro language, add testsuite. 2009-07-13 20:55:21 +00:00
types.scm * types.scm (<struct>): Delete. 2009-09-08 06:51:44 +00:00
utils-cgen.scm cgen/ 2010-10-09 06:50:21 +00:00
utils-gen.scm * hardware.scm (hw-pc?): New function. 2009-11-23 09:03:01 +00:00
utils-sim.scm sim: tighten up generated decode tables 2023-12-22 10:51:18 -05:00
utils.scm Update year range in emitted copyright notice 2025-01-01 18:24:35 +10:30

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 3.0.7.
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