Go to the source code of this file.
|
static ABC_NAMESPACE_IMPL_START int | Abc_TruthGetBit (word *p, int i) |
|
static void | Abc_TruthSetBit (word *p, int i) |
|
static void | Abc_TruthXorBit (word *p, int i) |
|
static int | Abc_TruthGetHex (word *p, int k) |
|
static void | Abc_TruthSetHex (word *p, int k, int d) |
|
static void | Abc_TruthXorHex (word *p, int k, int d) |
|
static int | Abc_TruthReadHexDigit (char HexChar) |
|
static void | Abc_TruthWriteHexDigit (FILE *pFile, int HexDigit) |
|
static void | Abc_TruthReadHex (word *pTruth, char *pString, int nVars) |
|
static void | Abc_TruthWriteHex (FILE *pFile, word *pTruth, int nVars) |
|
static Abc_TtStore_t * | Abc_TruthStoreAlloc (int nVars, int nFuncs) |
|
void | Abc_TruthStoreFree (Abc_TtStore_t *p) |
|
static char * | Abc_FileRead (char *pFileName) |
|
static void | Abc_TruthGetParams (char *pFileName, int *pnVars, int *pnTruths) |
|
static Abc_TtStore_t * | Abc_Create_TtSpore (char *pFileInput) |
|
static void | Abc_TruthStoreRead (char *pFileName, Abc_TtStore_t *p) |
|
static void | Abc_TruthStoreWrite (char *pFileName, Abc_TtStore_t *p) |
|
static void | WriteToFile (char *pFileName, Abc_TtStore_t *p, word *a) |
|
static void | WriteToFile1 (char *pFileName, Abc_TtStore_t *p, word **a) |
|
static void | WriteToFile2 (char *pFileName, Abc_TtStore_t *p, word *a) |
|
Abc_TtStore_t * | setTtStore (char *pFileInput) |
|
Definition at line 200 of file luckyRead.c.
static Abc_TtStore_t * Abc_TruthStoreAlloc(int nVars, int nFuncs)
static void Abc_TruthGetParams(char *pFileName, int *pnVars, int *pnTruths)
static char* Abc_FileRead |
( |
char * |
pFileName | ) |
|
|
static |
Definition at line 123 of file luckyRead.c.
129 pFile = fopen( pFileName,
"r" );
132 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
137 nFileSize = ftell( pFile );
141 pBuffer = (
char *)
malloc( nFileSize + 3 );
142 RetValue = fread( pBuffer, nFileSize, 1, pFile );
145 pBuffer[ nFileSize + 0] =
'\n';
146 pBuffer[ nFileSize + 1] =
'\n';
148 pBuffer[ nFileSize + 2] =
'\0';
CFile****************************************************************
FileName [luckyRead.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Semi-canonical form computation package.]
Synopsis [Reading truth tables from file.]
Author [Jake]
Date [Started - August 2012]
Definition at line 23 of file luckyRead.c.
23 {
return (
int)(
p[i>>6] >> (i & 63)) & 1; }
static int Abc_TruthGetHex |
( |
word * |
p, |
|
|
int |
k |
|
) |
| |
|
inlinestatic |
Definition at line 28 of file luckyRead.c.
28 {
return (
int)(
p[k>>4] >> ((k<<2) & 63)) & 15; }
static void Abc_TruthGetParams |
( |
char * |
pFileName, |
|
|
int * |
pnVars, |
|
|
int * |
pnTruths |
|
) |
| |
|
static |
Definition at line 155 of file luckyRead.c.
158 int i, nVars, nLines;
166 if ( pContents == NULL )
170 for ( i = 0; pContents[i]; i++ )
171 if ( pContents[i] ==
' ' || pContents[i] ==
'\n' || pContents[i] ==
'\r' )
173 if ( pContents[i] == 0 )
174 printf(
"Strange, the input file does not have spaces and new-lines...\n" );
177 if ( pContents[0] ==
'0' && pContents[1] ==
'x' )
181 for ( nVars = 0; nVars < 32; nVars++ )
182 if ( 4 * i == (1 << nVars) )
184 if ( nVars < 2 || nVars > 16 )
186 printf(
"Does not look like the input file contains truth tables...\n" );
194 for ( i = 0; pContents[i]; i++ )
195 nLines += (pContents[i] ==
'\n');
static char * Abc_FileRead(char *pFileName)
static void Abc_TruthReadHex |
( |
word * |
pTruth, |
|
|
char * |
pString, |
|
|
int |
nVars |
|
) |
| |
|
inlinestatic |
Definition at line 56 of file luckyRead.c.
58 int nWords = (nVars < 7)? 1 : (1 << (nVars-6));
59 int k, Digit, nDigits = (nWords << 4);
62 if ( pString[0] ==
'0' && pString[1] ==
'x' )
65 EndSymbol = pString[nDigits];
69 assert( EndSymbol ==
' ' || EndSymbol ==
'\n' || EndSymbol ==
'\r' || EndSymbol ==
'\0' );
72 for ( k = 0; k < nDigits; k++ )
75 assert( Digit >= 0 && Digit < 16 );
static int Abc_TruthReadHexDigit(char HexChar)
static void Abc_TruthSetHex(word *p, int k, int d)
static int Abc_TruthReadHexDigit |
( |
char |
HexChar | ) |
|
|
inlinestatic |
Definition at line 33 of file luckyRead.c.
35 if ( HexChar >=
'0' && HexChar <=
'9' )
37 if ( HexChar >=
'A' && HexChar <=
'F' )
38 return HexChar -
'A' + 10;
39 if ( HexChar >=
'a' && HexChar <=
'f' )
40 return HexChar -
'a' + 10;
static void Abc_TruthSetBit |
( |
word * |
p, |
|
|
int |
i |
|
) |
| |
|
inlinestatic |
Definition at line 24 of file luckyRead.c.
24 {
p[i>>6] |= (((
word)1)<<(i & 63)); }
unsigned __int64 word
DECLARATIONS ///.
static void Abc_TruthSetHex |
( |
word * |
p, |
|
|
int |
k, |
|
|
int |
d |
|
) |
| |
|
inlinestatic |
Definition at line 29 of file luckyRead.c.
29 {
p[k>>4] |= (((
word)d)<<((k<<2) & 63)); }
unsigned __int64 word
DECLARATIONS ///.
static Abc_TtStore_t* Abc_TruthStoreAlloc |
( |
int |
nVars, |
|
|
int |
nFuncs |
|
) |
| |
|
inlinestatic |
Definition at line 96 of file luckyRead.c.
102 p->
nWords = (nVars < 7) ? 1 : (1 << (nVars-6));
109 for ( i = 1; i < p->
nFuncs; i++ )
unsigned __int64 word
DECLARATIONS ///.
static void Abc_TruthStoreRead |
( |
char * |
pFileName, |
|
|
Abc_TtStore_t * |
p |
|
) |
| |
|
static |
Definition at line 210 of file luckyRead.c.
215 if ( pContents == NULL )
222 for ( nLines = i = 0; pContents[i] !=
'\n'; )
228 while ( pContents[i++] !=
'\n' );
static char * Abc_FileRead(char *pFileName)
static void Abc_TruthReadHex(word *pTruth, char *pString, int nVars)
static void Abc_TruthStoreWrite |
( |
char * |
pFileName, |
|
|
Abc_TtStore_t * |
p |
|
) |
| |
|
static |
Definition at line 239 of file luckyRead.c.
243 pFile = fopen( pFileName,
"wb" );
246 printf(
"Cannot open file \"%s\" for writing.\n", pFileName );
249 for ( i = 0; i < p->
nFuncs; i++ )
252 fprintf( pFile,
"\n" );
static void Abc_TruthWriteHex(FILE *pFile, word *pTruth, int nVars)
static void Abc_TruthWriteHex |
( |
FILE * |
pFile, |
|
|
word * |
pTruth, |
|
|
int |
nVars |
|
) |
| |
|
inlinestatic |
Definition at line 81 of file luckyRead.c.
83 int nDigits, Digit, k;
86 nDigits = (1 << (nVars-2));
87 for ( k = 0; k < nDigits; k++ )
90 assert( Digit >= 0 && Digit < 16 );
static void Abc_TruthWriteHexDigit(FILE *pFile, int HexDigit)
static int Abc_TruthGetHex(word *p, int k)
static void Abc_TruthWriteHexDigit |
( |
FILE * |
pFile, |
|
|
int |
HexDigit |
|
) |
| |
|
inlinestatic |
Definition at line 46 of file luckyRead.c.
48 assert( HexDigit >= 0 && HexDigit < 16 );
50 fprintf( pFile,
"%d", HexDigit );
52 fprintf( pFile,
"%c",
'A' + HexDigit-10 );
static void Abc_TruthXorBit |
( |
word * |
p, |
|
|
int |
i |
|
) |
| |
|
inlinestatic |
Definition at line 25 of file luckyRead.c.
25 {
p[i>>6] ^= (((
word)1)<<(i & 63)); }
unsigned __int64 word
DECLARATIONS ///.
static void Abc_TruthXorHex |
( |
word * |
p, |
|
|
int |
k, |
|
|
int |
d |
|
) |
| |
|
inlinestatic |
Definition at line 30 of file luckyRead.c.
30 {
p[k>>4] ^= (((
word)d)<<((k<<2) & 63)); }
unsigned __int64 word
DECLARATIONS ///.
Definition at line 319 of file luckyRead.c.
static Abc_TtStore_t * Abc_TruthStoreAlloc(int nVars, int nFuncs)
static void Abc_TruthGetParams(char *pFileName, int *pnVars, int *pnTruths)
static void Abc_TruthStoreRead(char *pFileName, Abc_TtStore_t *p)
Definition at line 257 of file luckyRead.c.
261 pFile = fopen( pFileName,
"w" );
264 printf(
"Cannot open file \"%s\" for writing.\n", pFileName );
267 for ( i = 0; i < p->
nFuncs; i++ )
270 fprintf( pFile,
"\n" );
static void Abc_TruthWriteHex(FILE *pFile, word *pTruth, int nVars)
Definition at line 275 of file luckyRead.c.
279 pFile = fopen( pFileName,
"w" );
282 printf(
"Cannot open file \"%s\" for writing.\n", pFileName );
285 for ( i = 0; i < p->
nFuncs; i++ )
287 fprintf( pFile,
"0" );
288 fprintf( pFile,
"x" );
289 for ( j=p->
nWords-1; j >= 0; j-- )
291 fprintf( pFile,
"\n" );
293 fprintf( pFile,
"\n" );
static void Abc_TruthWriteHex(FILE *pFile, word *pTruth, int nVars)
Definition at line 296 of file luckyRead.c.
300 pFile = fopen( pFileName,
"w" );
303 printf(
"Cannot open file \"%s\" for writing.\n", pFileName );
306 for ( i = 0; i < p->
nFuncs; i++ )
308 fprintf( pFile,
"0" );
309 fprintf( pFile,
"x" );
310 for ( j=p->
nWords-1; j >= 0; j-- )
312 fprintf( pFile,
"\n" );
314 fprintf( pFile,
"\n" );
static void Abc_TruthWriteHex(FILE *pFile, word *pTruth, int nVars)