"I am a person who works hard and plays hard."

Yuan Wei
Second Year Graduate Student Department of Computer Science
University of Virginia Charlottesville, VA 22903
Email: yw3f@cs.virginia.edu


Source Code Analysis

Main Page   Compound List   File List   Compound Members   File Members  

regs.h

Go to the documentation of this file.
00001 /*
00002  * regs.h - architected register state interfaces
00003  *
00004  * This file is a part of the SimpleScalar tool suite written by
00005  * Todd M. Austin as a part of the Multiscalar Research Project.
00006  *  
00007  * The tool suite is currently maintained by Doug Burger and Todd M. Austin.
00008  * 
00009  * Copyright (C) 1994, 1995, 1996, 1997, 1998 by Todd M. Austin
00010  *
00011  * This source file is distributed "as is" in the hope that it will be
00012  * useful.  The tool set comes with no warranty, and no author or
00013  * distributor accepts any responsibility for the consequences of its
00014  * use. 
00015  * 
00016  * Everyone is granted permission to copy, modify and redistribute
00017  * this tool set under the following conditions:
00018  * 
00019  *    This source code is distributed for non-commercial use only. 
00020  *    Please contact the maintainer for restrictions applying to 
00021  *    commercial use.
00022  *
00023  *    Permission is granted to anyone to make or distribute copies
00024  *    of this source code, either as received or modified, in any
00025  *    medium, provided that all copyright notices, permission and
00026  *    nonwarranty notices are preserved, and that the distributor
00027  *    grants the recipient permission for further redistribution as
00028  *    permitted by this document.
00029  *
00030  *    Permission is granted to distribute this file in compiled
00031  *    or executable form under the same conditions that apply for
00032  *    source code, provided that either:
00033  *
00034  *    A. it is accompanied by the corresponding machine-readable
00035  *       source code,
00036  *    B. it is accompanied by a written offer, with no time limit,
00037  *       to give anyone a machine-readable copy of the corresponding
00038  *       source code in return for reimbursement of the cost of
00039  *       distribution.  This written offer must permit verbatim
00040  *       duplication by anyone, or
00041  *    C. it is distributed by someone who received only the
00042  *       executable form, and is accompanied by a copy of the
00043  *       written offer of source code that they received concurrently.
00044  *
00045  * In other words, you are welcome to use, share and improve this
00046  * source file.  You are forbidden to forbid anyone else to use, share
00047  * and improve what you give them.
00048  *
00049  * INTERNET: dburger@cs.wisc.edu
00050  * US Mail:  1210 W. Dayton Street, Madison, WI 53706
00051  *
00052  * $Id: regs.h,v 1.1.1.1 2000/05/26 15:18:58 taustin Exp $
00053  *
00054  * $Log: regs.h,v $
00055  * Revision 1.1.1.1  2000/05/26 15:18:58  taustin
00056  * SimpleScalar Tool Set
00057  *
00058  *
00059  * Revision 1.5  1998/08/27 15:53:42  taustin
00060  * implemented host interface description in host.h
00061  * added target interface support
00062  * added support for register and memory contexts
00063  *
00064  * Revision 1.4  1997/03/11  01:19:41  taustin
00065  * updated copyright
00066  * long/int tweaks made for ALPHA target support
00067  *
00068  * Revision 1.3  1997/01/06  16:02:48  taustin
00069  * \comments updated
00070  *
00071  * Revision 1.1  1996/12/05  18:50:23  taustin
00072  * Initial revision
00073  *
00074  *
00075  */
00076 
00077 #ifndef REGS_H
00078 #define REGS_H
00079 
00080 #include "host.h"
00081 #include "misc.h"
00082 #include "machine.h"
00083 
00084 /*
00085  * This module implements the SimpleScalar architected register state, which
00086  * includes integer and floating point registers and miscellaneous registers.
00087  * The architected register state is as follows:
00088  *
00089  * Integer Register File:                  Miscellaneous Registers:
00090  * (aka general-purpose registers, GPR's)
00091  *
00092  *   +------------------+                  +------------------+
00093  *   | $r0 (src/sink 0) |                  | PC               | Program Counter
00094  *   +------------------+                  +------------------+
00095  *   | $r1              |                  | HI               | Mult/Div HI val
00096  *   +------------------+                  +------------------+
00097  *   |  .               |                  | LO               | Mult/Div LO val
00098  *   |  .               |                  +------------------+
00099  *   |  .               |
00100  *   +------------------+
00101  *   | $r31             |
00102  *   +------------------+
00103  *
00104  * Floating point Register File:
00105  *    single-precision:  double-precision:
00106  *   +------------------+------------------+  +------------------+
00107  *   | $f0              | $f1 (for double) |  | FCC              | FP codes
00108  *   +------------------+------------------+  +------------------+
00109  *   | $f1              |
00110  *   +------------------+
00111  *   |  .               |
00112  *   |  .               |
00113  *   |  .               |
00114  *   +------------------+------------------+
00115  *   | $f30             | $f31 (for double)|
00116  *   +------------------+------------------+
00117  *   | $f31             |
00118  *   +------------------+
00119  *
00120  * The floating point register file can be viewed as either 32 single-precision
00121  * (32-bit IEEE format) floating point values $f0 to $f31, or as 16
00122  * double-precision (64-bit IEEE format) floating point values $f0 to $f30.
00123  */
00124 
00125 struct regs_t {
00126   md_gpr_t regs_R;              /* (signed) integer register file */
00127   md_fpr_t regs_F;              /* floating point register file */
00128   md_ctrl_t regs_C;             /* control register file */
00129   md_addr_t regs_PC;            /* program counter */
00130   md_addr_t regs_NPC;           /* next-cycle program counter */
00131 };
00132 
00133 /* create a register file */
00134 struct regs_t *regs_create(void);
00135 
00136 /* initialize architected register state */
00137 void
00138 regs_init(struct regs_t *regs);         /* register file to initialize */
00139 
00140 /* dump all architected register state values to output stream STREAM */
00141 void
00142 regs_dump(struct regs_t *regs,          /* register file to display */
00143           FILE *stream);                /* output stream */
00144 
00145 /* destroy a register file */
00146 void
00147 regs_destroy(struct regs_t *regs);      /* register file to release */
00148 
00149 #endif /* REGS_H */


UVa CS Department of Computer Science
School of Engineering, University of Virginia
151 Engineer's Way, P.O. Box 400740
Charlottesville, Virginia 22904-4740

(434) 982-2200  Fax: (434) 982-2214