ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bacBlast.c File Reference
#include "bac.h"
#include "base/abc/abc.h"
#include "map/mio/mio.h"
#include "bool/dec/dec.h"
#include "base/main/mainInt.h"
Include dependency graph for bacBlast.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Bac_ManPrepareGates (Bac_Man_t *p)
 DECLARATIONS ///.
 
void Bac_ManUndoGates (Bac_Man_t *p)
 
int Bac_ManAddBarbuf (Gia_Man_t *pNew, int iRes, Bac_Man_t *p, int iLNtk, int iLObj, int iRNtk, int iRObj, Vec_Int_t *vMap)
 
int Bac_ManExtract_rec (Gia_Man_t *pNew, Bac_Ntk_t *p, int i, int fBuffers, Vec_Int_t *vMap)
 
Gia_Man_tBac_ManExtract (Bac_Man_t *p, int fBuffers, int fVerbose)
 
void Bac_ManMarkNodesGia (Bac_Man_t *p, Gia_Man_t *pGia)
 
void Bac_ManRemapBarbufs (Bac_Man_t *pNew, Bac_Man_t *p)
 
void Bac_NtkCreateAndConnectBuffer (Gia_Man_t *pGia, Gia_Obj_t *pObj, Bac_Ntk_t *p, int iTerm)
 
void Bac_NtkInsertGia (Bac_Man_t *p, Gia_Man_t *pGia)
 
Bac_Man_tBac_ManInsertGia (Bac_Man_t *p, Gia_Man_t *pGia)
 
Bac_Man_tBac_ManBlastTest (Bac_Man_t *p)
 
void Bac_ManMarkNodesAbc (Bac_Man_t *p, Abc_Ntk_t *pNtk)
 
void Bac_NtkCreateOrConnectFanin (Abc_Obj_t *pFanin, Bac_Ntk_t *p, int iTerm)
 
void Bac_NtkPrepareLibrary (Bac_Man_t *p, Mio_Library_t *pLib)
 
int Bac_NtkBuildLibrary (Bac_Man_t *p)
 
void Bac_NtkInsertNtk (Bac_Man_t *p, Abc_Ntk_t *pNtk)
 
void * Bac_ManInsertAbc (Bac_Man_t *p, void *pAbc)
 

Function Documentation

◆ Bac_ManAddBarbuf()

int Bac_ManAddBarbuf ( Gia_Man_t * pNew,
int iRes,
Bac_Man_t * p,
int iLNtk,
int iLObj,
int iRNtk,
int iRObj,
Vec_Int_t * vMap )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file bacBlast.c.

88{
89 int iBufLit, iIdLit;
90 if ( iRes == 0 || iRes == 1 )
91 return iRes;
92 assert( iRes > 0 );
93 if ( vMap && Abc_Lit2Var(iRes) < Vec_IntSize(vMap) && (iIdLit = Vec_IntEntry(vMap, Abc_Lit2Var(iRes))) >= 0 &&
94 Vec_IntEntry(&p->vBuf2LeafNtk, Abc_Lit2Var(iIdLit)) == iLNtk && Vec_IntEntry(&p->vBuf2RootNtk, Abc_Lit2Var(iIdLit)) == iRNtk )
95 return Abc_LitNotCond( Vec_IntEntry(pNew->vBarBufs, Abc_Lit2Var(iIdLit)), Abc_LitIsCompl(iRes) ^ Abc_LitIsCompl(iIdLit) );
96 assert( Bac_ManNtkIsOk(p, iLNtk) && Bac_ManNtkIsOk(p, iRNtk) );
97 Vec_IntPush( &p->vBuf2LeafNtk, iLNtk );
98 Vec_IntPush( &p->vBuf2LeafObj, iLObj );
99 Vec_IntPush( &p->vBuf2RootNtk, iRNtk );
100 Vec_IntPush( &p->vBuf2RootObj, iRObj );
101 iBufLit = Gia_ManAppendBuf( pNew, iRes );
102 if ( vMap )
103 {
104 Vec_IntSetEntryFull( vMap, Abc_Lit2Var(iRes), Abc_Var2Lit(Vec_IntSize(pNew->vBarBufs), Abc_LitIsCompl(iRes)) );
105 Vec_IntPush( pNew->vBarBufs, iBufLit );
106 }
107 return iBufLit;
108}
Cube * p
Definition exorList.c:222
Vec_Int_t * vBarBufs
Definition gia.h:163
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Bac_ManBlastTest()

Bac_Man_t * Bac_ManBlastTest ( Bac_Man_t * p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 420 of file bacBlast.c.

421{
422 Gia_Man_t * pGia = Bac_ManExtract( p, 1, 0 );
423 Bac_Man_t * pNew = Bac_ManInsertGia( p, pGia );
424 Gia_ManStop( pGia );
425 return pNew;
426}
Gia_Man_t * Bac_ManExtract(Bac_Man_t *p, int fBuffers, int fVerbose)
Definition bacBlast.c:216
Bac_Man_t * Bac_ManInsertGia(Bac_Man_t *p, Gia_Man_t *pGia)
Definition bacBlast.c:399
struct Bac_Man_t_ Bac_Man_t
Definition bac.h:142
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Here is the call graph for this function:

◆ Bac_ManExtract()

Gia_Man_t * Bac_ManExtract ( Bac_Man_t * p,
int fBuffers,
int fVerbose )

Definition at line 216 of file bacBlast.c.

217{
218 Bac_Ntk_t * pNtk, * pRoot = Bac_ManRoot(p);
219 Gia_Man_t * pNew, * pTemp;
220 Vec_Int_t * vMap = NULL;
221 int i, iObj;
222
223 Vec_IntClear( &p->vBuf2LeafNtk );
224 Vec_IntClear( &p->vBuf2LeafObj );
225 Vec_IntClear( &p->vBuf2RootNtk );
226 Vec_IntClear( &p->vBuf2RootObj );
227
228 Bac_ManForEachNtk( p, pNtk, i )
229 {
230 Bac_NtkDeriveIndex( pNtk );
231 Bac_NtkStartCopies( pNtk );
232 }
233
234 // start the manager
235 pNew = Gia_ManStart( Bac_ManNodeNum(p) );
236 pNew->pName = Abc_UtilStrsav(p->pName);
237 pNew->pSpec = Abc_UtilStrsav(p->pSpec);
238
239 // primary inputs
240 Bac_NtkForEachPi( pRoot, iObj, i )
241 Bac_ObjSetCopy( pRoot, iObj, Gia_ManAppendCi(pNew) );
242
243 // internal nodes
244 Gia_ManHashAlloc( pNew );
245 pNew->vBarBufs = Vec_IntAlloc( 10000 );
246 vMap = Vec_IntStartFull( 10000 );
248 Bac_NtkForEachPo( pRoot, iObj, i )
249 Bac_ManExtract_rec( pNew, pRoot, iObj, fBuffers, vMap );
251 Vec_IntFreeP( &vMap );
252 Gia_ManHashStop( pNew );
253
254 // primary outputs
255 Bac_NtkForEachPo( pRoot, iObj, i )
256 Gia_ManAppendCo( pNew, Bac_ObjCopy(pRoot, iObj) );
257 assert( Vec_IntSize(&p->vBuf2LeafNtk) == pNew->nBufs );
258
259 // cleanup
260 pNew = Gia_ManCleanup( pTemp = pNew );
261 Gia_ManStop( pTemp );
262 //Gia_ManPrintStats( pNew, NULL );
263 return pNew;
264}
int Bac_ManExtract_rec(Gia_Man_t *pNew, Bac_Ntk_t *p, int i, int fBuffers, Vec_Int_t *vMap)
Definition bacBlast.c:109
ABC_NAMESPACE_IMPL_START void Bac_ManPrepareGates(Bac_Man_t *p)
DECLARATIONS ///.
Definition bacBlast.c:48
void Bac_ManUndoGates(Bac_Man_t *p)
Definition bacBlast.c:64
struct Bac_Ntk_t_ Bac_Ntk_t
Definition bac.h:141
#define Bac_NtkForEachPi(p, iObj, i)
Definition bac.h:337
#define Bac_NtkForEachPo(p, iObj, i)
Definition bac.h:339
#define Bac_ManForEachNtk(p, pNtk, i)
MACRO DEFINITIONS ///.
Definition bac.h:334
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
char * pSpec
Definition gia.h:100
int nBufs
Definition gia.h:109
char * pName
Definition gia.h:99
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManExtract_rec()

int Bac_ManExtract_rec ( Gia_Man_t * pNew,
Bac_Ntk_t * p,
int i,
int fBuffers,
Vec_Int_t * vMap )

Definition at line 109 of file bacBlast.c.

110{
111 int iRes = Bac_ObjCopy( p, i );
112 if ( iRes >= 0 )
113 return iRes;
114 if ( Bac_ObjIsCo(p, i) )
115 iRes = Bac_ManExtract_rec( pNew, p, Bac_ObjFanin(p, i), fBuffers, vMap );
116 else if ( Bac_ObjIsPi(p, i) )
117 {
118 Bac_Ntk_t * pHost = Bac_NtkHostNtk( p );
119 int iObj = Bac_BoxBi( pHost, Bac_NtkHostObj(p), Bac_ObjIndex(p, i) );
120 iRes = Bac_ManExtract_rec( pNew, pHost, iObj, fBuffers, vMap );
121 if ( fBuffers )
122 iRes = Bac_ManAddBarbuf( pNew, iRes, p->pDesign, Bac_NtkId(p), i, Bac_NtkId(pHost), iObj, vMap );
123 }
124 else if ( Bac_ObjIsBo(p, i) )
125 {
126 int iBox = Bac_BoxBoBox(p, i);
127 if ( Bac_ObjIsBoxUser(p, iBox) ) // user box
128 {
129 Bac_Ntk_t * pBox = Bac_BoxBoNtk( p, i );
130 int iObj = Bac_NtkPo( pBox, Bac_ObjIndex(p, i) );
131 iRes = Bac_ManExtract_rec( pNew, pBox, iObj, fBuffers, vMap );
132 if ( fBuffers )
133 iRes = Bac_ManAddBarbuf( pNew, iRes, p->pDesign, Bac_NtkId(p), i, Bac_NtkId(pBox), iObj, vMap );
134 }
135 else // primitive
136 {
137 int iFanin, nLits, pLits[16];
138 assert( Bac_ObjIsBoxPrim(p, iBox) );
139 Bac_BoxForEachFanin( p, iBox, iFanin, nLits )
140 pLits[nLits] = Bac_ManExtract_rec( pNew, p, iFanin, fBuffers, vMap );
141 assert( nLits <= 16 );
142 if ( p->pDesign->ppGraphs ) // mapped gate
143 {
144 extern int Gia_ManFactorGraph( Gia_Man_t * p, Dec_Graph_t * pFForm, Vec_Int_t * vLeaves );
145 Dec_Graph_t * pGraph = (Dec_Graph_t *)p->pDesign->ppGraphs[Bac_BoxNtkId(p, iBox)];
146 Vec_Int_t Leaves = { nLits, nLits, pLits };
147 assert( pGraph != NULL );
148 return Gia_ManFactorGraph( pNew, pGraph, &Leaves );
149 }
150 else
151 {
152 Bac_ObjType_t Type = Bac_ObjType(p, iBox);
153 if ( nLits == 0 )
154 {
155 if ( Type == BAC_BOX_CF )
156 iRes = 0;
157 else if ( Type == BAC_BOX_CT )
158 iRes = 1;
159 else assert( 0 );
160 }
161 else if ( nLits == 1 )
162 {
163 if ( Type == BAC_BOX_BUF )
164 iRes = pLits[0];
165 else if ( Type == BAC_BOX_INV )
166 iRes = Abc_LitNot( pLits[0] );
167 else assert( 0 );
168 }
169 else if ( nLits == 2 )
170 {
171 if ( Type == BAC_BOX_AND )
172 iRes = Gia_ManHashAnd( pNew, pLits[0], pLits[1] );
173 else if ( Type == BAC_BOX_NAND )
174 iRes = Abc_LitNot( Gia_ManHashAnd( pNew, pLits[0], pLits[1] ) );
175 else if ( Type == BAC_BOX_OR )
176 iRes = Gia_ManHashOr( pNew, pLits[0], pLits[1] );
177 else if ( Type == BAC_BOX_NOR )
178 iRes = Abc_LitNot( Gia_ManHashOr( pNew, pLits[0], pLits[1] ) );
179 else if ( Type == BAC_BOX_XOR )
180 iRes = Gia_ManHashXor( pNew, pLits[0], pLits[1] );
181 else if ( Type == BAC_BOX_XNOR )
182 iRes = Abc_LitNot( Gia_ManHashXor( pNew, pLits[0], pLits[1] ) );
183 else if ( Type == BAC_BOX_SHARP )
184 iRes = Gia_ManHashAnd( pNew, pLits[0], Abc_LitNot(pLits[1]) );
185 else if ( Type == BAC_BOX_SHARPL )
186 iRes = Gia_ManHashAnd( pNew, Abc_LitNot(pLits[0]), pLits[1] );
187 else assert( 0 );
188 }
189 else if ( nLits == 3 )
190 {
191 if ( Type == BAC_BOX_MUX )
192 iRes = Gia_ManHashMux( pNew, pLits[0], pLits[1], pLits[2] );
193 else if ( Type == BAC_BOX_MAJ )
194 iRes = Gia_ManHashMaj( pNew, pLits[0], pLits[1], pLits[2] );
195 else if ( Type == BAC_BOX_ADD )
196 {
197 int iRes0 = Gia_ManHashAnd( pNew, pLits[1], pLits[2] );
198 int iRes1 = Gia_ManHashOr( pNew, pLits[1], pLits[2] );
199 assert( Bac_BoxBoNum(p, iBox) == 2 );
200 if ( Bac_BoxBo(p, iBox, 0) == i ) // sum
201 iRes = Gia_ManHashXor( pNew, pLits[0], Gia_ManHashAnd(pNew, Abc_LitNot(iRes0), iRes1) );
202 else if ( Bac_BoxBo(p, iBox, 1) == i ) // cout
203 iRes = Gia_ManHashOr( pNew, iRes0, Gia_ManHashAnd(pNew, pLits[0], iRes1) );
204 else assert( 0 );
205 }
206 else assert( 0 );
207 }
208 else assert( 0 );
209 }
210 }
211 }
212 else assert( 0 );
213 Bac_ObjSetCopy( p, i, iRes );
214 return iRes;
215}
int Bac_ManAddBarbuf(Gia_Man_t *pNew, int iRes, Bac_Man_t *p, int iLNtk, int iLObj, int iRNtk, int iRObj, Vec_Int_t *vMap)
Definition bacBlast.c:87
#define Bac_BoxForEachFanin(p, iBox, iFanin, i)
Definition bac.h:387
Bac_ObjType_t
INCLUDES ///.
Definition bac.h:43
@ BAC_BOX_SHARP
Definition bac.h:63
@ BAC_BOX_XNOR
Definition bac.h:62
@ BAC_BOX_AND
Definition bac.h:57
@ BAC_BOX_INV
Definition bac.h:56
@ BAC_BOX_ADD
Definition bac.h:90
@ BAC_BOX_MAJ
Definition bac.h:66
@ BAC_BOX_CT
Definition bac.h:52
@ BAC_BOX_BUF
Definition bac.h:55
@ BAC_BOX_CF
Definition bac.h:51
@ BAC_BOX_XOR
Definition bac.h:61
@ BAC_BOX_MUX
Definition bac.h:65
@ BAC_BOX_OR
Definition bac.h:59
@ BAC_BOX_NAND
Definition bac.h:58
@ BAC_BOX_SHARPL
Definition bac.h:64
@ BAC_BOX_NOR
Definition bac.h:60
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
int Gia_ManFactorGraph(Gia_Man_t *p, Dec_Graph_t *pFForm, Vec_Int_t *vLeaves)
Definition giaFx.c:99
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:621
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:668
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition giaHash.c:692
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
int Gia_ManHashMaj(Gia_Man_t *p, int iData0, int iData1, int iData2)
Definition giaHash.c:720
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManInsertAbc()

void * Bac_ManInsertAbc ( Bac_Man_t * p,
void * pAbc )

Definition at line 570 of file bacBlast.c.

571{
572 Abc_Ntk_t * pNtk = (Abc_Ntk_t *)pAbc;
573 Bac_Man_t * pNew = Bac_ManDupUserBoxes( p );
574 Bac_ManMarkNodesAbc( p, pNtk );
575 Bac_ManRemapBarbufs( pNew, p );
576 Bac_NtkInsertNtk( pNew, pNtk );
577 Bac_ManMoveNames( pNew, p );
578 return pNew;
579}
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
void Bac_ManRemapBarbufs(Bac_Man_t *pNew, Bac_Man_t *p)
Definition bacBlast.c:301
void Bac_NtkInsertNtk(Bac_Man_t *p, Abc_Ntk_t *pNtk)
Definition bacBlast.c:520
void Bac_ManMarkNodesAbc(Bac_Man_t *p, Abc_Ntk_t *pNtk)
Definition bacBlast.c:443
Here is the call graph for this function:

◆ Bac_ManInsertGia()

Bac_Man_t * Bac_ManInsertGia ( Bac_Man_t * p,
Gia_Man_t * pGia )

Definition at line 399 of file bacBlast.c.

400{
401 Bac_Man_t * pNew = Bac_ManDupUserBoxes( p );
402 Bac_ManMarkNodesGia( p, pGia );
403 Bac_ManRemapBarbufs( pNew, p );
404 Bac_NtkInsertGia( pNew, pGia );
405 Bac_ManMoveNames( pNew, p );
406 return pNew;
407}
void Bac_ManMarkNodesGia(Bac_Man_t *p, Gia_Man_t *pGia)
Definition bacBlast.c:277
void Bac_NtkInsertGia(Bac_Man_t *p, Gia_Man_t *pGia)
Definition bacBlast.c:336
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManMarkNodesAbc()

void Bac_ManMarkNodesAbc ( Bac_Man_t * p,
Abc_Ntk_t * pNtk )

Definition at line 443 of file bacBlast.c.

444{
445 Abc_Obj_t * pObj, * pFanin; int i, k, Count = 0;
446 assert( Vec_IntSize(&p->vBuf2LeafNtk) == pNtk->nBarBufs2 );
447 Abc_NtkForEachPi( pNtk, pObj, i )
448 pObj->iTemp = 1;
449 Abc_NtkForEachNode( pNtk, pObj, i )
450 {
451 if ( Abc_ObjIsBarBuf(pObj) )
452 pObj->iTemp = Vec_IntEntry( &p->vBuf2LeafNtk, Count++ );
453 else if ( Abc_NodeIsSeriousGate(pObj) )
454 {
455 pObj->iTemp = Abc_ObjFanin0(pObj)->iTemp;
456 Abc_ObjForEachFanin( pObj, pFanin, k )
457 assert( pObj->iTemp == pFanin->iTemp );
458 }
459 }
460 Abc_NtkForEachPo( pNtk, pObj, i )
461 {
462 if ( !Abc_NodeIsSeriousGate(Abc_ObjFanin0(pObj)) )
463 continue;
464 assert( Abc_ObjFanin0(pObj)->iTemp == 1 );
465 pObj->iTemp = Abc_ObjFanin0(pObj)->iTemp;
466 }
467 assert( Count == pNtk->nBarBufs2 );
468}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
int nBarBufs2
Definition abc.h:175
int iTemp
Definition abc.h:149
Here is the caller graph for this function:

◆ Bac_ManMarkNodesGia()

void Bac_ManMarkNodesGia ( Bac_Man_t * p,
Gia_Man_t * pGia )

Function*************************************************************

Synopsis [Mark each GIA node with the network it belongs to.]

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file bacBlast.c.

278{
279 Gia_Obj_t * pObj; int i, Count = 0;
280 assert( Vec_IntSize(&p->vBuf2LeafNtk) == Gia_ManBufNum(pGia) );
281 Gia_ManConst0(pGia)->Value = 1;
282 Gia_ManForEachPi( pGia, pObj, i )
283 pObj->Value = 1;
284 Gia_ManForEachAnd( pGia, pObj, i )
285 {
286 if ( Gia_ObjIsBuf(pObj) )
287 pObj->Value = Vec_IntEntry( &p->vBuf2LeafNtk, Count++ );
288 else
289 {
290 pObj->Value = Gia_ObjFanin0(pObj)->Value;
291 assert( pObj->Value == Gia_ObjFanin1(pObj)->Value );
292 }
293 }
294 assert( Count == Gia_ManBufNum(pGia) );
295 Gia_ManForEachPo( pGia, pObj, i )
296 {
297 assert( Gia_ObjFanin0(pObj)->Value == 1 );
298 pObj->Value = 1;
299 }
300}
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
unsigned Value
Definition gia.h:89
Here is the caller graph for this function:

◆ Bac_ManPrepareGates()

ABC_NAMESPACE_IMPL_START void Bac_ManPrepareGates ( Bac_Man_t * p)

DECLARATIONS ///.

CFile****************************************************************

FileName [bacBlast.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchical word-level netlist.]

Synopsis [Bit-blasting of the netlist.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 29, 2014.]

Revision [

Id
bacBlast.c,v 1.00 2014/11/29 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file bacBlast.c.

49{
50 Dec_Graph_t ** ppGraphs; int i;
51 if ( p->pMioLib == NULL )
52 return;
53 ppGraphs = ABC_CALLOC( Dec_Graph_t *, Abc_NamObjNumMax(p->pMods) );
54 for ( i = 1; i < Abc_NamObjNumMax(p->pMods); i++ )
55 {
56 char * pGateName = Abc_NamStr( p->pMods, i );
57 Mio_Gate_t * pGate = Mio_LibraryReadGateByName( (Mio_Library_t *)p->pMioLib, pGateName, NULL );
58 if ( pGate != NULL )
59 ppGraphs[i] = Dec_Factor( Mio_GateReadSop(pGate) );
60 }
61 assert( p->ppGraphs == NULL );
62 p->ppGraphs = (void **)ppGraphs;
63}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
Dec_Graph_t * Dec_Factor(char *pSop)
FUNCTION DECLARATIONS ///.
Definition decFactor.c:58
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Definition mioApi.c:179
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition mioApi.c:105
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
int Abc_NamObjNumMax(Abc_Nam_t *p)
Definition utilNam.c:231
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition utilNam.c:555
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManRemapBarbufs()

void Bac_ManRemapBarbufs ( Bac_Man_t * pNew,
Bac_Man_t * p )

Definition at line 301 of file bacBlast.c.

302{
303 Bac_Ntk_t * pNtk; int Entry, i;
304 //assert( Vec_IntSize(&p->vBuf2RootNtk) );
305 assert( !Vec_IntSize(&pNew->vBuf2RootNtk) );
306 Vec_IntAppend( &pNew->vBuf2RootNtk, &p->vBuf2RootNtk );
307 Vec_IntAppend( &pNew->vBuf2RootObj, &p->vBuf2RootObj );
308 Vec_IntAppend( &pNew->vBuf2LeafNtk, &p->vBuf2LeafNtk );
309 Vec_IntAppend( &pNew->vBuf2LeafObj, &p->vBuf2LeafObj );
310 Vec_IntForEachEntry( &p->vBuf2LeafObj, Entry, i )
311 {
312 pNtk = Bac_ManNtk( p, Vec_IntEntry(&p->vBuf2LeafNtk, i) );
313 Vec_IntWriteEntry( &pNew->vBuf2LeafObj, i, Bac_ObjCopy(pNtk, Entry) );
314 }
315 Vec_IntForEachEntry( &p->vBuf2RootObj, Entry, i )
316 {
317 pNtk = Bac_ManNtk( p, Vec_IntEntry(&p->vBuf2RootNtk, i) );
318 Vec_IntWriteEntry( &pNew->vBuf2RootObj, i, Bac_ObjCopy(pNtk, Entry) );
319 }
320}
Vec_Int_t vBuf2LeafObj
Definition bac.h:188
Vec_Int_t vBuf2LeafNtk
Definition bac.h:187
Vec_Int_t vBuf2RootObj
Definition bac.h:186
Vec_Int_t vBuf2RootNtk
Definition bac.h:185
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ Bac_ManUndoGates()

void Bac_ManUndoGates ( Bac_Man_t * p)

Definition at line 64 of file bacBlast.c.

65{
66 int i;
67 if ( p->pMioLib == NULL )
68 return;
69 for ( i = 1; i < Abc_NamObjNumMax(p->pMods); i++ )
70 if ( p->ppGraphs[i] )
71 Dec_GraphFree( (Dec_Graph_t *)p->ppGraphs[i] );
72 ABC_FREE( p->ppGraphs );
73}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkBuildLibrary()

int Bac_NtkBuildLibrary ( Bac_Man_t * p)

Definition at line 509 of file bacBlast.c.

510{
511 int RetValue = 1;
513 if ( pLib == NULL )
514 printf( "The standard cell library is not available.\n" ), RetValue = 0;
515 else
516 Bac_NtkPrepareLibrary( p, pLib );
517 p->pMioLib = pLib;
518 return RetValue;
519}
void Bac_NtkPrepareLibrary(Bac_Man_t *p, Mio_Library_t *pLib)
Definition bacBlast.c:490
ABC_DLL void * Abc_FrameReadLibGen()
Definition mainFrame.c:59
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkCreateAndConnectBuffer()

void Bac_NtkCreateAndConnectBuffer ( Gia_Man_t * pGia,
Gia_Obj_t * pObj,
Bac_Ntk_t * p,
int iTerm )

Definition at line 321 of file bacBlast.c.

322{
323 int iObj;
324 if ( pGia && Gia_ObjFaninId0p(pGia, pObj) > 0 )
325 {
326 iObj = Bac_ObjAlloc( p, BAC_OBJ_BI, Gia_ObjFanin0(pObj)->Value );
327 Bac_ObjAlloc( p, Gia_ObjFaninC0(pObj) ? BAC_BOX_INV : BAC_BOX_BUF, -1 );
328 }
329 else
330 {
331 Bac_ObjAlloc( p, pGia && Gia_ObjFaninC0(pObj) ? BAC_BOX_CT : BAC_BOX_CF, -1 );
332 }
333 iObj = Bac_ObjAlloc( p, BAC_OBJ_BO, -1 );
334 Bac_ObjSetFanin( p, iTerm, iObj );
335}
@ BAC_OBJ_BI
Definition bac.h:47
@ BAC_OBJ_BO
Definition bac.h:48
Here is the caller graph for this function:

◆ Bac_NtkCreateOrConnectFanin()

void Bac_NtkCreateOrConnectFanin ( Abc_Obj_t * pFanin,
Bac_Ntk_t * p,
int iTerm )

Definition at line 469 of file bacBlast.c.

470{
471 int iObj;
472 if ( pFanin && Abc_NodeIsSeriousGate(pFanin) )//&& Bac_ObjName(p, pFanin->iTemp) == -1 ) // gate without name
473 {
474 iObj = pFanin->iTemp;
475 }
476 else if ( pFanin && (Abc_ObjIsPi(pFanin) || Abc_ObjIsBarBuf(pFanin) || Abc_NodeIsSeriousGate(pFanin)) ) // PI/BO or gate with name
477 {
478 iObj = Bac_ObjAlloc( p, BAC_OBJ_BI, pFanin->iTemp );
479 Bac_ObjAlloc( p, BAC_BOX_GATE, p->pDesign->ElemGates[2] ); // buffer
480 iObj = Bac_ObjAlloc( p, BAC_OBJ_BO, -1 );
481 }
482 else
483 {
484 assert( !pFanin || Abc_NodeIsConst0(pFanin) || Abc_NodeIsConst1(pFanin) );
485 Bac_ObjAlloc( p, BAC_BOX_GATE, p->pDesign->ElemGates[(pFanin && Abc_NodeIsConst1(pFanin))] ); // const 0/1
486 iObj = Bac_ObjAlloc( p, BAC_OBJ_BO, -1 );
487 }
488 Bac_ObjSetFanin( p, iTerm, iObj );
489}
ABC_DLL int Abc_NodeIsConst0(Abc_Obj_t *pNode)
Definition abcObj.c:884
ABC_DLL int Abc_NodeIsConst1(Abc_Obj_t *pNode)
Definition abcObj.c:916
@ BAC_BOX_GATE
Definition bac.h:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkInsertGia()

void Bac_NtkInsertGia ( Bac_Man_t * p,
Gia_Man_t * pGia )

Definition at line 336 of file bacBlast.c.

337{
338 Bac_Ntk_t * pNtk, * pRoot = Bac_ManRoot( p );
339 int i, j, k, iBox, iTerm, Count = 0;
340 Gia_Obj_t * pObj;
341
342 Gia_ManConst0(pGia)->Value = ~0;
343 Gia_ManForEachPi( pGia, pObj, i )
344 pObj->Value = Bac_NtkPi( pRoot, i );
345 Gia_ManForEachAnd( pGia, pObj, i )
346 {
347 if ( Gia_ObjIsBuf(pObj) )
348 {
349 pNtk = Bac_ManNtk( p, Vec_IntEntry(&p->vBuf2RootNtk, Count) );
350 iTerm = Vec_IntEntry( &p->vBuf2RootObj, Count );
351 assert( Bac_ObjIsCo(pNtk, iTerm) );
352 if ( Bac_ObjFanin(pNtk, iTerm) == -1 ) // not a feedthrough
353 Bac_NtkCreateAndConnectBuffer( pGia, pObj, pNtk, iTerm );
354 // prepare leaf
355 pObj->Value = Vec_IntEntry( &p->vBuf2LeafObj, Count++ );
356 }
357 else
358 {
359 int iLit0 = Gia_ObjFanin0(pObj)->Value;
360 int iLit1 = Gia_ObjFanin1(pObj)->Value;
361 Bac_ObjType_t Type;
362 pNtk = Bac_ManNtk( p, pObj->Value );
363 if ( Gia_ObjFaninC0(pObj) && Gia_ObjFaninC1(pObj) )
364 Type = BAC_BOX_NOR;
365 else if ( Gia_ObjFaninC1(pObj) )
366 Type = BAC_BOX_SHARP;
367 else if ( Gia_ObjFaninC0(pObj) )
368 {
369 Type = BAC_BOX_SHARP;
370 ABC_SWAP( int, iLit0, iLit1 );
371 }
372 else
373 Type = BAC_BOX_AND;
374 // create box
375 iTerm = Bac_ObjAlloc( pNtk, BAC_OBJ_BI, iLit1 );
376 iTerm = Bac_ObjAlloc( pNtk, BAC_OBJ_BI, iLit0 );
377 Bac_ObjAlloc( pNtk, Type, -1 );
378 pObj->Value = Bac_ObjAlloc( pNtk, BAC_OBJ_BO, -1 );
379 }
380 }
381 assert( Count == Gia_ManBufNum(pGia) );
382
383 // create constant 0 drivers for COs without barbufs
384 Bac_ManForEachNtk( p, pNtk, i )
385 {
386 Bac_NtkForEachBox( pNtk, iBox )
387 Bac_BoxForEachBi( pNtk, iBox, iTerm, j )
388 if ( Bac_ObjFanin(pNtk, iTerm) == -1 )
389 Bac_NtkCreateAndConnectBuffer( NULL, NULL, pNtk, iTerm );
390 Bac_NtkForEachPo( pNtk, iTerm, k )
391 if ( pNtk != pRoot && Bac_ObjFanin(pNtk, iTerm) == -1 )
392 Bac_NtkCreateAndConnectBuffer( NULL, NULL, pNtk, iTerm );
393 }
394 // create node and connect POs
395 Gia_ManForEachPo( pGia, pObj, i )
396 if ( Bac_ObjFanin(pRoot, Bac_NtkPo(pRoot, i)) == -1 ) // not a feedthrough
397 Bac_NtkCreateAndConnectBuffer( pGia, pObj, pRoot, Bac_NtkPo(pRoot, i) );
398}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
void Bac_NtkCreateAndConnectBuffer(Gia_Man_t *pGia, Gia_Obj_t *pObj, Bac_Ntk_t *p, int iTerm)
Definition bacBlast.c:321
#define Bac_BoxForEachBi(p, iBox, iTerm, i)
Definition bac.h:375
#define Bac_NtkForEachBox(p, i)
Definition bac.h:354
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkInsertNtk()

void Bac_NtkInsertNtk ( Bac_Man_t * p,
Abc_Ntk_t * pNtk )

Definition at line 520 of file bacBlast.c.

521{
522 Bac_Ntk_t * pCbaNtk, * pRoot = Bac_ManRoot( p );
523 int i, j, k, iBox, iTerm, Count = 0;
524 Abc_Obj_t * pObj;
525 assert( Abc_NtkHasMapping(pNtk) );
527 p->pMioLib = pNtk->pManFunc;
528
529 Abc_NtkForEachPi( pNtk, pObj, i )
530 pObj->iTemp = Bac_NtkPi( pRoot, i );
531 Abc_NtkForEachNode( pNtk, pObj, i )
532 {
533 if ( Abc_ObjIsBarBuf(pObj) )
534 {
535 pCbaNtk = Bac_ManNtk( p, Vec_IntEntry(&p->vBuf2RootNtk, Count) );
536 iTerm = Vec_IntEntry( &p->vBuf2RootObj, Count );
537 assert( Bac_ObjIsCo(pCbaNtk, iTerm) );
538 if ( Bac_ObjFanin(pCbaNtk, iTerm) == -1 ) // not a feedthrough
539 Bac_NtkCreateOrConnectFanin( Abc_ObjFanin0(pObj), pCbaNtk, iTerm );
540 // prepare leaf
541 pObj->iTemp = Vec_IntEntry( &p->vBuf2LeafObj, Count++ );
542 }
543 else if ( Abc_NodeIsSeriousGate(pObj) )
544 {
545 pCbaNtk = Bac_ManNtk( p, pObj->iTemp );
546 for ( k = Abc_ObjFaninNum(pObj)-1; k >= 0; k-- )
547 iTerm = Bac_ObjAlloc( pCbaNtk, BAC_OBJ_BI, Abc_ObjFanin(pObj, k)->iTemp );
548 Bac_ObjAlloc( pCbaNtk, BAC_BOX_GATE, Abc_NamStrFind(p->pMods, Mio_GateReadName((Mio_Gate_t *)pObj->pData)) );
549 pObj->iTemp = Bac_ObjAlloc( pCbaNtk, BAC_OBJ_BO, -1 );
550 }
551 }
552 assert( Count == pNtk->nBarBufs2 );
553
554 // create constant 0 drivers for COs without barbufs
555 Bac_ManForEachNtk( p, pCbaNtk, i )
556 {
557 Bac_NtkForEachBox( pCbaNtk, iBox )
558 Bac_BoxForEachBi( pCbaNtk, iBox, iTerm, j )
559 if ( Bac_ObjFanin(pCbaNtk, iTerm) == -1 )
560 Bac_NtkCreateOrConnectFanin( NULL, pCbaNtk, iTerm );
561 Bac_NtkForEachPo( pCbaNtk, iTerm, k )
562 if ( pCbaNtk != pRoot && Bac_ObjFanin(pCbaNtk, iTerm) == -1 )
563 Bac_NtkCreateOrConnectFanin( NULL, pCbaNtk, iTerm );
564 }
565 // create node and connect POs
566 Abc_NtkForEachPo( pNtk, pObj, i )
567 if ( Bac_ObjFanin(pRoot, Bac_NtkPo(pRoot, i)) == -1 ) // not a feedthrough
568 Bac_NtkCreateOrConnectFanin( Abc_ObjFanin0(pObj), pRoot, Bac_NtkPo(pRoot, i) );
569}
void Bac_NtkCreateOrConnectFanin(Abc_Obj_t *pFanin, Bac_Ntk_t *p, int iTerm)
Definition bacBlast.c:469
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition mioApi.c:169
void * pManFunc
Definition abc.h:191
void * pData
Definition abc.h:145
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
Definition utilNam.c:433
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkPrepareLibrary()

void Bac_NtkPrepareLibrary ( Bac_Man_t * p,
Mio_Library_t * pLib )

Definition at line 490 of file bacBlast.c.

491{
492 Mio_Gate_t * pGate;
493 Mio_Gate_t * pGate0 = Mio_LibraryReadConst0( pLib );
494 Mio_Gate_t * pGate1 = Mio_LibraryReadConst1( pLib );
495 Mio_Gate_t * pGate2 = Mio_LibraryReadBuf( pLib );
496 if ( !pGate0 || !pGate1 || !pGate2 )
497 {
498 printf( "The library does not have one of the elementary gates.\n" );
499 return;
500 }
501 p->ElemGates[0] = Abc_NamStrFindOrAdd( p->pMods, Mio_GateReadName(pGate0), NULL );
502 p->ElemGates[1] = Abc_NamStrFindOrAdd( p->pMods, Mio_GateReadName(pGate1), NULL );
503 p->ElemGates[2] = Abc_NamStrFindOrAdd( p->pMods, Mio_GateReadName(pGate2), NULL );
504 Mio_LibraryForEachGate( pLib, pGate )
505 if ( pGate != pGate0 && pGate != pGate1 && pGate != pGate2 )
506 Abc_NamStrFindOrAdd( p->pMods, Mio_GateReadName(pGate), NULL );
507 assert( Abc_NamObjNumMax(p->pMods) > 1 );
508}
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
Definition mioApi.c:51
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition mio.h:81
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Definition mioApi.c:52
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition mioApi.c:49
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition utilNam.c:453
Here is the call graph for this function:
Here is the caller graph for this function: