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

sst/elements/genericProc/ssBackEnd/ssb_rs_link.h

00001 // Copyright 2009-2010 Sandia Corporation. Under the terms
00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
00003 // Government retains certain rights in this software.
00004 // 
00005 // Copyright (c) 2009-2010, Sandia Corporation
00006 // All rights reserved.
00007 // 
00008 // This file is part of the SST software package. For license
00009 // information, see the LICENSE file in the top level directory of the
00010 // distribution.
00011 
00012 #ifndef SSB_RS_LINK_H
00013 #define SSB_RS_LINK_H
00014 
00015 /*
00016  * RS_LINK defs and decls
00017  */
00018 
00019 #include "ssb_host.h"
00020 #include "ssb_machine.h"
00021 #include "ssb_ruu.h"
00022 
00023 //: A reservation station link
00024 //
00025 // a reservation station link: this structure links elements of a RUU
00026 // reservation station list; used for ready instruction queue, event
00027 // queue, and output dependency lists; each RS_LINK node contains a
00028 // pointer to the RUU entry it references along with an instance tag,
00029 // the RS_LINK is only valid if the instruction instance tag matches
00030 // the instruction RUU entry instance tag; this strategy allows
00031 // entries in the RUU can be squashed and reused without updating the
00032 // lists that point to it, which significantly improves the
00033 // performance of (all to frequent) squash events
00034 //
00035 //!SEC:ssBack
00036 struct RS_link {
00037   RS_link *next;                        /* next entry in list */
00038   struct RUU_station *rs;               /* referenced RUU resv station */
00039   INST_TAG_TYPE tag;                    /* inst instance sequence number */
00040   union {
00041     tick_t when;                        /* time stamp of entry (for eventq) */
00042     INST_SEQ_TYPE seq;                  /* inst sequence */
00043     int opnum;                          /* input/output operand number */
00044   } x;
00045 };
00046 
00047 class RS_link_list {
00048   RS_link* head;
00049 public:
00050   RS_link_list(int nlinks);
00051   RS_link *RSLINK_NEW( struct RUU_station *rs )
00052   { struct RS_link *n_link;
00053     if (!head) panic("out of rs links");
00054     n_link = head;
00055     head = head->next;
00056     n_link->next = NULL;
00057     n_link->rs = rs; 
00058     n_link->tag = n_link->rs->tag;
00059     return n_link;
00060   };
00061   void RSLINK_FREE( RS_link *link) 
00062   {  RS_link *f_link = link;
00063      f_link->rs = NULL;
00064      f_link->tag = 0;
00065      f_link->next = head;
00066      head = f_link;
00067   };
00068   void RSLINK_FREE_LIST( RS_link *link)
00069   {  RS_link *fl_link, *fl_link_next;
00070      for (fl_link=link; fl_link; fl_link=fl_link_next)
00071        {
00072          fl_link_next = fl_link->next;
00073          RSLINK_FREE(fl_link);
00074        }
00075   };
00076   RS_link RSLINK_NULL;
00077 };
00078 
00079 /* create and initialize an RS link */
00080 #define RSLINK_INIT(RSL, RS)                                            \
00081   ((RSL).next = NULL, (RSL).rs = (RS), (RSL).tag = (RS)->tag)
00082 
00083 #if 0
00084 /* non-zero if RS link is NULL */
00085 #define RSLINK_IS_NULL(LINK)            ((LINK)->rs == NULL)
00086 #endif
00087 
00088 /* non-zero if RS link is to a valid (non-squashed) entry */
00089 #define RSLINK_VALID(LINK)              ((LINK)->tag == (LINK)->rs->tag)
00090 
00091 /* extra RUU reservation station pointer */
00092 #define RSLINK_RS(LINK)                 ((LINK)->rs)
00093 
00094 #if 0
00095 /* get a new RS link record */
00096 #define RSLINK_NEW(DST, RS)                                             \
00097   { struct RS_link *n_link;                                             \
00098     if (!RS_link::rslink_free_list)                                     \
00099       panic("out of rs links");                                         \
00100     n_link = RS_link::rslink_free_list;                                 \
00101     RS_link::rslink_free_list = RS_link::rslink_free_list->next;        \
00102     n_link->next = NULL;                                                \
00103     n_link->rs = (RS); n_link->tag = n_link->rs->tag;                   \
00104     (DST) = n_link;                                                     \
00105   }
00106 
00107 /* free an RS link record */
00108 #define RSLINK_FREE(LINK)                                               \
00109   {  RS_link *f_link = (LINK);                                  \
00110      f_link->rs = NULL; f_link->tag = 0;                                \
00111      f_link->next = RS_link::rslink_free_list;                          \
00112      RS_link::rslink_free_list = f_link;                                \
00113   }
00114 
00115 /* FIXME: could this be faster!!! */
00116 /* free an RS link list */
00117 #define RSLINK_FREE_LIST(LINK)                                          \
00118   {  RS_link *fl_link, *fl_link_next;                           \
00119      for (fl_link=(LINK); fl_link; fl_link=fl_link_next)                \
00120        {                                                                \
00121          fl_link_next = fl_link->next;                                  \
00122          RSLINK_FREE(fl_link);                                          \
00123        }                                                                \
00124   }
00125 #endif
00126 
00127 
00128 #endif

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