mirror of https://github.com/YosysHQ/abc.git
Updating and extending simulation data structures.
This commit is contained in:
parent
ed90ce20df
commit
f402d09c74
|
|
@ -236,28 +236,29 @@ void Gia_ManDumpFiles( Gia_Man_t * p, int nCexesT, int nCexesV, int Seed, char *
|
|||
***********************************************************************/
|
||||
void Gia_ManDumpPlaFiles( Gia_Man_t * p, int nCexesT, int nCexesV, int Seed, char * pFileName )
|
||||
{
|
||||
int n, nSize[2] = {nCexesT*64, nCexesV*64};
|
||||
int n, nSize[3] = {nCexesT, nCexesV, nCexesV};
|
||||
|
||||
char pFileNameOutT[100];
|
||||
char pFileNameOutV[100];
|
||||
char pFileNameOut[3][100];
|
||||
|
||||
sprintf( pFileNameOutT, "train_%s_%d.pla", pFileName ? pFileName : Gia_ManName(p), nSize[0] );
|
||||
sprintf( pFileNameOutV, "test_%s_%d.pla", pFileName ? pFileName : Gia_ManName(p), nSize[1] );
|
||||
sprintf( pFileNameOut[0], "%s.train.pla", pFileName ? pFileName : Gia_ManName(p) );
|
||||
sprintf( pFileNameOut[1], "%s.valid.pla", pFileName ? pFileName : Gia_ManName(p) );
|
||||
sprintf( pFileNameOut[2], "%s.test.pla", pFileName ? pFileName : Gia_ManName(p) );
|
||||
|
||||
Gia_ManRandomW( 1 );
|
||||
for ( n = 0; n < Seed; n++ )
|
||||
Gia_ManRandomW( 0 );
|
||||
for ( n = 0; n < 2; n++ )
|
||||
for ( n = 0; n < 3; n++ )
|
||||
{
|
||||
int Res = Gia_ManSimulateWords( p, nSize[n] );
|
||||
int i, k, Id;
|
||||
|
||||
FILE * pFileOut = fopen( n ? pFileNameOutV : pFileNameOutT, "wb" );
|
||||
FILE * pFileOut = fopen( pFileNameOut[n], "wb" );
|
||||
|
||||
fprintf( pFileOut, ".i %d\n", Gia_ManCiNum(p) );
|
||||
fprintf( pFileOut, ".o %d\n", Gia_ManCoNum(p) );
|
||||
fprintf( pFileOut, ".p %d\n", nSize[n] );
|
||||
for ( k = 0; k < nSize[n]; k++ )
|
||||
fprintf( pFileOut, ".p %d\n", nSize[n]*64 );
|
||||
fprintf( pFileOut, ".type fr\n" );
|
||||
for ( k = 0; k < nSize[n]*64; k++ )
|
||||
{
|
||||
Gia_ManForEachCiId( p, Id, i )
|
||||
{
|
||||
|
|
@ -278,7 +279,7 @@ void Gia_ManDumpPlaFiles( Gia_Man_t * p, int nCexesT, int nCexesV, int Seed, cha
|
|||
|
||||
Res = 0;
|
||||
}
|
||||
printf( "Finished dumping files \"%s\" and \"%s\".\n", pFileNameOutT, pFileNameOutV );
|
||||
printf( "Finished dumping files: \"%s.{train, valid, test}.pla\".\n", pFileName ? pFileName : Gia_ManName(p) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -337,6 +338,7 @@ int Gia_ManSimParamRead( char * pFileName, int * pnIns, int * pnWords )
|
|||
*pnIns = nIns - 1;
|
||||
*pnWords = nLines / 64;
|
||||
//printf( "Expecting %d inputs and %d words of simulation data.\n", *pnIns, *pnWords );
|
||||
fclose( pFile );
|
||||
return 1;
|
||||
}
|
||||
void Gia_ManSimFileRead( char * pFileName, int nIns, int nWords, Vec_Wrd_t * vSimsIn, Vec_Int_t * vValues )
|
||||
|
|
@ -374,11 +376,11 @@ void Gia_ManSimFileRead( char * pFileName, int nIns, int nWords, Vec_Wrd_t * vSi
|
|||
}
|
||||
assert( nPats == 64*nWords );
|
||||
fclose( pFile );
|
||||
printf( "Read %d simulation patterns for %d inputs.\n", 64*nWords, nIns );
|
||||
printf( "Read %d simulation patterns for %d inputs. Probability of 1 at the output is %6.2f %%.\n", 64*nWords, nIns, 100.0*Vec_IntSum(vValues)/nPats );
|
||||
}
|
||||
void Gia_ManCompareValues( Gia_Man_t * p, Vec_Wrd_t * vSimsIn, Vec_Int_t * vValues )
|
||||
{
|
||||
int i, Value, Count = 0, nWords = Vec_WrdSize(vSimsIn) / Gia_ManCiNum(p);
|
||||
int i, Value, Guess, Count = 0, nWords = Vec_WrdSize(vSimsIn) / Gia_ManCiNum(p);
|
||||
word * pSims;
|
||||
assert( Vec_IntSize(vValues) == nWords * 64 );
|
||||
Gia_ManSimulateWordsInit( p, vSimsIn );
|
||||
|
|
@ -387,8 +389,11 @@ void Gia_ManCompareValues( Gia_Man_t * p, Vec_Wrd_t * vSimsIn, Vec_Int_t * vValu
|
|||
Vec_IntForEachEntry( vValues, Value, i )
|
||||
if ( Abc_TtGetBit(pSims, i) == Value )
|
||||
Count++;
|
||||
printf( "Total = %6d. Errors = %6d. Correct = %6d. (%6.2f %%)\n",
|
||||
Vec_IntSize(vValues), Vec_IntSize(vValues) - Count, Count, 100.0*Count/Vec_IntSize(vValues) );
|
||||
Guess = (Vec_IntSum(vValues) > nWords * 32) ? Vec_IntSum(vValues) : nWords * 64 - Vec_IntSum(vValues);
|
||||
printf( "Total = %6d. Errors = %6d. Correct = %6d. (%6.2f %%) Naive guess = %6d. (%6.2f %%)\n",
|
||||
Vec_IntSize(vValues), Vec_IntSize(vValues) - Count,
|
||||
Count, 100.0*Count/Vec_IntSize(vValues),
|
||||
Guess, 100.0*Guess/Vec_IntSize(vValues));
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
|
|||
|
|
@ -23433,7 +23433,7 @@ int Abc_CommandSymFun( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
else
|
||||
printf( "Generated truth table of the %d-variable function (%s) and set it as the current network\n", nVars, pTruth );
|
||||
}
|
||||
else
|
||||
else if ( nVars <= 8 )
|
||||
printf( "%s\n", pTruth );
|
||||
// read the truth table to be the current network in ABC
|
||||
pCommand = ABC_CALLOC( char, strlen(pTruth) + 100 );
|
||||
|
|
@ -47436,39 +47436,11 @@ usage:
|
|||
***********************************************************************/
|
||||
int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
Gia_Man_t * pTemp = NULL;
|
||||
int c, fVerbose = 0;
|
||||
int nFrames = 5;
|
||||
int fSwitch = 0;
|
||||
int nWords = 1000;
|
||||
int nProcs = 2;
|
||||
// extern Gia_Man_t * Gia_VtaTest( Gia_Man_t * p );
|
||||
// extern int Gia_ManSuppSizeTest( Gia_Man_t * p );
|
||||
// extern void Gia_VtaTest( Gia_Man_t * p, int nFramesStart, int nFramesMax, int nConfMax, int nTimeMax, int fVerbose );
|
||||
// extern void Gia_IsoTest( Gia_Man_t * p, int fVerbose );
|
||||
// extern void Ga2_ManComputeTest( Gia_Man_t * p );
|
||||
// extern void Bmc_CexTest( Gia_Man_t * p, Abc_Cex_t * pCex, int fVerbose );
|
||||
// extern void Gia_IsoTest( Gia_Man_t * p, Abc_Cex_t * pCex, int fVerbose );
|
||||
// extern void Unr_ManTest( Gia_Man_t * pGia, int nFrames );
|
||||
// extern int Gia_ManVerify( Gia_Man_t * pGia );
|
||||
// extern Gia_Man_t * Gia_ManOptimizeRing( Gia_Man_t * p );
|
||||
// extern void Gia_ManCollectSeqTest( Gia_Man_t * p );
|
||||
// extern Gia_Man_t * Gia_SweeperFraigTest( Gia_Man_t * p, int nWords, int nConfs, int fVerbose );
|
||||
// extern Gia_Man_t * Bmc_CexDepthTest( Gia_Man_t * p, Abc_Cex_t * pCex, int nFrames, int fVerbose );
|
||||
// extern Gia_Man_t * Bmc_CexTarget( Gia_Man_t * p, int nFrames );
|
||||
// extern void Gia_ManMuxProfiling( Gia_Man_t * p );
|
||||
// extern Gia_Man_t * Mig_ManTest( Gia_Man_t * pGia );
|
||||
// extern Gia_Man_t * Gia_ManInterTest( Gia_Man_t * p );
|
||||
// extern Gia_Man_t * Llb_ReachableStatesGia( Gia_Man_t * p );
|
||||
// extern Gia_Man_t * Unm_ManTest( Gia_Man_t * pGia );
|
||||
// extern void Agi_ManTest( Gia_Man_t * pGia );
|
||||
// extern void Gia_ManCheckFalseTest( Gia_Man_t * p, int nSlackMax );
|
||||
// extern void Gia_ParTest( Gia_Man_t * p, int nWords, int nProcs );
|
||||
// extern void Gia_ManTisTest( Gia_Man_t * pInit );
|
||||
// extern void Gia_StoComputeCuts( Gia_Man_t * p );
|
||||
// extern void Abc_BddGiaTest( Gia_Man_t * pGia, int fVerbose );
|
||||
extern Gia_Man_t * Dau_ConstructAigFromFile( char * pFileName );
|
||||
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "WPFsvh" ) ) != EOF )
|
||||
{
|
||||
|
|
@ -47524,70 +47496,7 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// Abc_Print( -1, "Abc_CommandAbc9Test(): There is no AIG.\n" );
|
||||
// return 1;
|
||||
// }
|
||||
/*
|
||||
if ( pAbc->pCex == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Abc_CommandAbc9Test(): There is no CEX.\n" );
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
// Gia_ManFrontTest( pAbc->pGia );
|
||||
// Gia_ManReduceConst( pAbc->pGia, 1 );
|
||||
// Sat_ManTest( pAbc->pGia, Gia_ManCo(pAbc->pGia, 0), 0 );
|
||||
// Gia_ManTestDistance( pAbc->pGia );
|
||||
// Gia_SatSolveTest( pAbc->pGia );
|
||||
// For_ManExperiment( pAbc->pGia, 20, 1, 1 );
|
||||
// Gia_ManUnrollSpecial( pAbc->pGia, 5, 100, 1 );
|
||||
// pAbc->pGia = Gia_ManDupSelf( pTemp = pAbc->pGia );
|
||||
// pAbc->pGia = Gia_ManRemoveEnables( pTemp = pAbc->pGia );
|
||||
// Cbs_ManSolveTest( pAbc->pGia );
|
||||
// pAbc->pGia = Gia_VtaTest( pTemp = pAbc->pGia );
|
||||
// Gia_ManStopP( &pTemp );
|
||||
// Gia_ManSuppSizeTest( pAbc->pGia );
|
||||
// Gia_VtaTest( pAbc->pGia, 10, 100000, 0, 0, 1 );
|
||||
// Gia_IsoTest( pAbc->pGia, fVerbose );
|
||||
// Ga2_ManComputeTest( pAbc->pGia );
|
||||
// Bmc_CexTest( pAbc->pGia, pAbc->pCex, fVerbose );
|
||||
// Gia_IsoTest( pAbc->pGia, pAbc->pCex, 0 );
|
||||
// Unr_ManTest( pAbc->pGia, nFrames );
|
||||
// Gia_ManVerifyWithBoxes( pAbc->pGia );
|
||||
// Gia_ManCollectSeqTest( pAbc->pGia );
|
||||
// pTemp = Gia_ManOptimizeRing( pAbc->pGia );
|
||||
// pTemp = Gia_SweeperFraigTest( pAbc->pGia, 4, 1000, 0 );
|
||||
// Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
// pTemp = Bmc_CexDepthTest( pAbc->pGia, pAbc->pCex, nFrames, fVerbose );
|
||||
// pTemp = Bmc_CexTarget( pAbc->pGia, nFrames );
|
||||
// Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
// Gia_ManMuxProfiling( pAbc->pGia );
|
||||
// pTemp = Mig_ManTest( pAbc->pGia );
|
||||
// Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
// pTemp = Gia_ManInterTest( pAbc->pGia );
|
||||
// Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
// pTemp = Llb_ReachableStatesGia( pAbc->pGia );
|
||||
// Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
// Unm_ManTest( pAbc->pGia );
|
||||
// Agi_ManTest( pAbc->pGia );
|
||||
// Gia_ManResubTest( pAbc->pGia );
|
||||
// Jf_ManTestCnf( pAbc->pGia );
|
||||
// Gia_ManCheckFalseTest( pAbc->pGia, nFrames );
|
||||
// Gia_ParTest( pAbc->pGia, nWords, nProcs );
|
||||
// Gia_StoComputeCuts( pAbc->pGia );
|
||||
// printf( "\nThis command is currently disabled.\n\n" );
|
||||
/*
|
||||
{
|
||||
char Buffer[10];
|
||||
extern void Gia_DumpLutSizeDistrib( Gia_Man_t * p, char * pFileName );
|
||||
sprintf( Buffer, "stats%d.txt", nFrames );
|
||||
if ( pAbc->pGia )
|
||||
Gia_DumpLutSizeDistrib( pAbc->pGia, Buffer );
|
||||
}
|
||||
*/
|
||||
// pTemp = Slv_ManToAig( pAbc->pGia );
|
||||
// Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
// Extra_TestGia2( pAbc->pGia );
|
||||
//pTemp = Dau_ConstructAigFromFile( "lib4var2.txt" );
|
||||
//Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
//Gia_Sim5TestPolarities( pAbc->pGia );
|
||||
// Abc_FrameUpdateGia( pAbc, Abc_Procedure(pAbc->pGia) );
|
||||
return 0;
|
||||
usage:
|
||||
Abc_Print( -2, "usage: &test [-FW num] [-svh]\n" );
|
||||
|
|
|
|||
Loading…
Reference in New Issue