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 2003/09/18 00:57:54 panalyzer Exp $ 00053 * 00054 * $Log: regs.h,v $ 00055 * Revision 1.1.1.1 2003/09/18 00:57:54 panalyzer 00056 * 00057 * 00058 * Revision 1.1.1.1 2003/09/18 00:18:44 panalyzer 00059 * 00060 * 00061 * Revision 1.1.1.1 2003/09/16 18:48:14 gdm 00062 * 00063 * 00064 * Revision 1.1.1.1 2000/11/29 14:53:54 cu-cs 00065 * Grand unification of arm sources. 00066 * 00067 * 00068 * Revision 1.1.1.1 2000/05/26 15:18:58 taustin 00069 * SimpleScalar Tool Set 00070 * 00071 * 00072 * Revision 1.5 1998/08/27 15:53:42 taustin 00073 * implemented host interface description in host.h 00074 * added target interface support 00075 * added support for register and memory contexts 00076 * 00077 * Revision 1.4 1997/03/11 01:19:41 taustin 00078 * updated copyright 00079 * long/int tweaks made for ALPHA target support 00080 * 00081 * Revision 1.3 1997/01/06 16:02:48 taustin 00082 * \comments updated 00083 * 00084 * Revision 1.1 1996/12/05 18:50:23 taustin 00085 * Initial revision 00086 * 00087 * 00088 */ 00089 00090 #ifndef REGS_H 00091 #define REGS_H 00092 00093 #include "host.h" 00094 #include "misc.h" 00095 #include "machine.h" 00096 00097 /* 00098 * This module implements the SimpleScalar architected register state, which 00099 * includes integer and floating point registers and miscellaneous registers. 00100 * The architected register state is as follows: 00101 * 00102 * Integer Register File: Miscellaneous Registers: 00103 * (aka general-purpose registers, GPR's) 00104 * 00105 * +------------------+ +------------------+ 00106 * | $r0 (src/sink 0) | | PC | Program Counter 00107 * +------------------+ +------------------+ 00108 * | $r1 | | HI | Mult/Div HI val 00109 * +------------------+ +------------------+ 00110 * | . | | LO | Mult/Div LO val 00111 * | . | +------------------+ 00112 * | . | 00113 * +------------------+ 00114 * | $r31 | 00115 * +------------------+ 00116 * 00117 * Floating point Register File: 00118 * single-precision: double-precision: 00119 * +------------------+------------------+ +------------------+ 00120 * | $f0 | $f1 (for double) | | FCC | FP codes 00121 * +------------------+------------------+ +------------------+ 00122 * | $f1 | 00123 * +------------------+ 00124 * | . | 00125 * | . | 00126 * | . | 00127 * +------------------+------------------+ 00128 * | $f30 | $f31 (for double)| 00129 * +------------------+------------------+ 00130 * | $f31 | 00131 * +------------------+ 00132 * 00133 * The floating point register file can be viewed as either 32 single-precision 00134 * (32-bit IEEE format) floating point values $f0 to $f31, or as 16 00135 * double-precision (64-bit IEEE format) floating point values $f0 to $f30. 00136 */ 00137 00138 struct regs_t { 00139 md_gpr_t regs_R; /* (signed) integer register file */ 00140 md_fpr_t regs_F; /* floating point register file */ 00141 md_ctrl_t regs_C; /* control register file */ 00142 md_addr_t regs_PC; /* program counter */ 00143 md_addr_t regs_NPC; /* next-cycle program counter */ 00144 }; 00145 00146 /* create a register file */ 00147 struct regs_t *regs_create(void); 00148 00149 /* initialize architected register state */ 00150 void 00151 regs_init(struct regs_t *regs); /* register file to initialize */ 00152 00153 /* dump all architected register state values to output stream STREAM */ 00154 void 00155 regs_dump(struct regs_t *regs, /* register file to display */ 00156 FILE *stream); /* output stream */ 00157 00158 /* destroy a register file */ 00159 void 00160 regs_destroy(struct regs_t *regs); /* register file to release */ 00161 00162 #endif /* REGS_H */