• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/elements/genericProc/ssBackEnd/ssb_resource.h

00001 /*
00002  * resource.h - resource manager 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: ssb_resource.h,v 1.2 2007-01-24 21:34:03 afrodri Exp $
00053  *
00054  * $Log: not supported by cvs2svn $
00055  * Revision 1.1.1.1  2006/01/31 16:35:50  afrodri
00056  * first entry
00057  *
00058  * Revision 1.4  2005/08/16 21:12:55  arodrig6
00059  * changes for docs
00060  *
00061  * Revision 1.3  2004/11/16 04:17:46  arodrig6
00062  * added more documentation
00063  *
00064  * Revision 1.2  2004/08/10 22:55:35  arodrig6
00065  * works, except for the speculative stuff, caches, and multiple procs
00066  *
00067  * Revision 1.1  2004/08/05 23:51:45  arodrig6
00068  * grabed files from SS and broke up some of them
00069  *
00070  * Revision 1.2  2000/03/23 02:41:36  karu
00071  * Merged differences with ramdass's machine.def and differences
00072  * made to make sim-outorder work.
00073  *
00074  * Revision 1.1.1.1  2000/03/07 05:15:18  karu
00075  * this is the repository created for my own maintanence.
00076  * created when spec95 (lisp and compress worked).
00077  * compress still had the scanf("%i") problem
00078  * DIFF from the repository I am using alongwith ramdass on /projects
00079  * need to merge the two sometime :-)
00080  *
00081  * Revision 1.1.1.1  2000/02/25 21:02:52  karu
00082  * creating cvs repository for ss3-ppc
00083  *
00084  * Revision 1.4  1998/08/27 15:54:19  taustin
00085  * implemented host interface description in host.h
00086  * added target interface support
00087  *
00088  * Revision 1.3  1997/03/11  01:26:49  taustin
00089  * updated copyright
00090  *
00091  * Revision 1.1  1996/12/05  18:50:23  taustin
00092  * Initial revision
00093  *
00094  *
00095  */
00096 
00097 #ifndef SSB_RESOURCE_H
00098 #define SSB_RESOURCE_H
00099 
00100 #include <stdio.h>
00101 
00102 /* maximum number of resource classes supported */
00103 #define MAX_RES_CLASSES  2048   
00104 
00105 /* maximum number of resource instances for a class supported */
00106 #define MAX_INSTS_PER_CLASS     8
00107 
00108 //: resource template 
00109 //!SEC:ssBack
00110 struct res_template {
00111   int Rclass;                           /* matching resource class: insts
00112                                            with this resource class will be
00113                                            able to execute on this unit */
00114   int oplat;                            /* operation latency: cycles until
00115                                            result is ready for use */
00116   int issuelat;                 /* issue latency: number of cycles
00117                                    before another operation can be
00118                                    issued on this resource */
00119   struct res_desc *master;              /* master resource record */
00120 };
00121 
00122 //: resource descriptor 
00123 //!SEC:ssBack
00124 struct res_desc {
00125   const char *name;                             /* name of functional unit */
00126   int quantity;                         /* total instances of this unit */
00127   int busy;                             /* non-zero if this unit is busy */
00128   res_template x[MAX_RES_CLASSES];
00129 };
00130 
00131 //: resource pool: one entry per resource instance 
00132 //!SEC:ssBack
00133 struct res_pool {
00134   char *name;                           /* pool name */
00135   int num_resources;                    /* total number of res instances */
00136    res_desc *resources;         /* resource instances */
00137   /* res class -> res template mapping table, lists are NULL terminated */
00138   int nents[MAX_RES_CLASSES];
00139    res_template *table[MAX_RES_CLASSES][MAX_INSTS_PER_CLASS];
00140 };
00141 
00142 /* create a resource pool */
00143  res_pool *res_create_pool(const char *name,  const res_desc *pool, int ndesc);
00144 
00145 //: get resource
00146 //
00147 // get a free resource from resource pool POOL that can execute a
00148 // operation of class CLASS, returns a pointer to the resource
00149 // template, returns NULL, if there are currently no free resources
00150 // available, follow the MASTER link to the master resource
00151 // descriptor; NOTE: caller is responsible for reseting the busy flag
00152 // in the beginning of the cycle when the resource can once again
00153 // accept a new operation
00154  res_template *res_get( res_pool *pool, int Rclass);
00155 
00156 /* dump the resource pool POOL to stream STREAM */
00157 void res_dump( res_pool *pool, FILE *stream);
00158 
00159 #endif /* RESOURCE_H */

Generated on Fri Oct 22 2010 11:02:24 for SST by  doxygen 1.7.1