00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef cggrp_ptn_INCLUDED
00031 #define cggrp_ptn_INCLUDED
00032
00033 #include "defs.h"
00034 #include "errors.h"
00035 #include "targ_issue_port.h"
00036 #include "targ_isa_bundle.h"
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 struct PATTERN_TYPE{
00064 mBOOL start_in_bundle;
00065
00066 mBOOL end_in_bundle;
00067
00068 mINT16 bundle[ISA_MAX_ISSUE_BUNDLES];
00069
00070 const mINT16 operator[](INT i) const
00071 {
00072 Is_True((i<ISA_MAX_ISSUE_BUNDLES),
00073 ("Exceed max slot in accessing a pattern."));
00074 return bundle[i];
00075 }
00076 void Dump(FILE *f = stderr)
00077 {
00078 fprintf(f,"%d %d ", start_in_bundle, end_in_bundle);
00079 for( INT i=0; i<ISA_MAX_ISSUE_BUNDLES; i++)
00080 {
00081 fprintf(f, "%s ", ISA_EXEC_Name(bundle[i]));
00082 }
00083 fprintf(f, "\n");
00084 }
00085 };
00086
00087 struct PTN_TABLE_LINE{
00088 INT size;
00089 PATTERN_TYPE *ptns;
00090
00091 PATTERN_TYPE& operator[](INT i) const
00092 {
00093 Is_True((i<size), ("Invalid access of PTN table."));
00094 return ptns[i];
00095 }
00096
00097 void Dump(FILE *f = stderr) ;
00098
00099 #ifdef Is_True_On
00100 void gdb_dump (void);
00101 #endif
00102 };
00103
00104 enum PTN_LINE_KIND {invalid_PTN_TABLE_entry = -1 };
00105
00106 struct PTN_TABLE_TYPE{
00107 INT *map;
00108 PTN_TABLE_LINE *body;
00109
00110
00111 const BOOL Is_Valid(INT i) const
00112 {
00113 return (map[i]!=invalid_PTN_TABLE_entry);
00114 }
00115
00116 const PTN_TABLE_LINE& operator[](INT i) const
00117 {
00118 Is_True(Is_Valid(i), ("Access non-existing pattern %d.", i) );
00119 return body[map[i]];
00120 }
00121 };
00122
00123 extern const PTN_TABLE_TYPE PTN_table;
00124
00126
00127
00128
00129
00130
00131
00133 struct DISPERSAL_TARG{
00134 PORT_SET port[ISA_MAX_SLOTS*ISA_MAX_ISSUE_BUNDLES];
00135 PORT_SET operator[](INT i) const { return port[i]; }
00136 PORT_SET Ports( INT bundle, INT slot) const
00137 { return (*this)[bundle*ISA_MAX_SLOTS+slot]; }
00138 ISSUE_PORT Port( INT bundle, INT slot) const
00139 { return ((*this)[bundle*ISA_MAX_SLOTS+slot]).First_IP(); }
00140 };
00141
00142 struct DISPERSAL_TARG_TABLE{
00143 UINT size;
00144 DISPERSAL_TARG *body;
00145
00146 const DISPERSAL_TARG *Query(const PATTERN_TYPE * ptn) const
00147 {
00148 UINT index = (*ptn)[ISA_MAX_ISSUE_BUNDLES-1] % ISA_MAX_BUNDLES;
00149 for (INT i=ISA_MAX_ISSUE_BUNDLES-2; i>=0; i--){
00150 index *= ISA_MAX_BUNDLES;
00151 index += (*ptn)[i] % ISA_MAX_BUNDLES;
00152 }
00153 Is_True( index < size, ("Invalid pattern in query dispersal table!"));
00154 return &(body[index]);
00155 }
00156 };
00157
00158 extern const DISPERSAL_TARG_TABLE dispersal_table;
00159
00160 #endif // cggrp_ptn_INCLUDED
00161
00162