Go to the documentation of this file.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
00031
00032
00033
00034
00035
00036
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
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331 #ifndef SI_INCLUDED
00332 #define SI_INCLUDED
00333
00334 #ifdef __cplusplus
00335 extern "C" {
00336 #endif
00337
00338 #ifndef SI_RCS_ID
00339 #define SI_RCS_ID
00340 #ifdef _KEEP_RCS_ID
00341 #endif
00342 #endif
00343
00344 #include <topcode.h>
00345
00346 typedef enum topcode TOPCODE;
00347
00348
00349
00350
00351 typedef struct {
00352 mUINT64 dw[2];
00353 } SI_BAD_II_SET;
00354
00355 enum { SI_BAD_II_SET_MAX=127 };
00356
00357 inline SI_BAD_II_SET SI_BAD_II_SET_Union( SI_BAD_II_SET s1, SI_BAD_II_SET s2 )
00358 {
00359 SI_BAD_II_SET the_union;
00360
00361 the_union.dw[0] = s1.dw[0] | s2.dw[0];
00362 the_union.dw[1] = s1.dw[1] | s2.dw[1];
00363
00364 return the_union;
00365 }
00366
00367 inline INT SI_BAD_II_SET_MemberP( SI_BAD_II_SET s, UINT i )
00368 {
00369 UINT bitnum = i - 1;
00370
00371 if ( bitnum > (UINT)SI_BAD_II_SET_MAX ) return 0;
00372
00373 return (s.dw[bitnum / 64] & (1ULL << (bitnum % 64))) != 0;
00374 }
00375
00376 inline SI_BAD_II_SET SI_BAD_II_SET_Empty( void )
00377 {
00378 const SI_BAD_II_SET empty_set = {{0,0}};
00379
00380 return empty_set;
00381 }
00382
00383
00384
00385
00386 typedef UINT SI_RESOURCE_ID;
00387
00388 typedef const struct {
00389 const char* name;
00390 SI_RESOURCE_ID id;
00391 mUINT8 avail_per_cycle;
00392 mUINT8 word_index;
00393 mUINT8 bit_index;
00394 } SI_RESOURCE;
00395
00396
00397 inline const char* SI_RESOURCE_Name( SI_RESOURCE* res )
00398 {
00399 return res->name;
00400 }
00401
00402 inline UINT SI_RESOURCE_Id( SI_RESOURCE* res )
00403 {
00404 return res->id;
00405 }
00406
00407 inline UINT SI_RESOURCE_Avail_Per_Cycle( SI_RESOURCE* res )
00408 {
00409 return res->avail_per_cycle;
00410 }
00411
00412 inline UINT SI_RESOURCE_Word_Index( SI_RESOURCE* res )
00413 {
00414 return res->word_index;
00415 }
00416
00417 inline UINT SI_RESOURCE_Bit_Index( SI_RESOURCE* res )
00418 {
00419 return res->bit_index;
00420 }
00421
00422 extern const INT SI_resource_count;
00423 #ifndef __CYGWIN__
00424 #pragma weak SI_resource_count
00425 #endif
00426 extern SI_RESOURCE* const SI_resources[];
00427 #ifndef __CYGWIN__
00428 #pragma weak SI_resources
00429 #endif
00430 inline const char* SI_RESOURCE_ID_Name( SI_RESOURCE_ID id )
00431 {
00432 return SI_RESOURCE_Name(SI_resources[id]);
00433 }
00434
00435 inline UINT SI_RESOURCE_ID_Avail_Per_Cycle( SI_RESOURCE_ID id )
00436 {
00437 return SI_RESOURCE_Avail_Per_Cycle(SI_resources[id]);
00438 }
00439
00440
00441
00442
00443 typedef mUINT64 SI_RESOURCE_ID_SET;
00444
00445 inline SI_RESOURCE_ID_SET SI_RESOURCE_ID_SET_Universe(void)
00446 {
00447 return (SI_RESOURCE_ID_SET)-1
00448 >> (sizeof(SI_RESOURCE_ID_SET) * 8 - SI_resource_count);
00449 }
00450
00451 inline SI_RESOURCE_ID_SET SI_RESOURCE_ID_SET_Empty(void)
00452 {
00453 return (SI_RESOURCE_ID_SET)0;
00454 }
00455
00456 inline SI_RESOURCE_ID_SET
00457 SI_RESOURCE_ID_SET_Intersection( SI_RESOURCE_ID_SET s0,
00458 SI_RESOURCE_ID_SET s1 )
00459 {
00460 return s0 & s1;
00461 }
00462
00463 inline INT
00464 SI_RESOURCE_ID_SET_Intersection_Non_Empty( SI_RESOURCE_ID_SET s0,
00465 SI_RESOURCE_ID_SET s1 )
00466 {
00467 return (s0 & s1) != (SI_RESOURCE_ID_SET)0;
00468 }
00469
00470 inline INT
00471 SI_RESOURCE_ID_SET_Intersection4_Non_Empty( SI_RESOURCE_ID_SET s0,
00472 SI_RESOURCE_ID_SET s1,
00473 SI_RESOURCE_ID_SET s2,
00474 SI_RESOURCE_ID_SET s3 )
00475 {
00476 return (s0 & s1 & s2 & s3) != (SI_RESOURCE_ID_SET)0;
00477 }
00478
00479 inline SI_RESOURCE_ID_SET
00480 SI_RESOURCE_ID_SET_Complement( SI_RESOURCE_ID_SET s )
00481 {
00482 return (~s) & SI_RESOURCE_ID_SET_Universe();
00483 }
00484
00485
00486
00487
00488
00489 typedef mUINT64 SI_RRW;
00490
00491 extern const SI_RRW SI_RRW_initializer;
00492 #ifndef __CYGWIN__
00493 #pragma weak SI_RRW_initializer
00494 #endif
00495
00496 extern const SI_RRW SI_RRW_overuse_mask;
00497 #ifndef __CYGWIN__
00498 #pragma weak SI_RRW_overuse_mask
00499 #endif
00500
00501 inline SI_RRW SI_RRW_Initial(void)
00502 {
00503 return SI_RRW_initializer;
00504 }
00505
00506 inline SI_RRW SI_RRW_Reserve( SI_RRW table, SI_RRW requirement )
00507 {
00508 return table + requirement;
00509 }
00510
00511 inline SI_RRW SI_RRW_Has_Overuse( SI_RRW word_with_reservations )
00512 {
00513 return (word_with_reservations & SI_RRW_overuse_mask) != 0;
00514 }
00515
00516 inline SI_RRW SI_RRW_Unreserve( SI_RRW table, SI_RRW requirement )
00517 {
00518 return table - requirement;
00519 }
00520
00521
00522
00523
00524 typedef const struct {
00525 const char* name;
00526 mINT32 skew;
00527 mINT32 avail_per_cycle;
00528 } SI_ISSUE_SLOT;
00529
00530 inline const char* SI_ISSUE_SLOT_Name( SI_ISSUE_SLOT* slot )
00531 {
00532 return slot->name;
00533 }
00534
00535 inline INT SI_ISSUE_SLOT_Skew( SI_ISSUE_SLOT* slot )
00536 {
00537 return slot->skew;
00538 }
00539
00540 inline INT SI_ISSUE_SLOT_Avail_Per_Cycle( SI_ISSUE_SLOT* slot )
00541 {
00542 return slot->avail_per_cycle;
00543 }
00544
00545 extern const INT SI_issue_slot_count;
00546 #ifndef __CYGWIN__
00547 #pragma weak SI_issue_slot_count
00548 #endif
00549
00550 extern SI_ISSUE_SLOT* const SI_issue_slots[];
00551 #ifndef __CYGWIN__
00552 #pragma weak SI_issue_slots
00553 #endif
00554
00555 inline INT SI_ISSUE_SLOT_Count(void)
00556 {
00557 return SI_issue_slot_count;
00558 }
00559
00560 inline SI_ISSUE_SLOT* SI_Ith_Issue_Slot( UINT i )
00561 {
00562 return SI_issue_slots[i];
00563 }
00564
00565
00566
00567
00568 typedef const struct {
00569 SI_RESOURCE* resource;
00570 mINT32 total_used;
00571 } SI_RESOURCE_TOTAL;
00572
00573 inline SI_RESOURCE*
00574 SI_RESOURCE_TOTAL_Resource( SI_RESOURCE_TOTAL* pair )
00575 {
00576 return pair->resource;
00577 }
00578
00579 inline SI_RESOURCE_ID SI_RESOURCE_TOTAL_Resource_Id( SI_RESOURCE_TOTAL* pair )
00580 {
00581 return SI_RESOURCE_Id(SI_RESOURCE_TOTAL_Resource(pair));
00582 }
00583
00584 inline UINT SI_RESOURCE_TOTAL_Avail_Per_Cycle(SI_RESOURCE_TOTAL* pair)
00585 {
00586 return SI_RESOURCE_Avail_Per_Cycle(SI_RESOURCE_TOTAL_Resource(pair));
00587 }
00588
00589 inline INT SI_RESOURCE_TOTAL_Total_Used( SI_RESOURCE_TOTAL* pair )
00590 {
00591 return pair->total_used;
00592 }
00593
00594
00595
00596
00597 typedef const SI_RRW* SI_RR;
00598
00599 inline UINT SI_RR_Length( SI_RR req )
00600 {
00601 return (INT) req[0];
00602 }
00603
00604 inline SI_RRW SI_RR_Cycle_RRW( SI_RR req, UINT cycle )
00605 {
00606
00607
00608
00609 return req[cycle+1];
00610 }
00611
00612
00613
00614 typedef UINT SI_ID;
00615
00616 typedef const struct {
00617 const char* name;
00618 SI_ID id;
00619 const mUINT8 *operand_access_times;
00620 const mUINT8 *result_available_times;
00621 mINT32 load_access_time;
00622 mINT32 last_issue_cycle;
00623 mINT32 store_available_time;
00624 SI_RR rr;
00625 const SI_RESOURCE_ID_SET *resources_used;
00626 mUINT32 ii_info_size;
00627 const SI_RR *ii_rr;
00628 const SI_RESOURCE_ID_SET * const *ii_resources_used;
00629 SI_BAD_II_SET bad_iis;
00630 mINT32 valid_issue_slot_count;
00631 SI_ISSUE_SLOT * const *valid_issue_slots;
00632 mINT32 resource_total_vector_size;
00633 SI_RESOURCE_TOTAL *resource_total_vector;
00634 mUINT8 write_write_interlock;
00635 } SI;
00636
00637 extern SI* const SI_top_si[];
00638 #ifndef __CYGWIN__
00639 #pragma weak SI_top_si
00640 #endif
00641
00642 inline const char* TSI_Name( TOP top )
00643 {
00644 return SI_top_si[(INT) top]->name;
00645 }
00646
00647 inline SI_ID TSI_Id( TOP top )
00648 {
00649 return SI_top_si[top]->id;
00650 }
00651
00652 inline INT
00653 TSI_Operand_Access_Time( TOP top, INT operand_index )
00654 {
00655 return SI_top_si[(INT) top]->operand_access_times[operand_index];
00656 }
00657
00658 inline INT
00659 TSI_Result_Available_Time( TOP top, INT result_index )
00660 {
00661 return SI_top_si[(INT) top]->result_available_times[result_index];
00662 }
00663
00664 inline INT
00665 TSI_Load_Access_Time( TOP top )
00666 {
00667 return SI_top_si[(INT) top]->load_access_time;
00668 }
00669
00670 inline INT
00671 TSI_Last_Issue_Cycle( TOP top )
00672 {
00673 return SI_top_si[(INT) top]->last_issue_cycle;
00674 }
00675
00676 inline INT
00677 TSI_Store_Available_Time( TOP top )
00678 {
00679 return SI_top_si[(INT) top]->store_available_time;
00680 }
00681
00682 inline SI_RR TSI_Resource_Requirement( TOP top )
00683 {
00684 return SI_top_si[(INT) top]->rr;
00685 }
00686
00687 inline SI_BAD_II_SET TSI_Bad_IIs( TOP top )
00688 {
00689 return SI_top_si[(INT) top]->bad_iis;
00690 }
00691
00692 inline SI_RR TSI_II_Resource_Requirement( TOP top, INT ii )
00693 {
00694 SI* const info = SI_top_si[(INT) top];
00695
00696 if ( ii > info->ii_info_size ) return info->rr;
00697
00698 return info->ii_rr[ii - 1];
00699 }
00700
00701 inline const SI_RESOURCE_ID_SET*
00702 TSI_II_Cycle_Resource_Ids_Used( TOP opcode, INT ii )
00703 {
00704 SI* const info = SI_top_si[(INT)opcode];
00705 if ( ii > info->ii_info_size ) return info->resources_used;
00706
00707 return info->ii_resources_used[ii - 1];
00708 }
00709
00710 inline UINT TSI_Valid_Issue_Slot_Count( TOP top )
00711 {
00712 return SI_top_si[(INT) top]->valid_issue_slot_count;
00713 }
00714
00715 inline SI_ISSUE_SLOT* TSI_Valid_Issue_Slots( TOP top, UINT i )
00716 {
00717 return SI_top_si[(INT) top]->valid_issue_slots[i];
00718 }
00719
00720 inline UINT TSI_Resource_Total_Vector_Size( TOP top )
00721 {
00722 return SI_top_si[(INT) top]->resource_total_vector_size;
00723 }
00724
00725 inline SI_RESOURCE_TOTAL* TSI_Resource_Total_Vector( TOP top )
00726 {
00727 return SI_top_si[(INT) top]->resource_total_vector;
00728 }
00729
00730 inline INT TSI_Write_Write_Interlock( TOP top )
00731 {
00732 return SI_top_si[(INT) top]->write_write_interlock;
00733 }
00734
00735
00736
00737
00738 extern const INT SI_ID_count;
00739 #ifndef __CYGWIN__
00740 #pragma weak SI_ID_count
00741 #endif
00742
00743 inline INT SI_ID_Count(void)
00744 {
00745 return SI_ID_count;
00746 }
00747
00748 extern SI* const SI_ID_si[];
00749 #ifndef __CYGWIN__
00750 #pragma weak SI_ID_si
00751 #endif
00752
00753 inline const SI_RESOURCE_ID_SET*
00754 SI_ID_II_Cycle_Resource_Ids_Used( SI_ID id, INT ii )
00755 {
00756 SI* const info = SI_ID_si[id];
00757 if ( ii > info->ii_info_size ) return info->resources_used;
00758
00759 return info->ii_resources_used[ii - 1];
00760 }
00761
00762
00763 #ifdef __cplusplus
00764 }
00765 #endif
00766 #endif