diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2019-04-18 12:13:47 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2019-04-18 12:13:47 -0700 |
commit | dbaa6a58f880f4c19d00a4dd5992322a0e2c4a72 (patch) | |
tree | 2717e431ca54d79cf0383d7dc3f91b07977e828b /src/opt/dau/dauNpn2.c | |
parent | 3709744c60696c5e3f4cc123939921ce8107fe04 (diff) | |
download | abc-dbaa6a58f880f4c19d00a4dd5992322a0e2c4a72.tar.gz abc-dbaa6a58f880f4c19d00a4dd5992322a0e2c4a72.tar.bz2 abc-dbaa6a58f880f4c19d00a4dd5992322a0e2c4a72.zip |
Enabling dumping of the library of minimum circuits (file support).
Diffstat (limited to 'src/opt/dau/dauNpn2.c')
-rw-r--r-- | src/opt/dau/dauNpn2.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/opt/dau/dauNpn2.c b/src/opt/dau/dauNpn2.c index 7bf5e099..db6958b0 100644 --- a/src/opt/dau/dauNpn2.c +++ b/src/opt/dau/dauNpn2.c @@ -312,6 +312,7 @@ unsigned * Dau_ReadFile2( char * pFileName, int nSizeW ) { abctime clk = Abc_Clock(); FILE * pFile = fopen( pFileName, "rb" ); + if (pFile == NULL) return NULL; unsigned * p = (unsigned *)ABC_CALLOC(word, nSizeW); int RetValue = pFile ? fread( p, sizeof(word), nSizeW, pFile ) : 0; RetValue = 0; @@ -341,12 +342,19 @@ void Dtt_ManRenum( int nVars, unsigned * pTable, int * pnClasses ) } unsigned * Dtt_ManLoadClasses( int nVars, int * pnClasses ) { + extern Dau_TruthEnum(int); + unsigned * pTable = NULL; - if ( nVars == 4 ) - pTable = Dau_ReadFile2( "tableW14.data", 1 << 14 ); - else if ( nVars == 5 ) - pTable = Dau_ReadFile2( "tableW30.data", 1 << 30 ); - else assert( 0 ); + int nSizeLog = (1<<nVars) -2; + int nSizeW = 1 << nSizeLog; + char pFileName[20]; + sprintf( pFileName, "tableW%d.data", nSizeLog ); + pTable = Dau_ReadFile2( pFileName, nSizeW ); + if (pTable == NULL) + { + Dau_TruthEnum(nVars); + pTable = Dau_ReadFile2( pFileName, nSizeW ); + } Dtt_ManRenum( nVars, pTable, pnClasses ); return pTable; } |