Go to the source code of this file.
|
Bbl_Man_t * | Bbl_ManStart (char *pName) |
| MACRO DEFINITIONS ///. More...
|
|
void | Bbl_ManCreateObject (Bbl_Man_t *p, Bbl_Type_t Type, int ObjId, int nFanins, char *pSop) |
|
void | Bbl_ManAddFanin (Bbl_Man_t *p, int ObjId, int FaninId) |
|
int | Bbl_ManCheck (Bbl_Man_t *p) |
|
void | Bbl_ManPrintStats (Bbl_Man_t *p) |
|
void | Bbl_ManStop (Bbl_Man_t *p) |
|
void | Bbl_ManDumpBinaryBlif (Bbl_Man_t *p, char *pFileName) |
|
Bbl_Man_t * | Bbl_ManReadBinaryBlif (char *pFileName) |
|
char * | Bbl_ManName (Bbl_Man_t *p) |
|
int | Bbl_ObjIsInput (Bbl_Obj_t *p) |
|
int | Bbl_ObjIsOutput (Bbl_Obj_t *p) |
|
int | Bbl_ObjIsLut (Bbl_Obj_t *p) |
|
int | Bbl_ObjId (Bbl_Obj_t *p) |
|
int | Bbl_ObjIdOriginal (Bbl_Man_t *pMan, Bbl_Obj_t *p) |
|
int | Bbl_ObjFaninNumber (Bbl_Obj_t *p) |
|
char * | Bbl_ObjSop (Bbl_Man_t *pMan, Bbl_Obj_t *p) |
|
Bbl_Obj_t * | Bbl_ManObjFirst (Bbl_Man_t *p) |
|
Bbl_Obj_t * | Bbl_ManObjNext (Bbl_Man_t *p, Bbl_Obj_t *pObj) |
|
Bbl_Obj_t * | Bbl_ObjFaninFirst (Bbl_Obj_t *p) |
|
Bbl_Obj_t * | Bbl_ObjFaninNext (Bbl_Obj_t *p, Bbl_Obj_t *pPrev) |
|
char * | Bbl_ManTruthToSop (unsigned *pTruth, int nVars) |
|
unsigned * | Bbl_ManSopToTruth (char *pSop, int nVars) |
|
void | Bbl_ManDumpBlif (Bbl_Man_t *p, char *pFileName) |
|
void | Bbl_ManSimpleDemo () |
|
INCLUDES ///.
CFile****************************************************************
FileName [bblif.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Binary BLIF representation for logic networks.]
Synopsis [External declarations.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - February 28, 2009.]
Revision [
- Id:
- bblif.h,v 1.00 2009/02/28 00:00:00 alanmi Exp
]PARAMETERS ///BASIC TYPES ///
Enumerator |
---|
BBL_OBJ_NONE |
|
BBL_OBJ_CI |
|
BBL_OBJ_CO |
|
BBL_OBJ_NODE |
|
BBL_OBJ_VOID |
|
Definition at line 204 of file bblif.h.
void Bbl_ManAddFanin |
( |
Bbl_Man_t * |
p, |
|
|
int |
ObjId, |
|
|
int |
FaninId |
|
) |
| |
Fnction*************************************************************
Synopsis [Creates fanin/fanout relationship between two objects.]
Description []
SideEffects []
SeeAlso []
Definition at line 1023 of file bblif.c.
1030 printf(
"Bbl_ManAddFanin(): Cannot add fanin of the combinational input (Id = %d).\n", ObjId );
1036 printf(
"Bbl_ManAddFanin(): Cannot add fanout of the combinational output (Id = %d).\n", FaninId );
1040 if ( iFanin >= (
int)pObj->
nFanins )
1042 printf(
"Bbl_ManAddFanin(): Trying to add more fanins to object (Id = %d) than declared (%d).\n", ObjId, pObj->
nFanins );
1047 pObj->
pFanins[iFanin] = (
char *)pObj - (
char *)pFanin;
static Bbl_Obj_t * Bbl_ManObj(Bbl_Man_t *p, int Id)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Vec_IntEntry(Vec_Int_t *p, int i)
static int Bbl_ObjIsCo(Bbl_Obj_t *pObj)
static int Bbl_ObjIsCi(Bbl_Obj_t *pObj)
Fnction*************************************************************
Synopsis [Returns 1 if the manager was created correctly.]
Description []
SideEffects []
SeeAlso []
Definition at line 1062 of file bblif.c.
1065 int h, RetValue = 1;
1069 RetValue = 0, printf(
"Bbl_ManCheck(): Node %d does not have function specified.\n", pObj->
Id );
1071 RetValue = 0, printf(
"Bbl_ManCheck(): CI with %d has function specified.\n", pObj->
Id );
1073 RetValue = 0, printf(
"Bbl_ManCheck(): CO with %d has function specified.\n", pObj->
Id );
1075 RetValue = 0, printf(
"Bbl_ManCheck(): Object %d has less fanins (%d) than declared (%d).\n",
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define Bbl_ManForEachObj_int(p, pObj, h)
static int Bbl_ObjIsNode(Bbl_Obj_t *pObj)
static int Bbl_ObjIsCo(Bbl_Obj_t *pObj)
static int Bbl_ObjIsCi(Bbl_Obj_t *pObj)
void Bbl_ManCreateObject |
( |
Bbl_Man_t * |
p, |
|
|
Bbl_Type_t |
Type, |
|
|
int |
ObjId, |
|
|
int |
nFanins, |
|
|
char * |
pSop |
|
) |
| |
Fnction*************************************************************
Synopsis [Adds one object.]
Description []
SideEffects []
SeeAlso []
Definition at line 988 of file bblif.c.
993 printf(
"Attempting to create a combinational input with %d fanins (should be 0).\n", nFanins );
998 printf(
"Attempting to create a combinational output with %d fanins (should be 1).\n", nFanins );
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
int Bbl_ManSaveSop(Bbl_Man_t *p, char *pSop, int nVars)
char * Vec_StrFetch(Vec_Str_t *p, int nBytes)
void Bbl_ManDumpBinaryBlif |
( |
Bbl_Man_t * |
p, |
|
|
char * |
pFileName |
|
) |
| |
Fnction*************************************************************
Synopsis [Writes data into file.]
Description []
SideEffects []
SeeAlso []
Definition at line 691 of file bblif.c.
694 pFile = fopen( pFileName,
"wb" );
void Vec_StrWrite(FILE *pFile, Vec_Str_t *p)
void Bbl_ManDumpBlif |
( |
Bbl_Man_t * |
p, |
|
|
char * |
pFileName |
|
) |
| |
Fnction*************************************************************
Synopsis [Drives text BLIF file for debugging.]
Description []
SideEffects []
SeeAlso []
Definition at line 1218 of file bblif.c.
1222 pFile = fopen( pFileName,
"w" );
1223 fprintf( pFile,
"# Test file written by Bbl_ManDumpBlif() in ABC.\n" );
1229 fprintf( pFile,
".inputs %d\n",
Bbl_ObjId(pObj) );
1231 fprintf( pFile,
".outputs %d\n",
Bbl_ObjId(pObj) );
1234 fprintf( pFile,
".names" );
1236 fprintf( pFile, " %d",
Bbl_ObjId(pFanin) );
1237 fprintf( pFile, " %d\n",
Bbl_ObjId(pObj) );
1247 fprintf( pFile,
".names" );
1249 fprintf( pFile, " %d",
Bbl_ObjId(pFanin) );
1250 fprintf( pFile, " %d\n",
Bbl_ObjId(pObj) );
1251 fprintf( pFile, "1 1\n" );
1253 fprintf( pFile, ".end\n" );
int Bbl_ObjIsInput(Bbl_Obj_t *p)
char * Bbl_ManName(Bbl_Man_t *p)
int Bbl_ObjId(Bbl_Obj_t *p)
int Bbl_ObjIsLut(Bbl_Obj_t *p)
#define Bbl_ManForEachObj(p, pObj)
#define Bbl_ObjForEachFanin(pObj, pFanin)
int Bbl_ObjIsOutput(Bbl_Obj_t *p)
char * Bbl_ObjSop(Bbl_Man_t *pMan, Bbl_Obj_t *p)
Fnction*************************************************************
Synopsis [Returns the name of the design.]
Description []
SideEffects []
SeeAlso []
Definition at line 1115 of file bblif.c.
Fnction*************************************************************
Synopsis [Returns the first object.]
Description []
SideEffects []
SeeAlso []
Definition at line 1147 of file bblif.c.
static Bbl_Obj_t * Bbl_VecObj(Vec_Str_t *p, int h)
Fnction*************************************************************
Synopsis [Returns the next object.]
Description []
SideEffects []
SeeAlso []
Definition at line 1163 of file bblif.c.
1167 return (
Bbl_Obj_t *)(pNext < pEdge ? pNext : NULL);
static int Bbl_ObjSize(Bbl_Obj_t *pObj)
Fnction*************************************************************
Synopsis [Prints stats of the manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 749 of file bblif.c.
753 int h, nFuncs = 0, nNodes = 0, nObjs = 0;
758 printf( "Total objects = %7d. Total
nodes = %7d. Unique functions = %7d.\n", nObjs, nNodes, nFuncs );
759 printf( "Name manager = %5.2f MB\n", 1.0*
Vec_StrSize(p->pName)/(1 << 20) );
760 printf( "Objs manager = %5.2f MB\n", 1.0*
Vec_StrSize(p->pObjs)/(1 << 20) );
761 printf( "Fncs manager = %5.2f MB\n", 1.0*
Vec_StrSize(p->pFncs)/(1 << 20) );
#define Bbl_ManForEachFnc_int(p, pObj, h)
#define Bbl_ManForEachObj_int(p, pObj, h)
static int Bbl_ObjIsNode(Bbl_Obj_t *pObj)
static int Vec_StrSize(Vec_Str_t *p)
Bbl_Man_t* Bbl_ManReadBinaryBlif |
( |
char * |
pFileName | ) |
|
Fnction*************************************************************
Synopsis [Creates manager after reading.]
Description []
SideEffects []
SeeAlso []
Definition at line 712 of file bblif.c.
#define BBLIF_ALLOC(type, num)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int Bbl_ManFileSize(char *pFileName)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define Bbl_ManForEachObj_int(p, pObj, h)
Vec_Str_t * Vec_StrRead(char **ppStr)
static int Vec_IntSize(Vec_Int_t *p)
char * Bbl_ManFileRead(char *pFileName)
void Bbl_ManSimpleDemo |
( |
| ) |
|
Fnction*************************************************************
Synopsis [This demo shows using the internal to construct a half-adder.]
Description [We construct the logic network for the half-adder represnted using the BLIF file below]
SideEffects []
SeeAlso []
Definition at line 1446 of file bblif.c.
void Bbl_ManAddFanin(Bbl_Man_t *p, int ObjId, int FaninId)
Bbl_Man_t * Bbl_ManStart(char *pName)
MACRO DEFINITIONS ///.
int Bbl_ManCheck(Bbl_Man_t *p)
void Bbl_ManDumpBlif(Bbl_Man_t *p, char *pFileName)
void Bbl_ManDumpBinaryBlif(Bbl_Man_t *p, char *pFileName)
void Bbl_ManStop(Bbl_Man_t *p)
void Bbl_ManCreateObject(Bbl_Man_t *p, Bbl_Type_t Type, int ObjId, int nFanins, char *pSop)
unsigned* Bbl_ManSopToTruth |
( |
char * |
pSop, |
|
|
int |
nVars |
|
) |
| |
Fnction*************************************************************
Synopsis [Converting SOP into a truth table.]
Description [The SOP is represented as a C-string, as documented in file "bblif.h". The truth table is returned as a bit-string composed of 2^nVars bits. For functions of less than 6 variables, the full machine word is returned. (The truth table looks as if the function had 5 variables.) The use of this procedure should be limited to Boolean functions with no more than 16 inputs.]
SideEffects []
SeeAlso []
Definition at line 1362 of file bblif.c.
1364 unsigned * pTruth, * pCube, * pVars[16];
1365 int nWords = nVars <= 5 ? 1 : (1 << (nVars - 5));
1366 int v, c, w, nCubes, fCompl = 0;
1369 if (
strlen(pSop) % (nVars + 3) != 0 )
1371 printf(
"Bbl_ManSopToTruth(): SOP is represented incorrectly.\n" );
1376 pVars[0] =
BBLIF_ALLOC(
unsigned, nWords * (nVars+1) );
1377 for ( v = 1; v < nVars; v++ )
1378 pVars[v] = pVars[v-1] + nWords;
1379 pCube = pVars[v-1] +
nWords;
1382 memset( pTruth, 0,
sizeof(
unsigned) * nWords );
1383 nCubes =
strlen(pSop) / (nVars + 3);
1384 for ( c = 0; c < nCubes; c++ )
1386 fCompl = (pSop[nVars+1] ==
'0');
1387 memset( pCube, 0xff,
sizeof(
unsigned) * nWords );
1389 for ( v = 0; v < nVars; v++ )
1390 if ( pSop[v] ==
'1' )
1391 for ( w = 0; w <
nWords; w++ )
1392 pCube[w] &= pVars[v][w];
1393 else if ( pSop[v] ==
'0' )
1394 for ( w = 0; w <
nWords; w++ )
1395 pCube[w] &= ~pVars[v][w];
1397 for ( w = 0; w <
nWords; w++ )
1398 pTruth[w] |= pCube[w];
1400 pSop += (nVars + 3);
1404 for ( w = 0; w <
nWords; w++ )
1405 pTruth[w] = ~pTruth[w];
#define BBLIF_ALLOC(type, num)
static void Bbl_ManSopToTruthElem(int nVars, unsigned **pVars)
MACRO DEFINITIONS ///.
FUNCTION DECLARATIONS ///
Fnction*************************************************************
Synopsis [Creates manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 806 of file bblif.c.
812 nLength = pName? 4 * ((
strlen(pName) + 1) / 4 + 1) : 0;
#define BBLIF_ALLOC(type, num)
static Vec_Str_t * Vec_StrAlloc(int nCap)
static Vec_Int_t * Vec_IntStart(int nSize)
Fnction*************************************************************
Synopsis [Deletes the manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 775 of file bblif.c.
static void Vec_StrFree(Vec_Str_t *p)
static void Vec_IntFree(Vec_Int_t *p)
char* Bbl_ManTruthToSop |
( |
unsigned * |
pTruth, |
|
|
int |
nVars |
|
) |
| |
Fnction*************************************************************
Synopsis [Converting truth table into an SOP.]
Description [The truth table is given as a bit-string pTruth composed of 2^nVars bits. The result is an SOP derived by collecting minterms appearing in the truth table. The SOP is represented as a C-string, as documented in file "bblif.h". It is recommended to limit the use of this procedure to Boolean functions up to 6 inputs.]
SideEffects []
SeeAlso []
Definition at line 1273 of file bblif.c.
1275 char * pResult, * pTemp;
1276 int nMints, nOnes, b, v;
1277 assert( nVars >= 0 && nVars <= 16 );
1278 nMints = (1 << nVars);
1281 for ( b = 0; b < nMints; b++ )
1282 nOnes += ((pTruth[b>>5] >> (b&31)) & 1);
1284 if ( nOnes == 0 || nOnes == nMints )
1287 for ( v = 0; v < nVars; v++ )
1290 *pTemp++ = nOnes?
'1' :
'0';
1293 assert( pTemp - pResult == nVars + 4 );
1296 pResult = pTemp =
BBLIF_ALLOC(
char, nOnes * (nVars + 3) + 1 );
1297 for ( b = 0; b < nMints; b++ )
1299 if ( ((pTruth[b>>5] >> (b&31)) & 1) == 0 )
1301 for ( v = 0; v < nVars; v++ )
1302 *pTemp++ = ((b >> v) & 1)?
'1' :
'0';
1308 assert( pTemp - pResult == nOnes * (nVars + 3) + 1 );
#define BBLIF_ALLOC(type, num)
Fnction*************************************************************
Synopsis [Returns the first fanin.]
Description []
SideEffects []
SeeAlso []
Definition at line 1181 of file bblif.c.
static Bbl_Obj_t * Bbl_ObjFanin(Bbl_Obj_t *pObj, int i)
static int Bbl_ObjFaninNum(Bbl_Obj_t *pObj)
Fnction*************************************************************
Synopsis [Returns the next fanin.]
Description []
SideEffects []
SeeAlso []
Definition at line 1197 of file bblif.c.
1202 if ( pFanin == pPrev )
static Bbl_Obj_t * Bbl_ObjFanin(Bbl_Obj_t *pObj, int i)
#define Bbl_ObjForEachFanin_int(pObj, pFanin, i)
static int Bbl_ObjFaninNum(Bbl_Obj_t *pObj)
Definition at line 1098 of file bblif.c.
static int Bbl_ObjFaninNum(Bbl_Obj_t *pObj)
Definition at line 1097 of file bblif.c.
static int Vec_IntEntry(Vec_Int_t *p, int i)
Fnction*************************************************************
Synopsis [Misc APIs.]
Description []
SideEffects []
SeeAlso []
Definition at line 1093 of file bblif.c.
static int Bbl_ObjIsCi(Bbl_Obj_t *pObj)
Definition at line 1095 of file bblif.c.
static int Bbl_ObjIsNode(Bbl_Obj_t *pObj)
Definition at line 1094 of file bblif.c.
static int Bbl_ObjIsCo(Bbl_Obj_t *pObj)
Definition at line 1099 of file bblif.c.
static char * Bbl_ManSop(Bbl_Man_t *p, int h)