Skip to content

Commit b093052

Browse files
committed
Minor bug fixes.
1 parent 2c45f9d commit b093052

File tree

5 files changed

+126
-6
lines changed

5 files changed

+126
-6
lines changed

src/base/wlc/wlcBlast.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,9 +1513,12 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
15131513
nRange2 = 0;
15141514

15151515
// create new box
1516-
if ( vTables == NULL )
1516+
if ( vTables == NULL ) {
15171517
Tim_ManSetDelayTables( pManTime, (vTables = Vec_PtrAlloc(100)) );
1518+
Vec_PtrPush( vTables, NULL );
1519+
}
15181520
Tim_ManCreateBox( pManTime, curPo, nRange0 + nRange1 + nRange2, curPi, nRange, Vec_PtrSize(vTables), 0 );
1521+
Tim_ManBoxSetCopy( pManTime, Tim_ManBoxNum(pManTime)-1, Tim_ManBoxNum(pManTime)-1 );
15191522
curPi += nRange;
15201523
curPo += nRange0 + nRange1 + nRange2;
15211524

@@ -2105,8 +2108,10 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
21052108
assert( pObj->Type == WLC_OBJ_FF );
21062109

21072110
// create new box
2108-
if ( vTables == NULL )
2111+
if ( vTables == NULL ) {
21092112
Tim_ManSetDelayTables( pManTime, (vTables = Vec_PtrAlloc(100)) );
2113+
Vec_PtrPush( vTables, NULL );
2114+
}
21102115
Tim_ManCreateBox( pManTime, curPo, nRangeIn, curPi, nRange, Vec_PtrSize(vTables), 0 );
21112116
curPi += nRange;
21122117
curPo += nRangeIn;

src/map/if/ifCom.c

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ static int If_CommandReadLut ( Abc_Frame_t * pAbc, int argc, char **argv );
3232
static int If_CommandPrintLut( Abc_Frame_t * pAbc, int argc, char **argv );
3333
static int If_CommandReadBox ( Abc_Frame_t * pAbc, int argc, char **argv );
3434
static int If_CommandPrintBox( Abc_Frame_t * pAbc, int argc, char **argv );
35+
static int If_CommandWriteBox( Abc_Frame_t * pAbc, int argc, char **argv );
36+
static int If_CommandPrintTim( Abc_Frame_t * pAbc, int argc, char **argv );
3537

3638
////////////////////////////////////////////////////////////////////////
3739
/// FUNCTION DEFINITIONS ///
@@ -59,6 +61,8 @@ void If_Init( Abc_Frame_t * pAbc )
5961

6062
Cmd_CommandAdd( pAbc, "FPGA mapping", "read_box", If_CommandReadBox, 0 );
6163
Cmd_CommandAdd( pAbc, "FPGA mapping", "print_box", If_CommandPrintBox, 0 );
64+
Cmd_CommandAdd( pAbc, "FPGA mapping", "write_box", If_CommandWriteBox, 0 );
65+
Cmd_CommandAdd( pAbc, "FPGA mapping", "print_tim", If_CommandPrintTim, 0 );
6266
}
6367

6468
/**Function*************************************************************
@@ -362,6 +366,113 @@ int If_CommandPrintBox( Abc_Frame_t * pAbc, int argc, char **argv )
362366
return 1; /* error exit */
363367
}
364368

369+
/**Function*************************************************************
370+
371+
Synopsis [Command procedure to read LUT libraries.]
372+
373+
Description []
374+
375+
SideEffects []
376+
377+
SeeAlso []
378+
379+
***********************************************************************/
380+
int If_CommandWriteBox( Abc_Frame_t * pAbc, int argc, char **argv )
381+
{
382+
FILE * pOut, * pErr;
383+
Abc_Ntk_t * pNet;
384+
int fVerbose;
385+
int c;
386+
387+
pNet = Abc_FrameReadNtk(pAbc);
388+
pOut = Abc_FrameReadOut(pAbc);
389+
pErr = Abc_FrameReadErr(pAbc);
390+
391+
fVerbose = 1;
392+
Extra_UtilGetoptReset();
393+
while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF )
394+
{
395+
switch (c)
396+
{
397+
case 'v':
398+
fVerbose ^= 1;
399+
break;
400+
case 'h':
401+
goto usage;
402+
break;
403+
default:
404+
goto usage;
405+
}
406+
}
407+
408+
if ( argc != globalUtilOptind+1 )
409+
goto usage;
410+
411+
If_LibBoxWrite( argv[globalUtilOptind], (If_LibBox_t *)Abc_FrameReadLibBox() );
412+
return 0;
413+
414+
usage:
415+
fprintf( pErr, "\nusage: write_box [-vh] <file>\n");
416+
fprintf( pErr, "\t write the current box library into a file\n" );
417+
fprintf( pErr, "\t-v : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") );
418+
fprintf( pErr, "\t-h : print the command usage\n");
419+
fprintf( pErr, "\t<file> : the output file name\n");
420+
return 1; /* error exit */
421+
}
422+
423+
424+
/**Function*************************************************************
425+
426+
Synopsis [Command procedure to read LUT libraries.]
427+
428+
Description []
429+
430+
SideEffects []
431+
432+
SeeAlso []
433+
434+
***********************************************************************/
435+
int If_CommandPrintTim( Abc_Frame_t * pAbc, int argc, char **argv )
436+
{
437+
Gia_Man_t * pGia = Abc_FrameReadGia(pAbc);
438+
int c, fVerbose = 0;
439+
Extra_UtilGetoptReset();
440+
while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF )
441+
{
442+
switch (c)
443+
{
444+
case 'v':
445+
fVerbose ^= 1;
446+
break;
447+
case 'h':
448+
goto usage;
449+
break;
450+
default:
451+
goto usage;
452+
}
453+
}
454+
if ( pGia == NULL )
455+
{
456+
Abc_Print( -1, "There is no AIG in the &-space.\n" );
457+
return 1;
458+
}
459+
if ( pGia->pManTime == NULL )
460+
{
461+
Abc_Print( -1, "The current AIG does not have a timing manager.\n" );
462+
return 1;
463+
}
464+
Tim_ManPrint( (Tim_Man_t *)pGia->pManTime );
465+
if ( fVerbose )
466+
Tim_ManPrintBoxCopy( (Tim_Man_t *)pGia->pManTime );
467+
return 0;
468+
469+
usage:
470+
Abc_Print( -2, "\nusage: print_tim [-vh]\n");
471+
Abc_Print( -2, "\t print the timing manager\n" );
472+
Abc_Print( -2, "\t-v : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") );
473+
Abc_Print( -2, "\t-h : print the command usage\n");
474+
return 1; /* error exit */
475+
}
365476

366477
////////////////////////////////////////////////////////////////////////
367478
/// END OF FILE ///

src/map/if/ifLibBox.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void If_LibBoxPrint( FILE * pFile, If_LibBox_t * p )
345345
If_LibBoxForEachBox( p, pBox, i )
346346
{
347347
fprintf( pFile, "%s %d %d %d %d\n", pBox->pName, pBox->Id, !pBox->fBlack, pBox->nPis, pBox->nPos );
348-
for ( j = 0; j < pBox->nPos; j++, printf("\n") )
348+
for ( j = 0; j < pBox->nPos; j++, fprintf(pFile, "\n") )
349349
for ( k = 0; k < pBox->nPis; k++ )
350350
if ( pBox->pDelays[j * pBox->nPis + k] == -ABC_INFINITY )
351351
fprintf( pFile, " - " );
@@ -364,6 +364,7 @@ void If_LibBoxWrite( char * pFileName, If_LibBox_t * p )
364364
}
365365
If_LibBoxPrint( pFile, p );
366366
fclose( pFile );
367+
printf( "Finished writing box library into file \"%s\".\n", pFileName );
367368
}
368369

369370
/**Function*************************************************************

src/misc/tim/tim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ extern float * Tim_ManGetReqTimes( Tim_Man_t * p );
140140
extern void Tim_ManStop( Tim_Man_t * p );
141141
extern void Tim_ManStopP( Tim_Man_t ** p );
142142
extern void Tim_ManPrint( Tim_Man_t * p );
143+
extern void Tim_ManPrintBoxCopy( Tim_Man_t * p );
143144
extern void Tim_ManPrintStats( Tim_Man_t * p, int nAnd2Delay );
144145
extern int Tim_ManCiNum( Tim_Man_t * p );
145146
extern int Tim_ManCoNum( Tim_Man_t * p );

src/misc/tim/timMan.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,10 @@ void Tim_ManPrint( Tim_Man_t * p )
564564
if ( Tim_ManBoxNum(p) > 0 )
565565
Tim_ManForEachBox( p, pBox, i )
566566
{
567-
printf( "*** Box %5d : I =%4d. O =%4d. I1 =%6d. O1 =%6d. Table =%4d\n",
567+
printf( "*** Box %5d : I =%4d. O =%4d. I1 =%6d. O1 =%6d. Table =%4d. Copy = %d.\n",
568568
i, pBox->nInputs, pBox->nOutputs,
569569
Tim_ManBoxInputFirst(p, i), Tim_ManBoxOutputFirst(p, i),
570-
pBox->iDelayTable );
570+
pBox->iDelayTable, pBox->iCopy );
571571

572572
// print box inputs
573573
pPrev = Tim_ManBoxInput( p, pBox, 0 );
@@ -591,7 +591,7 @@ void Tim_ManPrint( Tim_Man_t * p )
591591
Tim_ManBoxForEachOutput( p, pBox, pObj, k )
592592
printf( "box-out%3d : arrival = %5.3f required = %5.3f\n", k, pObj->timeArr, pObj->timeReq );
593593

594-
if ( i > 2 )
594+
if ( i == 7 )
595595
break;
596596
}
597597

@@ -611,6 +611,8 @@ void Tim_ManPrint( Tim_Man_t * p )
611611
printf( "%5s", "-" );
612612
else
613613
printf( "%5.0f", pTable[3+j*TableX+k] );
614+
if ( i == 7 )
615+
break;
614616
}
615617
printf( "\n" );
616618
}

0 commit comments

Comments
 (0)