Code Search for Developers
 
 
  

README from Gdb at Krugle


Show README syntax highlighted

This is the README for CGEN 1.0.

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".  It's not a very good name.
I'm not very good at picking names.  An early version of the name was
"GENCPU"!  So give me a better one.

Copyright
--------

CGEN is Copyright 2000 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 0.7.1 can be used with GNU Binutils snapshots as of ??????
and GNU GDB snapshots as of ??????.
GNU Binutils/GDB users will never "use" CGEN.  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, which
at this point is M32R and FR30.

CGEN uses Guile so Guile must be installed.
Guile 1.2 and 1.3 are supported.
2) 

Source Layout
-------------

CGEN sources are divided into several categories:

- documentation
- code to read .cpu files
- opcode table generator
- gas testsuite generator
- simulator generator
- 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.

4. CPU opcode support files shall be named <arch>.opc and similarly
   placed in the `cpu' sub-directory.

??? May wish to change (1) to <appl>-cgen.scm so that each application's
files will be collected together in `ls' output by the <appl>- prefix.


Documentation
-------------

doc/cgen.texi - top level .texi file, includes the others
doc/rtl.texi - cpu description language (based on GCC's RTL)
doc/intro.texi - global overview of cgen
doc/opcodes.texi - opcode table usage of cgen
doc/porting.texi - porting guide for new ports
doc/sim.texi - simulator usage of cgen
doc/credits.texi - inspiration and contributors

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
read.scm - top level script for .cpu file reading
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
rtl.scm - basic rtl support
rtx-funcs.scm - defines all standard rtx functions
types.scm - type system

opcode table generator
---------------------

cgen-opc.scm - top level script to generate the opcode table + support
opcodes.scm - opcode table generator
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>.

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]
sort.scm - sort routine, from slib
utils-cgen.scm - various utilities specific to cgen
utils.scm - generic Scheme utilities [non cgen specific]

cpu specific files
------------------

<arch>.cpu - <arch> description file
<arch>.opc - <arch> opcode support

null.cpu - minimal .cpu file for debugging purposes




See more files for this project here

Gdb

GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed.

Project homepage: http://sources.redhat.com/gdb/
Programming language(s): Assembly,C,C++,Expect
License: other

  cpu/
    arm.cpu
    arm.sim
    arm7.cpu
    fr30.cpu
    fr30.opc
    i960.cpu
    i960.opc
    ia32.cpu
    ia64.cpu
    ip2k.cpu
    ip2k.opc
    iq10.cpu
    iq2000.cpu
    iq2000.opc
    iq2000m.cpu
    m32r.cpu
    m32r.opc
    m68k.cpu
    openrisc.cpu
    openrisc.opc
    play.cpu
    powerpc.cpu
    sh-sid.cpu
    sh-sim.cpu
    sh.cpu
    sh.opc
    sh64-compact.cpu
    sh64-media.cpu
    simplify.inc
    sparc.cpu
    sparc.opc
    sparc32.cpu
    sparc64.cpu
    sparccom.cpu
    sparcfpu.cpu
    thumb.cpu
    xc16x.cpu
    xc16x.opc
    xstormy16.cpu
    xstormy16.opc
  doc/
    Makefile.am
    Makefile.in
    app.texi
    cgen.texi
    credits.texi
    glossary.texi
    internals.texi
    intro.texi
    notes.texi
    opcodes.texi
    pmacros.texi
    porting.texi
    rtl.texi
    running.texi
    sim.texi
    stamp-vti
    version.texi
  slib/
    genwrite.scm
    logical.scm
    pp.scm
    random.scm
    sort.scm
  AUTHORS
  COPYING.CGEN
  ChangeLog
  INSTALL
  Makefile.am
  Makefile.in
  NEWS
  README
  aclocal.m4
  attr.scm
  cgen-doc.scm
  cgen-gas.scm
  cgen-opc.scm
  cgen-sid.scm
  cgen-sim.scm
  cgen-stest.scm
  configure
  configure.in
  cos-pprint.scm
  cos.scm
  decode.scm
  desc-cpu.scm
  desc.scm
  dev.scm
  enum.scm
  gas-test.scm
  gen-all-doc
  gen-all-opcodes
  gen-all-sid
  gen-all-sim
  guile.scm
  hardware.scm
  html.scm
  ifield.scm
  iformat.scm
  insn.scm
  mach.scm
  minsn.scm
  mode.scm
  model.scm
  opc-asmdis.scm
  opc-ibld.scm
  opc-itab.scm
  opc-opinst.scm
  opcodes.scm
  operand.scm
  pgmr-tools.scm
  pmacros.scm
  pprint.scm
  profile.scm
  read.scm
  rtl-c.scm
  rtl-traverse.scm
  rtl.scm
  rtx-funcs.scm
  sem-frags.scm
  semantics.scm
  sid-cpu.scm
  sid-decode.scm
  sid-model.scm
  sid.scm
  sim-arch.scm
  sim-cpu.scm
  sim-decode.scm
  sim-model.scm
  sim-test.scm
  sim.scm
  stamp-h.in
  types.scm
  utils-cgen.scm
  utils-gen.scm
  utils-sim.scm
  utils.scm