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 #include <stdio.h>
00028 #include <assert.h>
00029 #include "kapi_internal.h"
00030 #include "kapi_parse.h"
00031 #include "kapi_debug.h"
00032 #include "kapi_util.h"
00033 #include "kapi_error.h"
00034 #include "string.h"
00035
00036 static void KDebug_Dcluster0Cutports( knobs_t *pknobs, FILE *fp, stn_t *pstn, int nTab );
00037 void KDebug_DumpPortInfo( FILE *fp, knobs_t *pknobs, int nTab );
00038
00039 void
00040 kapi_indent_line( FILE *fp, int nTab )
00041 {
00042 int i;
00043
00044 for ( i=0;i<nTab; i++ ) {
00045 fprintf( fp, " " );
00046 }
00047 }
00048
00049 void
00050 KDebug_DumpMachineDescription( FILE *fp, knobs_t *pknobs, int nTab )
00051 {
00052 int iclr;
00053
00054
00055
00056 kapi_indent_line( fp, nTab );
00057 fprintf( fp, "Machine Description\n" );
00058 fprintf( fp, "\n" );
00059
00060 kapi_indent_line( fp, nTab+1 );
00061 fprintf( fp, "Machine issue width (bundles)\n" );
00062 for ( iclr=0; iclr<pknobs->nclr; iclr++ ) {
00063 kapi_indent_line( fp, nTab+2 );
00064 fprintf( fp, "cluster %d = %2d\n", iclr,
00065 KAPI_BundleIssueWidth( pknobs, iclr ) );
00066 }
00067
00068 kapi_indent_line( fp, nTab );
00069 fprintf( fp, "\n\nPort/Issue Information:\n" );
00070 KDebug_DumpPortInfo( fp, pknobs, nTab+1 );
00071 fprintf( fp, "\n" );
00072
00073 KDebug_DumpFUTable( fp, pknobs, nTab+1 );
00074 fprintf( fp, "\n" );
00075
00076 KDebug_DumpITTable( fp, pknobs, nTab+1 );
00077 fprintf( fp, "\n" );
00078
00079 KDebug_DumpS2SLatencyTable( fp, pknobs, nTab+1 );
00080
00081 #if 0
00082 KDebug_DumpInstTable( fp, pknobs, nTab+1 );
00083 fprintf( fp, "\n" );
00084 #endif
00085 }
00086
00087 void
00088 KDebug_DumpPortMaps( FILE *fp, knobs_t *pknobs, int nTab )
00089 {
00090 kapi_port_t port;
00091 kapi_cluster_t cluster;
00092 kapi_cport_t cport;
00093 kapi_ut_t ut;
00094 kapi_cutport_t cutport;
00095
00096 kapi_indent_line( fp, nTab );
00097 fprintf( fp, "Global port information:\n" );
00098 kapi_indent_line( fp, nTab+1 );
00099 fprintf( fp, "%5s: %8s %6s %4s %8s\n", "Port", "Cluster", "Cport", "Ut", "Cutport" );
00100 for ( port=0; port<pknobs->nports; port++ ) {
00101 KAPI_portInfo( pknobs, port, &cluster, &cport, &ut, &cutport );
00102 kapi_indent_line( fp, nTab+1 );
00103 fprintf( fp, "%5d: %8d %6d %4c %8d\n",
00104 port, cluster, cport, kapi_ut2ch( ut ), cutport );
00105 }
00106
00107 kapi_indent_line( fp, nTab );
00108 fprintf( fp, "Cport information:\n" );
00109 kapi_indent_line( fp, nTab+1 );
00110 fprintf( fp, "%8s %4s: %5s %6s %8s\n", "Cluster", "Cport", "Port", "Ut", "Cutport" );
00111 for ( cluster=0; cluster<pknobs->nclr; cluster++ ) {
00112 for ( cport=0; cport<pknobs->mpclrTable[cluster].ncports; cport++ ) {
00113 KAPI_cportInfo( pknobs, cluster, cport, &port, &ut, &cutport );
00114 kapi_indent_line( fp, nTab+1 );
00115 fprintf( fp, "%8d %4d: %5d %6c %8d\n", cluster, cport,
00116 port, kapi_ut2ch( ut ), cutport );
00117 }
00118 }
00119
00120 kapi_indent_line( fp, nTab );
00121 fprintf( fp, "Cutport information:\n" );
00122 kapi_indent_line( fp, nTab+1 );
00123 fprintf( fp, "%8s %4s %4s: %5s %6s\n", "Cluster", "Ut", "Cutport",
00124 "Port", "Cport" );
00125 for ( cluster=0; cluster<pknobs->nclr; cluster++ ) {
00126 for ( ut=kapi_utFIRST; ut<=kapi_utLAST; ut++ ) {
00127 for ( cutport=0; cutport<pknobs->mpclrTable[cluster].mpncutport[ut]; cutport++ ) {
00128 KAPI_cutportInfo( pknobs, cluster, ut, cutport, &port, &cport );
00129 kapi_indent_line( fp, nTab+1 );
00130 fprintf( fp, "%8d %4c %8d: %5d %6d\n", cluster, kapi_ut2ch( ut ), cutport,
00131 port, cport );
00132 }
00133 }
00134 }
00135 }
00136
00137
00138 void
00139 KDebug_DumpPortInfo( FILE *fp, knobs_t *pknobs, int nTab )
00140 {
00141 int clr;
00142 kapi_syl_t syl;
00143
00144 for ( clr=0; clr < pknobs->nclr; clr++ ) {
00145 kapi_indent_line( fp, nTab+1 );
00146 fprintf( fp, "Cluster %d (%2d units): I=%d, M=%d, F=%d, B=%d\n",
00147 clr,
00148 KAPI_cportCount( pknobs, clr ),
00149 KAPI_cutportCount( pknobs, clr, kapi_utI ),
00150 KAPI_cutportCount( pknobs, clr, kapi_utM ),
00151 KAPI_cutportCount( pknobs, clr, kapi_utF ),
00152 KAPI_cutportCount( pknobs, clr, kapi_utB ) );
00153 }
00154 kapi_indent_line( fp, nTab+1 );
00155 fprintf( fp, "All (%2d units): I=%d, M=%d, F=%d, B=%d\n",
00156 KAPI_cportCount( pknobs, -1 ),
00157 KAPI_cutportCount( pknobs, -1, kapi_utI ),
00158 KAPI_cutportCount( pknobs, -1, kapi_utM ),
00159 KAPI_cutportCount( pknobs, -1, kapi_utF ),
00160 KAPI_cutportCount( pknobs, -1, kapi_utB ) );
00161
00162
00163 kapi_indent_line( fp, nTab+1 );
00164 fprintf( fp, "Syllable dispersal:\n" );
00165 for ( syl=kapi_sylFIRST; syl<=kapi_sylLAST; syl++ ) {
00166 kapi_indent_line( fp, nTab+2 );
00167 fprintf( fp, "Can disperse %d %c syllables/clock\n",
00168 KAPI_DisperseCount4syl( pknobs, syl ), kapi_syl2ch( syl ) );
00169 }
00170
00171 KDebug_DumpPortMaps( fp, pknobs, nTab );
00172 }
00173
00174 void
00175 KDebug_DumpFUTable( FILE *fp, knobs_t *pknobs, int iLevel )
00176 {
00177 int i,j,clr;
00178 char pchTemp[ 132 ], *pch;
00179
00180 kapi_indent_line( fp, iLevel );
00181 fprintf( fp, "Function unit class (fu) description dump\n" );
00182
00183
00184 kapi_indent_line( fp, iLevel+1 );
00185 fprintf( fp, "%-15s ", "Class" );
00186 for ( clr=0; clr<pknobs->nclr; clr++ ) {
00187 clr_t *pclr;
00188
00189 pclr = &(pknobs->mpclrTable[ clr ]);
00190
00191 for ( i=0; i<pclr->ncports; i++ ) {
00192 cportinfo_t *pcportinfo;
00193
00194 pcportinfo = pclr->mppcportinfoTable[i];
00195 assert( pcportinfo );
00196 pch = KAPI_EnumName( pknobs, pcportinfo->ut, "ut_t" );
00197 assert( pch );
00198 pchTemp[i] = pch[ 2 ];
00199 }
00200 pchTemp[ pclr->ncports ] = '\0';
00201 fprintf( fp, "%-12s ", pchTemp );
00202 }
00203
00204 fprintf( fp, "%6s %-7s\n", "nUnits", "Latency" );
00205
00206
00207
00208 for ( i=0; i<pknobs->nfuinfoTable; i++ ) {
00209 char *pchMnemonic;
00210 fuinfo_t *pfuinfo;
00211
00212 kapi_indent_line( fp, iLevel+1 );
00213
00214 pfuinfo = &(pknobs->dmpfuinfoTable[i]);
00215 pchMnemonic = pfuinfo->pchName;
00216 fprintf( fp, "%-15s ", KAPI_EnumName( pknobs, pfuinfo->fu, "fu_t" ) );
00217
00218 for ( clr=0; clr<pknobs->nclr; clr++ ) {
00219 clr_t *pclr;
00220
00221 pclr = &(pknobs->mpclrTable[ clr ]);
00222
00223 for ( j=0; j<pclr->ncports; j++ ) {
00224 int b;
00225 cportinfo_t *pcportinfo;
00226
00227 pcportinfo = pclr->mppcportinfoTable[j];
00228
00229 assert( pcportinfo && pcportinfo->bvfuAllowed.pint32Data );
00230 b = ( 0 != isbvBITSET( &(pcportinfo->bvfuAllowed), i ) );
00231 pchTemp[ j ] = '0' + b;
00232 }
00233 pchTemp[ pclr->ncports ] = '\0';
00234 fprintf( fp, "%-12s ", pchTemp );
00235 }
00236
00237 fprintf( fp, " %6d %s", KAPI_cportCount4fu( pknobs, -1, pfuinfo->fu ), "n/a" );
00238 fprintf( fp, "\n" );
00239 }
00240 }
00241
00242 void
00243 KDebug_DumpITTable( FILE *fp, knobs_t *pknobs, int iLevel )
00244 {
00245 int i;
00246 itinfo_t *pitinfo;
00247
00248
00249 kapi_indent_line( fp, iLevel );
00250 fprintf( fp, "Instruction type description dump\n" );
00251
00252 kapi_indent_line( fp, iLevel+1 );
00253 fprintf( fp, "%-15s %-7s %-9s %-20s\n", "Class", "IT", "Max Occ", "Syllables Allowed" );
00254
00255 for ( i=0; i<pknobs->nitinfoTable; i++ ) {
00256 kapi_syl_t syl;
00257
00258 pitinfo = &(pknobs->dmpitinfoTable[i]);
00259 kapi_indent_line( fp, iLevel+1 );
00260 fprintf( fp, "%-15s ", pitinfo->pchitName );
00261 fprintf( fp, "%-7s ", KAPI_EnumName( pknobs, pitinfo->it, "it_t" ) );
00262 fprintf( fp, "%9d ", pknobs->dmpitinfoTable[ pitinfo->it ].maxAvail );
00263 for ( syl=kapi_sylFIRST;syl<=kapi_sylLAST;syl++ ) {
00264 if ( pitinfo->bv32sylAllowed & ( 1 << syl ) ) {
00265 fprintf( fp, "%s ", KAPI_EnumName( pknobs, syl, "syl_t" ) );
00266 }
00267 }
00268 fprintf( fp, "\n" );
00269 }
00270 }
00271
00272 void
00273 KDebug_DumpS2SLatencyTable( FILE *fp, knobs_t *pknobs, int iLevel )
00274 {
00275 }
00276
00277 void
00278 KDebug_Dumpmpit( FILE *fp, knobs_t *pknobs, int mpnitAvail[] )
00279 {
00280
00281 fprintf( fp, " (itI:%d)", pknobs->dmpitinfoTable[ kapi_itI ].maxAvail );
00282
00283 fprintf( fp, " (itM:%d)", pknobs->dmpitinfoTable[ kapi_itM ].maxAvail );
00284
00285 fprintf( fp, " (itA:%d)", pknobs->dmpitinfoTable[ kapi_itA ].maxAvail );
00286
00287 fprintf( fp, " (itB:%d)", pknobs->dmpitinfoTable[ kapi_itB ].maxAvail );
00288
00289 fprintf( fp, " (itBl:%d)", pknobs->dmpitinfoTable[ kapi_itBl ].maxAvail );
00290
00291 fprintf( fp, " (itF:%d)", pknobs->dmpitinfoTable[ kapi_itF ].maxAvail );
00292
00293 fprintf( fp, " (itL:%d)", pknobs->dmpitinfoTable[ kapi_itL ].maxAvail );
00294 }
00295
00296
00297 void
00298 KDebug_DumpInstTable( FILE *fp, knobs_t *pknobs, int nTab )
00299 {
00300 int i;
00301
00302 kapi_indent_line( fp, nTab );
00303 fprintf( fp, "%d mnemonics in instruction set\n", pknobs->ninstTable );
00304
00305 kapi_indent_line( fp, nTab );
00306 fprintf( fp, "%5s %-25s %-45s %-8s %-5s\n", "iid", "mnemonic", "unique", "fu", "it" );
00307 for ( i=0; i<pknobs->ninstTable; i++ ) {
00308 kapi_indent_line( fp, nTab );
00309 fprintf( fp, "%5d %-25s %-45s %-8s %-5s\n",
00310 i,
00311 pknobs->dmpinstTable[ i ].pchMnemonic,
00312 pknobs->dmpinstTable[ i ].pchUniqueName,
00313 KAPI_EnumName( pknobs, pknobs->dmpinstTable[ i ].fu, "fu_t" ),
00314 KAPI_EnumName( pknobs, pknobs->dmpinstTable[ i ].it, "it_t" ) );
00315 assert( i == KAPI_uniqueName2iid( pknobs, pknobs->dmpinstTable[ i ].pchUniqueName, 0 ) );
00316 }
00317 }
00318
00319
00320 void
00321 KDebug_ValnNameList( FILE *fp, valn_t *pvalnList, int nTab )
00322 {
00323 int i = 0;
00324
00325 while ( pvalnList ) {
00326 if ( i ) { fprintf( fp, ", " ); }
00327 fprintf( fp, "%s", pvalnList->val.pch );
00328 pvalnList = pvalnList->pvalnNext;
00329 i++;
00330 }
00331 }
00332 void
00333 KDebug_StnNameList( FILE *fp, stn_t *pstnList, int nTab )
00334 {
00335 int i = 0;
00336
00337 while ( pstnList ) {
00338 if ( i ) { fprintf( fp, ", " ); }
00339 fprintf( fp, "%s", pstnList->pchName );
00340 pstnList = pstnList->pstnNext;
00341 i++;
00342 }
00343 }
00344
00345 void
00346 KDebug_DumpType( FILE *fp, stn_t *pstn, int nTab )
00347 {
00348 kapi_indent_line( fp, nTab );
00349
00350 assert( pstn->u.tfi.tty == ttyENUM );
00351 fprintf( fp, "TYPE %s = enum ( ", pstn->pchName );
00352
00353 KDebug_ValnNameList( fp, pstn->u.tfi.pvalnEnums, nTab );
00354
00355 fprintf( fp, " )" );
00356
00357 if ( pstn->u.tfi.tredefStatus == tredefSTATUS_MARKED_NOREDEFINE ) {
00358 fprintf( fp, " limit <> noredefine" );
00359 }
00360
00361 fprintf( fp, ";\n" );
00362
00363 }
00364
00365 void
00366 KDebug_DumpTypeList( FILE *fp, knobs_t *pknobs, int nTab )
00367 {
00368 stn_t *pstn;
00369 valn_t *pvalnRun;
00370
00371 kapi_indent_line( fp, nTab );
00372 fprintf( fp, "Defined types\n" );
00373
00374 nTab++;
00375 pvalnRun = pknobs->pvalnTypeList;
00376 while ( pvalnRun ) {
00377 pstn = kapi_pstnLookup( pknobs, pvalnRun->val.pch );
00378 KDebug_DumpType( fp, pstn, nTab );
00379 pvalnRun = pvalnRun->pvalnNext;
00380 }
00381 }
00382
00383 void
00384 KDebug_DumpTypeSpec( FILE *fp, tfi_t *ptfi, int nTab )
00385 {
00386 switch( ptfi->tty ) {
00387 case ttyINT:
00388 fprintf( fp, "int" );
00389 break;
00390 case ttyREAL:
00391 fprintf( fp, "real" );
00392 break;
00393 case ttySTRING:
00394 fprintf( fp, "string" );
00395 break;
00396 case ttyENUM:
00397 fprintf( fp, "%s", ptfi->pstnIdent->pchName );
00398 break;
00399 case ttyBITMASK:
00400 fprintf( fp, "bitmask( %s )", ptfi->ptfiBitmaskBaseType->pstnIdent->pchName );
00401 break;
00402 case ttyARRAY:
00403 fprintf( fp, "array[ %s ] of ",
00404 ptfi->ptfiArrayIndexType->pstnIdent->pchName );
00405 KDebug_DumpTypeSpec( fp, ptfi->ptfiArrayEltType, 0 );
00406 break;
00407 default:
00408 assert( 0 );
00409 break;
00410 }
00411 }
00412
00413 void
00414 KDebug_DumpVar( FILE *fp, stn_t *pstn, int nTab )
00415 {
00416 kapi_indent_line( fp, nTab );
00417
00418 fprintf( fp, "%s : ", pstn->pchName );
00419
00420 KDebug_DumpTypeSpec( fp, pstn->u.vfi.ptfi, nTab );
00421
00422 fprintf( fp, ";\n" );
00423
00424 }
00425
00426 void
00427 KDebug_printval2( FILE *fp, tfi_t *ptfi, valn_t *pvaln, int nTab )
00428 {
00429 switch( ptfi->tty ) {
00430 case ttyINT:
00431 fprintf( fp, "%d", pvaln->val.i );
00432 break;
00433 case ttyREAL:
00434 fprintf( fp, "%8.4f", pvaln->val.r );
00435 break;
00436 case ttySTRING:
00437 fprintf( fp, "\"%s\"", pvaln->val.pch );
00438 break;
00439 case ttyENUM:
00440 fprintf( fp, "%s", pvaln->val.pch );
00441 break;
00442 case ttyBITMASK:
00443 case ttyARRAY:
00444 default:
00445 assert( 0 );
00446 break;
00447 }
00448 }
00449 void
00450 KDebug_printval( FILE *fp, tfi_t *ptfi, ed_t *pedIn, int nTab )
00451 {
00452 switch( ptfi->tty ) {
00453 case ttyINT:
00454 fprintf( fp, "%d", pedIn->valhdrValue.pvalnList->val.i );
00455 break;
00456 case ttyREAL:
00457 fprintf( fp, "%8.4f", pedIn->valhdrValue.pvalnList->val.r );
00458 break;
00459 case ttySTRING:
00460 fprintf( fp, "\"%s\"", pedIn->valhdrValue.pvalnList->val.pch );
00461 break;
00462 case ttyENUM:
00463 fprintf( fp, "%s", pedIn->valhdrValue.pvalnList->val.pch );
00464 break;
00465 case ttyBITMASK: {
00466 valn_t *pvalnRun;
00467
00468 fprintf( fp, "bitmask( " );
00469 pvalnRun = pedIn->valhdrValue.pvalnList;
00470 while ( pvalnRun ) {
00471 fprintf( fp, "%s", pvalnRun->val.pch );
00472 pvalnRun = pvalnRun->pvalnNext;
00473 if ( pvalnRun ) { fprintf( fp, ", " ); }
00474 }
00475 fprintf( fp, " )" );
00476 break;
00477 }
00478 case ttyARRAY: {
00479 ed_t *pedElt, *pedGlobal;
00480 valn_t *pvalnRun;
00481
00482 pvalnRun = ptfi->ptfiArrayIndexType->pvalnEnums;
00483 pedGlobal = pedLookup4ped( pedIn, "*" );
00484 while ( pvalnRun ) {
00485 kapi_indent_line( fp, nTab );
00486 fprintf( fp, "[ %s ] = ", pvalnRun->val.pch );
00487
00488 pedElt = pedLookup4ped( pedIn, pvalnRun->val.pch );
00489 if ( pedElt ) {
00490 KDebug_printval( fp, ptfi->ptfiArrayEltType,
00491 pedElt, nTab );
00492 } else if ( pedGlobal ) {
00493 KDebug_printval( fp, ptfi->ptfiArrayEltType,
00494 pedGlobal, nTab );
00495 } else {
00496 fprintf( fp, "UNDEFINED\n" );
00497 }
00498 fprintf( fp, "\n" );
00499 pvalnRun = pvalnRun->pvalnNext;
00500 }
00501 break;
00502 }
00503 default:
00504 assert( 0 );
00505 break;
00506 }
00507 }
00508
00509 void
00510 KDebug_PrintVarValueLimits( FILE *fp, stn_t *pstn, tfi_t *ptfi, ed_t *pedList )
00511 {
00512 if ( pedList->valhdrLimit.fNoRedefine ) {
00513 fprintf( fp, " limit <> noredefine" );
00514 return;
00515 }
00516
00517 assert( ptfi->tty != ttyARRAY );
00518
00519 switch ( pedList->valhdrLimit.vals ) {
00520 case valsRANGE:
00521 fprintf( fp, " limit <> ( " );
00522 KDebug_printval2( fp, ptfi, pedList->valhdrLimit.pvalnList, 0 );
00523 fprintf( fp, " .. " );
00524 KDebug_printval2( fp, ptfi, pedList->valhdrLimit.pvalnList->pvalnNext, 0 );
00525 fprintf( fp, " ) " );
00526 break;
00527 case valsLIST: {
00528 valn_t *pvalnRun;
00529
00530 fprintf( fp, " limit <> ( " );
00531 pvalnRun = pedList->valhdrLimit.pvalnList;
00532 while ( pvalnRun ) {
00533 KDebug_printval2( fp, ptfi, pvalnRun, 0 );
00534 pvalnRun = pvalnRun->pvalnNext;
00535 if ( pvalnRun ) {
00536 fprintf( fp, ", " );
00537 }
00538 }
00539 fprintf( fp, " ) " );
00540 break;
00541 }
00542 case valsSCALAR:
00543 KDebug_printval2( fp, ptfi, pedList->valhdrLimit.pvalnList, 0 );
00544 break;
00545 case valsNOREDEFINE:
00546 fprintf( fp, " limit <> noredefine" );
00547 break;
00548 case valsUNSET:
00549 break;
00550 }
00551 }
00552
00553 void
00554 KDebug_DumpVarValues( FILE *fp, stn_t *pstn, int nTab )
00555 {
00556 switch( pstn->u.vfi.ptfi->tty ) {
00557 case ttyINT:
00558 kapi_indent_line( fp, nTab );
00559 fprintf( fp, "%s := ", pstn->pchName );
00560 if ( pstn->u.vfi.pedList->valhdrValue.pvalnList == NULL ) {
00561 fprintf( fp, "UNDEFINED" );
00562 } else {
00563 KDebug_printval( fp, pstn->u.vfi.ptfi, pstn->u.vfi.pedList, nTab );
00564 }
00565
00566 KDebug_PrintVarValueLimits( fp, pstn, pstn->u.vfi.ptfi,
00567 pstn->u.vfi.pedList );
00568
00569 fprintf( fp, ";\n" );
00570 break;
00571 case ttyREAL:
00572 kapi_indent_line( fp, nTab );
00573 fprintf( fp, "%s := ", pstn->pchName );
00574 if ( pstn->u.vfi.pedList->valhdrValue.pvalnList == NULL ) {
00575 fprintf( fp, "UNDEFINED" );
00576 } else {
00577 KDebug_printval( fp, pstn->u.vfi.ptfi, pstn->u.vfi.pedList, nTab );
00578 }
00579
00580 KDebug_PrintVarValueLimits( fp, pstn, pstn->u.vfi.ptfi,
00581 pstn->u.vfi.pedList );
00582
00583 fprintf( fp, ";\n" );
00584 break;
00585 case ttySTRING:
00586 kapi_indent_line( fp, nTab );
00587 fprintf( fp, "%s := ", pstn->pchName );
00588 if ( pstn->u.vfi.pedList->valhdrValue.pvalnList == NULL ) {
00589 fprintf( fp, "\"UNDEFINED\"" );
00590 } else {
00591 KDebug_printval( fp, pstn->u.vfi.ptfi, pstn->u.vfi.pedList, nTab );
00592 }
00593
00594 KDebug_PrintVarValueLimits( fp, pstn, pstn->u.vfi.ptfi,
00595 pstn->u.vfi.pedList );
00596
00597 fprintf( fp, ";\n" );
00598 break;
00599 case ttyENUM:
00600 kapi_indent_line( fp, nTab );
00601 fprintf( fp, "%s := ", pstn->pchName );
00602 if ( pstn->u.vfi.pedList->valhdrValue.pvalnList == NULL ) {
00603 fprintf( fp, "UNDEFINED" );
00604 } else {
00605 KDebug_printval( fp, pstn->u.vfi.ptfi, pstn->u.vfi.pedList, nTab );
00606 }
00607
00608 KDebug_PrintVarValueLimits( fp, pstn, pstn->u.vfi.ptfi,
00609 pstn->u.vfi.pedList );
00610
00611 fprintf( fp, ";\n" );
00612 break;
00613
00614 case ttyBITMASK:
00615 kapi_indent_line( fp, nTab );
00616 fprintf( fp, "%s := ", pstn->pchName );
00617 if ( pstn->u.vfi.pedList->valhdrValue.pvalnList == NULL ) {
00618 kapi_indent_line( fp, nTab );
00619 fprintf( fp, "UNDEFINED" );
00620 } else {
00621 KDebug_printval( fp, pstn->u.vfi.ptfi, pstn->u.vfi.pedList, nTab );
00622 }
00623
00624 KDebug_PrintVarValueLimits( fp, pstn, pstn->u.vfi.ptfi,
00625 pstn->u.vfi.pedList );
00626
00627 fprintf( fp, ";\n" );
00628 break;
00629 case ttyARRAY: {
00630 ed_t *pedIn, *pedElt, *pedGlobal;
00631 valn_t *pvalnRun;
00632 tfi_t *ptfi;
00633
00634 ptfi = pstn->u.vfi.ptfi;
00635 pedIn = pstn->u.vfi.pedList;
00636
00637
00638 if ( ptfi->ptfiArrayIndexType->tty == ttySTRING ) {
00639
00640 while ( pedIn ) {
00641 kapi_indent_line( fp, nTab );
00642 fprintf( fp, "%s[ \"%s\" ] := ",
00643 pstn->pchName, (pedIn->pchIndexName+1) );
00644 if ( pedIn->pchIndexName[0] != '%' ) {
00645 kapi_Error_pch2( -1, 0,"Internal error dumping knobs - index %s[ %s ] malformed\n",pstn->pchName, pedIn->pchIndexName );
00646 }
00647
00648 pedElt = pedIn;
00649 if ( pedElt ) {
00650 KDebug_printval( fp, ptfi->ptfiArrayEltType,
00651 pedElt, nTab );
00652 KDebug_PrintVarValueLimits( fp, pstn, ptfi->ptfiArrayEltType,
00653 pedElt );
00654 } else {
00655 fprintf( fp, "UNDEFINED;\n" );
00656 }
00657
00658
00659 fprintf( fp, ";\n" );
00660 pedIn = pedIn->pedNext;
00661 }
00662
00663 } else {
00664 pvalnRun = ptfi->ptfiArrayIndexType->pvalnEnums;
00665 pedGlobal = pedLookup4ped( pedIn, "*" );
00666 while ( pvalnRun ) {
00667 kapi_indent_line( fp, nTab );
00668 fprintf( fp, "%s[ %s ] := ", pstn->pchName, pvalnRun->val.pch );
00669
00670 pedElt = pedLookup4ped( pedIn, pvalnRun->val.pch );
00671 if ( pedElt ) {
00672 KDebug_printval( fp, ptfi->ptfiArrayEltType,
00673 pedElt, nTab );
00674 KDebug_PrintVarValueLimits( fp, pstn, ptfi->ptfiArrayEltType,
00675 pedElt );
00676 } else if ( pedGlobal ) {
00677 KDebug_printval( fp, ptfi->ptfiArrayEltType,
00678 pedGlobal, nTab );
00679 KDebug_PrintVarValueLimits( fp, pstn, ptfi->ptfiArrayEltType,
00680 pedGlobal );
00681 } else {
00682 fprintf( fp, "UNDEFINED;\n" );
00683 }
00684
00685
00686 fprintf( fp, ";\n" );
00687 pvalnRun = pvalnRun->pvalnNext;
00688 }
00689 }
00690 break;
00691 }
00692 default:
00693 assert( 0 );
00694 break;
00695 }
00696 fprintf( fp, "\n" );
00697 }
00698
00699 void
00700 KDebug_DumpVarValueList( FILE *fp, knobs_t *pknobs, int nTab )
00701 {
00702
00703 stn_t *pstn;
00704 valn_t *pvalnRun;
00705
00706 kapi_indent_line( fp, nTab );
00707 fprintf( fp, "# Defined variables' values \n" );
00708
00709 nTab++;
00710 pvalnRun = pknobs->pvalnVarList;
00711 while ( pvalnRun ) {
00712 pstn = kapi_pstnLookup( pknobs, pvalnRun->val.pch );
00713 KDebug_DumpVar( fp, pstn, nTab );
00714 KDebug_DumpVarValues( fp, pstn, nTab+1 );
00715 pvalnRun = pvalnRun->pvalnNext;
00716 }
00717 }
00718
00719
00720 void
00721 KDebug_DumpVarList( FILE *fp, knobs_t *pknobs, int nTab )
00722 {
00723
00724 stn_t *pstn;
00725 valn_t *pvalnRun;
00726
00727 kapi_indent_line( fp, nTab );
00728 fprintf( fp, "# Defined variables\n" );
00729
00730 nTab++;
00731 pvalnRun = pknobs->pvalnVarList;
00732 while ( pvalnRun ) {
00733 pstn = kapi_pstnLookup( pknobs, pvalnRun->val.pch );
00734 KDebug_DumpVar( fp, pstn, nTab );
00735 pvalnRun = pvalnRun->pvalnNext;
00736 }
00737 }
00738
00739 void
00740 KDebug_DumpIdent( FILE *fp, stn_t *pstn, int nTab )
00741 {
00742 switch ( pstn->ity ) {
00743 case ityVARNAME:
00744 KDebug_DumpVar( fp, pstn, nTab );
00745 break;
00746 case ityTYPENAME:
00747 KDebug_DumpType( fp, pstn, nTab );
00748 break;
00749 case ityATTRIBUTENAME:
00750 case ityENUMCONST:
00751 case ityUNKNOWN:
00752 default:
00753 assert( 0 );
00754 }
00755 }
00756
00757 void
00758 KDebug_DumpLatencies( FILE *fp, knobs_t *pknobs )
00759 {
00760 int i, j, cntfu;
00761
00762 printf( "\n\nCore latencies\n\n" );
00763 cntfu = KAPI_fuCount( pknobs );
00764 for ( i=0; i<cntfu; i++ ) {
00765 int ilat, cntDestOpp;
00766 char *pch;
00767
00768 pch = KAPI_EnumName( pknobs, i, "fu_t" );
00769 cntDestOpp = KAPI_destOppCount( pknobs, i );
00770 for ( j=0; j<cntDestOpp; j++ ) {
00771 char *pchOppName;
00772
00773 ilat = KAPI_CoreLatency( pknobs, i, j );
00774 if ( ilat >= 0 ) {
00775 pchOppName = KAPI_destOppName( pknobs, i, j );
00776 fprintf( fp, " CoreLatency[ %12s/%-8s ] = %2d\n", pch, pchOppName, ilat );
00777 }
00778 }
00779 }
00780 }
00781
00782 void
00783 KDebug_DumpIntraClusterBypass( FILE *fp, knobs_t *pknobs )
00784 {
00785 int fuSrc, fuDest, cntSrcDestOpp, cntDestSrcOpp, oppDestSrc, oppSrcDest;
00786 int clr, cntclr, cntfu;
00787 int fPrintedHdr, ilat;
00788 char *pchFuDest, *pchFuSrc, *pchOppSrcDest, *pchOppDestSrc;
00789
00790 cntclr = KAPI_clusterCount( pknobs );
00791 cntfu = KAPI_fuCount( pknobs );
00792 fprintf( fp, "\n\nDumping bypasses for %d clusters\n", cntclr );
00793
00794 for ( clr=0; clr<cntclr; clr++ ) {
00795
00796 for ( fuSrc=0; fuSrc<cntfu; fuSrc++ ) {
00797 cntSrcDestOpp = KAPI_destOppCount( pknobs, fuSrc );
00798 pchFuSrc = KAPI_EnumName( pknobs, fuSrc, "fu_t" );
00799
00800 for ( fuDest=0; fuDest<cntfu; fuDest++ ) {
00801 fPrintedHdr = 0;
00802 cntDestSrcOpp = KAPI_srcOppCount( pknobs, fuDest );
00803 pchFuDest = KAPI_EnumName( pknobs, fuDest, "fu_t" );
00804
00805 for ( oppSrcDest=0; oppSrcDest<cntSrcDestOpp; oppSrcDest++ ) {
00806 for ( oppDestSrc=0; oppDestSrc<cntDestSrcOpp; oppDestSrc++ ) {
00807 int nlist, ipapair;
00808 papair_t *ppapair, *ppapairList;
00809
00810 ppapairList = KAPI_IntraClusterBypassList( pknobs, clr,
00811 fuSrc, oppSrcDest, -1, -1,
00812 fuDest, oppDestSrc, -1, -1, &nlist );
00813 for ( ipapair=0; ipapair<nlist; ipapair++ ) {
00814 ppapair = &(ppapairList[ ipapair ]);
00815
00816 ilat = KAPI_IntraClusterBypass( pknobs, clr,
00817 fuSrc, oppSrcDest, ppapair->utSrc, ppapair->cutportSrc,
00818 fuDest, oppDestSrc, ppapair->utDest, ppapair->cutportDest );
00819 if ( ilat > 0 ) {
00820 if ( !fPrintedHdr ) {
00821 fprintf( fp, " cluster%d\\%s:%s\n", clr, pchFuSrc, pchFuDest );
00822 fPrintedHdr = 1;
00823 }
00824
00825 pchOppSrcDest = KAPI_destOppName( pknobs, fuSrc, oppSrcDest );
00826
00827 pchOppDestSrc = KAPI_srcOppName( pknobs, fuDest, oppDestSrc );
00828
00829 if ( ppapair->cutportDest == -1 && ppapair->cutportSrc == -1 ) {
00830 fprintf( fp, " %s -> %s = %2d\n",
00831 pchOppSrcDest, pchOppDestSrc, ilat );
00832 } else if ( ppapair->cutportDest == -1 ) {
00833 fprintf( fp, " %s/%c%d -> %s = %2d\n",
00834 pchOppSrcDest, kapi_ut2ch( ppapair->utSrc ),
00835 ppapair->cutportSrc, pchOppDestSrc, ilat );
00836 } else if ( ppapair->cutportSrc == -1 ) {
00837 fprintf( fp, " %s -> %s/%c%d = %2d\n",
00838 pchOppSrcDest, pchOppDestSrc,
00839 kapi_ut2ch( ppapair->utDest ), ppapair->cutportDest,
00840 ilat );
00841 } else {
00842 fprintf( fp, " %s/%c%d -> %s/%c%d = %2d\n",
00843 pchOppSrcDest, kapi_ut2ch( ppapair->utSrc ),
00844 ppapair->cutportSrc, pchOppDestSrc,
00845 kapi_ut2ch( ppapair->utDest ), ppapair-> cutportDest, ilat );
00846 }
00847 }
00848 }
00849 }
00850 }
00851 }
00852 }
00853 }
00854 }
00855
00856 void
00857 KDebug_DumpInterClusterBypass( FILE *fp, knobs_t *pknobs )
00858 {
00859 int fuSrc, fuDest, cntSrcDestOpp, cntDestSrcOpp, oppDestSrc, oppSrcDest;
00860 int clrSrc, clrDest, cntclr, cntfu;
00861 int fPrintedHdr, ilat;
00862 char *pchFuDest, *pchFuSrc, *pchOppSrcDest, *pchOppDestSrc;
00863
00864 fprintf( fp, "\n\nDumping intercluster bypasses\n");
00865
00866 cntclr = KAPI_clusterCount( pknobs );
00867 cntfu = KAPI_fuCount( pknobs );
00868
00869 for ( clrSrc=0; clrSrc<cntclr; clrSrc++ ) {
00870 for ( clrDest=0; clrDest<cntclr; clrDest++ ) {
00871
00872 for ( fuSrc=0; fuSrc<cntfu; fuSrc++ ) {
00873 cntSrcDestOpp = KAPI_destOppCount( pknobs, fuSrc );
00874 pchFuSrc = KAPI_EnumName( pknobs, fuSrc, "fu_t" );
00875
00876 for ( fuDest=0; fuDest<cntfu; fuDest++ ) {
00877 fPrintedHdr = 0;
00878 cntDestSrcOpp = KAPI_srcOppCount( pknobs, fuDest );
00879 pchFuDest = KAPI_EnumName( pknobs, fuDest, "fu_t" );
00880
00881 for ( oppSrcDest=0; oppSrcDest<cntSrcDestOpp; oppSrcDest++ ) {
00882 for ( oppDestSrc=0; oppDestSrc<cntDestSrcOpp; oppDestSrc++ ) {
00883 int nlist, ipepair;
00884 pepair_t *ppepair, *ppepairList;
00885
00886 ppepairList = KAPI_InterClusterBypassList( pknobs,
00887 clrSrc, fuSrc, oppSrcDest, -1, -1,
00888 clrDest, fuDest, oppDestSrc, -1, -1, &nlist );
00889 for ( ipepair=0; ipepair<nlist; ipepair++ ) {
00890 ppepair = &(ppepairList[ ipepair ]);
00891
00892 ilat = KAPI_InterClusterBypass( pknobs,
00893 clrSrc, fuSrc, oppSrcDest, ppepair->utSrc, ppepair->cutportSrc,
00894 clrDest, fuDest, oppDestSrc, ppepair->utDest, ppepair->cutportDest );
00895 if ( ilat > 0 ) {
00896 if ( !fPrintedHdr ) {
00897 fprintf( fp, " cluster%d/%s:cluster%d/%s\n",
00898 clrSrc, pchFuSrc, clrDest, pchFuDest );
00899 fPrintedHdr = 1;
00900 }
00901
00902 pchOppSrcDest = KAPI_destOppName( pknobs, fuSrc, oppSrcDest );
00903
00904 pchOppDestSrc = KAPI_srcOppName( pknobs, fuDest, oppDestSrc );
00905
00906 if ( ppepair->cutportDest == -1 && ppepair->cutportSrc == -1 ) {
00907 fprintf( fp, " %s -> %s = %2d\n",
00908 pchOppSrcDest, pchOppDestSrc, ilat );
00909 } else if ( ppepair->cutportDest == -1 ) {
00910 fprintf( fp, " %s/%c%d -> %s = %2d\n",
00911 pchOppSrcDest, kapi_ut2ch( ppepair->utSrc ),
00912 ppepair->cutportSrc, pchOppDestSrc, ilat );
00913 } else if ( ppepair->cutportSrc == -1 ) {
00914 fprintf( fp, " %s -> %s/%c%d = %2d\n",
00915 pchOppSrcDest, pchOppDestSrc,
00916 kapi_ut2ch( ppepair->utDest ), ppepair->cutportDest,
00917 ilat );
00918 } else {
00919 fprintf( fp, " %s/%c%d -> %s/%c%d = %2d\n",
00920 pchOppSrcDest, kapi_ut2ch( ppepair->utSrc ),
00921 ppepair->cutportSrc, pchOppDestSrc,
00922 kapi_ut2ch( ppepair->utDest ), ppepair-> cutportDest, ilat );
00923 } } } } } } } } } }
00924
00925
00926 void
00927 KDebug_DumpTotalLatency( FILE *fp, knobs_t *pknobs )
00928 {
00929 int fuSrc, fuDest, cntSrcDestOpp, cntDestSrcOpp, oppDestSrc, oppSrcDest;
00930 int clr, clrSrc, clrDest, cntclr, cntfu;
00931 int fPrintedHdr, ilat;
00932 char *pchFuDest, *pchFuSrc, *pchOppSrcDest, *pchOppDestSrc;
00933
00934 fprintf( fp, "\n\nDumping total latency\n");
00935
00936 cntclr = KAPI_clusterCount( pknobs );
00937 cntfu = KAPI_fuCount( pknobs );
00938
00939 for ( clrSrc=0; clrSrc<cntclr; clrSrc++ ) {
00940 for ( clrDest=0; clrDest<cntclr; clrDest++ ) {
00941
00942 for ( fuSrc=0; fuSrc<cntfu; fuSrc++ ) {
00943 cntSrcDestOpp = KAPI_destOppCount( pknobs, fuSrc );
00944 pchFuSrc = KAPI_EnumName( pknobs, fuSrc, "fu_t" );
00945
00946 for ( fuDest=0; fuDest<cntfu; fuDest++ ) {
00947 fPrintedHdr = 0;
00948 cntDestSrcOpp = KAPI_srcOppCount( pknobs, fuDest );
00949 pchFuDest = KAPI_EnumName( pknobs, fuDest, "fu_t" );
00950
00951 for ( oppSrcDest=0; oppSrcDest<cntSrcDestOpp; oppSrcDest++ ) {
00952 for ( oppDestSrc=0; oppDestSrc<cntDestSrcOpp; oppDestSrc++ ) {
00953 int nlist, ipepair;
00954 pepair_t *ppepair, *ppepairList;
00955
00956 ppepairList = KAPI_InterClusterBypassList( pknobs,
00957 clrSrc, fuSrc, oppSrcDest, -1, -1,
00958 clrDest, fuDest, oppDestSrc, -1, -1, &nlist );
00959 for ( ipepair=0; ipepair<nlist; ipepair++ ) {
00960 ppepair = &(ppepairList[ ipepair ]);
00961
00962 ilat = KAPI_TotalLatency( pknobs,
00963 clrSrc, fuSrc, oppSrcDest, ppepair->utSrc, ppepair->cutportSrc,
00964 clrDest, fuDest, oppDestSrc, ppepair->utDest, ppepair->cutportDest );
00965 if ( ilat > 0 ) {
00966 if ( !fPrintedHdr ) {
00967 fprintf( fp, " cluster%d/%s:cluster%d/%s\n",
00968 clrSrc, pchFuSrc, clrDest, pchFuDest );
00969 fPrintedHdr = 1;
00970 }
00971
00972 pchOppSrcDest = KAPI_destOppName( pknobs, fuSrc, oppSrcDest );
00973
00974 pchOppDestSrc = KAPI_srcOppName( pknobs, fuDest, oppDestSrc );
00975
00976 if ( ppepair->cutportDest == -1 && ppepair->cutportSrc == -1 ) {
00977 fprintf( fp, " %s -> %s = %2d\n",
00978 pchOppSrcDest, pchOppDestSrc, ilat );
00979 } else if ( ppepair->cutportDest == -1 ) {
00980 fprintf( fp, " %s/%c%d -> %s = %2d\n",
00981 pchOppSrcDest, kapi_ut2ch( ppepair->utSrc ),
00982 ppepair->cutportSrc, pchOppDestSrc, ilat );
00983 } else if ( ppepair->cutportSrc == -1 ) {
00984 fprintf( fp, " %s -> %s/%c%d = %2d\n",
00985 pchOppSrcDest, pchOppDestSrc,
00986 kapi_ut2ch( ppepair->utDest ), ppepair->cutportDest,
00987 ilat );
00988 } else {
00989 fprintf( fp, " %s/%c%d -> %s/%c%d = %2d\n",
00990 pchOppSrcDest, kapi_ut2ch( ppepair->utSrc ),
00991 ppepair->cutportSrc, pchOppDestSrc,
00992 kapi_ut2ch( ppepair->utDest ), ppepair-> cutportDest, ilat );
00993 } } } } } } } } }
00994 for ( clr=0; clr<cntclr; clr++ ) {
00995
00996 for ( fuSrc=0; fuSrc<cntfu; fuSrc++ ) {
00997 cntSrcDestOpp = KAPI_destOppCount( pknobs, fuSrc );
00998 pchFuSrc = KAPI_EnumName( pknobs, fuSrc, "fu_t" );
00999
01000 for ( fuDest=0; fuDest<cntfu; fuDest++ ) {
01001 fPrintedHdr = 0;
01002 cntDestSrcOpp = KAPI_srcOppCount( pknobs, fuDest );
01003 pchFuDest = KAPI_EnumName( pknobs, fuDest, "fu_t" );
01004
01005 for ( oppSrcDest=0; oppSrcDest<cntSrcDestOpp; oppSrcDest++ ) {
01006 for ( oppDestSrc=0; oppDestSrc<cntDestSrcOpp; oppDestSrc++ ) {
01007 int nlist, ipapair;
01008 papair_t *ppapair, *ppapairList;
01009
01010 ppapairList = KAPI_IntraClusterBypassList( pknobs, clr,
01011 fuSrc, oppSrcDest, -1, -1,
01012 fuDest, oppDestSrc, -1, -1, &nlist );
01013 for ( ipapair=0; ipapair<nlist; ipapair++ ) {
01014 ppapair = &(ppapairList[ ipapair ]);
01015
01016 ilat = KAPI_TotalLatency( pknobs,
01017 clr, fuSrc, oppSrcDest, ppapair->utSrc, ppapair->cutportSrc,
01018 clr, fuDest, oppDestSrc, ppapair->utDest, ppapair->cutportDest );
01019 if ( ilat > KAPI_CoreLatency( pknobs, fuSrc, oppSrcDest ) ) {
01020 if ( !fPrintedHdr ) {
01021 fprintf( fp, " cluster%d\\ %s:%s (min %d)\n", clr,
01022 pchFuSrc, pchFuDest,
01023 KAPI_MinIntraClusterTotalLatency( pknobs, clr,
01024 fuSrc, oppSrcDest, fuDest, oppDestSrc) );
01025 fPrintedHdr = 1;
01026 }
01027
01028 pchOppSrcDest = KAPI_destOppName( pknobs, fuSrc, oppSrcDest );
01029
01030 pchOppDestSrc = KAPI_srcOppName( pknobs, fuDest, oppDestSrc );
01031
01032 if ( ppapair->cutportDest == -1 && ppapair->cutportSrc == -1 ) {
01033 fprintf( fp, " %s -> %s = %2d\n",
01034 pchOppSrcDest, pchOppDestSrc, ilat );
01035 } else if ( ppapair->cutportDest == -1 ) {
01036 fprintf( fp, " %s/%c%d -> %s = %2d\n",
01037 pchOppSrcDest, kapi_ut2ch( ppapair->utSrc ),
01038 ppapair->cutportSrc, pchOppDestSrc, ilat );
01039 } else if ( ppapair->cutportSrc == -1 ) {
01040 fprintf( fp, " %s -> %s/%c%d = %2d\n",
01041 pchOppSrcDest, pchOppDestSrc,
01042 kapi_ut2ch( ppapair->utDest ), ppapair->cutportDest,
01043 ilat );
01044 } else {
01045 fprintf( fp, " %s/%c%d -> %s/%c%d = %2d\n",
01046 pchOppSrcDest, kapi_ut2ch( ppapair->utSrc ),
01047 ppapair->cutportSrc, pchOppDestSrc,
01048 kapi_ut2ch( ppapair->utDest ), ppapair-> cutportDest, ilat );
01049 }
01050 } } } } } } } }
01051
01052
01053 void
01054 KDebug_DumpClusterDistances( FILE *fp, knobs_t *pknobs )
01055 {
01056 int cntclr;
01057 kapi_cluster_t clusterSrc, clusterDest;
01058
01059 cntclr = KAPI_clusterCount( pknobs );
01060 fprintf( fp, "\n\nDumping cluster distances for %d clusters\n", cntclr );
01061
01062 for ( clusterSrc=0; clusterSrc<cntclr; clusterSrc++ ) {
01063 for ( clusterDest=0; clusterDest<cntclr; clusterDest++ ) {
01064 fprintf( fp, " cluster%d:cluster%d = %d\n", clusterSrc, clusterDest,
01065 KAPI_ClusterDistance( pknobs, clusterSrc, clusterDest ) );
01066 }
01067 }
01068
01069 }
01070
01071 void
01072 KDebug_DumpAttr( FILE *fp, stn_t *pstn, int iLevel )
01073 {
01074 int i;
01075
01076 kapi_indent_line( fp, iLevel );
01077 for ( i=0; i<pstn->u.afih.nAttr; i++ ) {
01078 fprintf( fp, "%s += \"%s\";\n", pstn->pchName, pstn->u.afih.u.dmppch[ i ] );
01079 }
01080 }
01081
01082
01083 void
01084 KDebug_DumpKnobs( FILE *fp, knobs_t *pknobs, int nTab )
01085 {
01086 stn_t *pstn;
01087 valn_t *pvalnRun;
01088
01089 kapi_indent_line( fp, nTab );
01090 fprintf( fp, "#\n# Defined types#\n\n" );
01091
01092
01093
01094 pvalnRun = pknobs->pvalnTypeList;
01095 while ( pvalnRun ) {
01096 pstn = kapi_pstnLookup( pknobs, pvalnRun->val.pch );
01097 if ( pstn->u.tfi.tty == ttyINT ||
01098 pstn->u.tfi.tty == ttyREAL ||
01099 pstn->u.tfi.tty == ttyENUM ||
01100 pstn->u.tfi.tty == ttySTRING ) {
01101
01102
01103
01104 if ( 0 != strcmp( pstn->pchName, "port_t" ) ) {
01105 KDebug_DumpType( fp, pstn, nTab );
01106 }
01107 }
01108 pvalnRun = pvalnRun->pvalnNext;
01109 }
01110
01111
01112 pvalnRun = pknobs->pvalnTypeList;
01113 while ( pvalnRun ) {
01114 pstn = kapi_pstnLookup( pknobs, pvalnRun->val.pch );
01115 if ( pstn->u.tfi.tty == ttyBITMASK ) {
01116 KDebug_DumpType( fp, pstn, nTab );
01117 }
01118 pvalnRun = pvalnRun->pvalnNext;
01119 }
01120
01121
01122 pvalnRun = pknobs->pvalnTypeList;
01123 while ( pvalnRun ) {
01124 pstn = kapi_pstnLookup( pknobs, pvalnRun->val.pch );
01125 if ( pstn->u.tfi.tty == ttyARRAY ) {
01126
01127 KDebug_DumpType( fp, pstn, nTab );
01128 }
01129 pvalnRun = pvalnRun->pvalnNext;
01130 }
01131
01132
01133 kapi_indent_line( fp, nTab );
01134 fprintf( fp, "#\n# Defined variables#\n\n" );
01135
01136 pvalnRun = pknobs->pvalnVarList;
01137 while ( pvalnRun ) {
01138 pstn = kapi_pstnLookup( pknobs, pvalnRun->val.pch );
01139 fprintf( fp, "" );
01140
01141
01142
01143 if ( 0 != strcmp( pstn->pchName, "PortMask" )
01144 && 0 != strcmp( pstn->pchName, "PortTypes" ) ) {
01145 if ( 0 == strcmp( pstn->pchName, "cluster0Cutports" ) ) {
01146 KDebug_Dcluster0Cutports( pknobs, fp, pstn, nTab );
01147 } else {
01148 KDebug_DumpVar( fp, pstn, nTab );
01149 KDebug_DumpVarValues( fp, pstn, nTab+1 );
01150 }
01151 }
01152 pvalnRun = pvalnRun->pvalnNext;
01153 }
01154
01155
01156 kapi_indent_line( fp, nTab );
01157 fprintf( fp, "#\n# Defined attributes#\n\n" );
01158
01159 pvalnRun = pknobs->pvalnAttrList;
01160 while ( pvalnRun ) {
01161 pstn = kapi_pstnLookup( pknobs, pvalnRun->val.pch );
01162 KDebug_DumpAttr( fp, pstn, nTab );
01163 pvalnRun = pvalnRun->pvalnNext;
01164 }
01165 }
01166
01167 void
01168 KAPI_DumpKnobs( void *pknobs, FILE *fp )
01169 {
01170 KDebug_DumpKnobs( fp, pknobs, 0 );
01171 }
01172
01173
01174 static void
01175 KDebug_Dcluster0Cutports( knobs_t *pknobs, FILE *fp, stn_t *pstn, int nTab )
01176 {
01177 kapi_ut_t ut;
01178
01179 fprintf( fp, "cluster0Cutports : array[ ut_t ] of int;\n" );
01180 for ( ut=kapi_utFIRST; ut<kapi_nUT; ut++ ) {
01181 char *pchIndex;
01182
01183 pchIndex = KAPI_EnumName( pknobs, ut, "ut_t" );
01184 fprintf( fp, " cluster0Cutports[ %s ] := %d;\n", pchIndex,
01185 pknobs->mpclrTable[ 0 ].mpncutport[ ut ] );
01186 }
01187
01188 fprintf( fp, "\n" );
01189 }