ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
wlc.h File Reference
#include "aig/gia/gia.h"
#include "misc/extra/extra.h"
#include "misc/util/utilNam.h"
#include "misc/mem/mem.h"
#include "misc/util/utilTruth.h"
#include "base/main/mainInt.h"
Include dependency graph for wlc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Wlc_Obj_t_
 
struct  Wlc_Ntk_t_
 
struct  Wlc_Par_t_
 
struct  Wlc_BstPar_t_
 
struct  Wla_Man_t_
 

Macros

#define Wlc_NtkForEachObj(p, pObj, i)
 MACRO DEFINITIONS ///.
 
#define Wlc_NtkForEachObjReverse(p, pObj, i)
 
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
 
#define Wlc_NtkForEachPi(p, pPi, i)
 
#define Wlc_NtkForEachPo(p, pPo, i)
 
#define Wlc_NtkForEachCi(p, pCi, i)
 
#define Wlc_NtkForEachCo(p, pCo, i)
 
#define Wlc_NtkForEachFf(p, pFf, i)
 
#define Wlc_NtkForEachFf2(p, pFf, i)
 
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
 
#define Wlc_ObjForEachFaninObj(p, pObj, pFanin, i)
 
#define Wlc_ObjForEachFaninReverse(pObj, iFanin, i)
 

Typedefs

typedef struct Wlc_Obj_t_ Wlc_Obj_t
 BASIC TYPES ///.
 
typedef struct Wlc_Ntk_t_ Wlc_Ntk_t
 
typedef struct Wlc_Par_t_ Wlc_Par_t
 
typedef struct Wlc_BstPar_t_ Wlc_BstPar_t
 
typedef struct Wla_Man_t_ Wla_Man_t
 

Enumerations

enum  Wlc_ObjType_t {
  WLC_OBJ_NONE = 0 , WLC_OBJ_PI , WLC_OBJ_PO , WLC_OBJ_FO ,
  WLC_OBJ_FI , WLC_OBJ_FF , WLC_OBJ_CONST , WLC_OBJ_BUF ,
  WLC_OBJ_MUX , WLC_OBJ_SHIFT_R , WLC_OBJ_SHIFT_RA , WLC_OBJ_SHIFT_L ,
  WLC_OBJ_SHIFT_LA , WLC_OBJ_ROTATE_R , WLC_OBJ_ROTATE_L , WLC_OBJ_BIT_NOT ,
  WLC_OBJ_BIT_AND , WLC_OBJ_BIT_OR , WLC_OBJ_BIT_XOR , WLC_OBJ_BIT_NAND ,
  WLC_OBJ_BIT_NOR , WLC_OBJ_BIT_NXOR , WLC_OBJ_BIT_SELECT , WLC_OBJ_BIT_CONCAT ,
  WLC_OBJ_BIT_ZEROPAD , WLC_OBJ_BIT_SIGNEXT , WLC_OBJ_LOGIC_NOT , WLC_OBJ_LOGIC_IMPL ,
  WLC_OBJ_LOGIC_AND , WLC_OBJ_LOGIC_OR , WLC_OBJ_LOGIC_XOR , WLC_OBJ_COMP_EQU ,
  WLC_OBJ_COMP_NOTEQU , WLC_OBJ_COMP_LESS , WLC_OBJ_COMP_MORE , WLC_OBJ_COMP_LESSEQU ,
  WLC_OBJ_COMP_MOREEQU , WLC_OBJ_REDUCT_AND , WLC_OBJ_REDUCT_OR , WLC_OBJ_REDUCT_XOR ,
  WLC_OBJ_REDUCT_NAND , WLC_OBJ_REDUCT_NOR , WLC_OBJ_REDUCT_NXOR , WLC_OBJ_ARI_ADD ,
  WLC_OBJ_ARI_SUB , WLC_OBJ_ARI_MULTI , WLC_OBJ_ARI_DIVIDE , WLC_OBJ_ARI_REM ,
  WLC_OBJ_ARI_MODULUS , WLC_OBJ_ARI_POWER , WLC_OBJ_ARI_MINUS , WLC_OBJ_ARI_SQRT ,
  WLC_OBJ_ARI_SQUARE , WLC_OBJ_TABLE , WLC_OBJ_READ , WLC_OBJ_WRITE ,
  WLC_OBJ_ARI_ADDSUB , WLC_OBJ_SEL , WLC_OBJ_DEC , WLC_OBJ_LUT ,
  WLC_OBJ_NUMBER
}
 INCLUDES ///. More...
 

Functions

int Wlc_NtkAbsCore (Wlc_Ntk_t *p, Wlc_Par_t *pPars)
 FUNCTION DECLARATIONS ///.
 
int Wlc_NtkPdrAbs (Wlc_Ntk_t *p, Wlc_Par_t *pPars)
 
int Wlc_NtkAbsCore2 (Wlc_Ntk_t *p, Wlc_Par_t *pPars)
 
Gia_Man_tWlc_NtkBitBlast (Wlc_Ntk_t *p, Wlc_BstPar_t *pPars)
 
void Wlc_SetNtk (Abc_Frame_t *pAbc, Wlc_Ntk_t *pNtk)
 
Vec_Int_tWlc_NtkCollectMemory (Wlc_Ntk_t *p, int fClean)
 
void Wlc_NtkPrintMemory (Wlc_Ntk_t *p)
 
Wlc_Ntk_tWlc_NtkMemAbstractTest (Wlc_Ntk_t *p)
 
int Wlc_NtkMemAbstract (Wlc_Ntk_t *p, int nIterMax, int fDumpAbs, int fPdrVerbose, int fVerbose)
 
Wlc_Ntk_tWlc_NtkAbstractMem (Wlc_Ntk_t *p, int nFrames, int fVerbose)
 
Wlc_Ntk_tWlc_ReadNdr (char *pFileName)
 
void Wlc_WriteNdr (Wlc_Ntk_t *pNtk, char *pFileName)
 
Wlc_Ntk_tWlc_NtkFromNdr (void *pData)
 
void * Wlc_NtkToNdr (Wlc_Ntk_t *pNtk)
 
void Wlc_ManSetDefaultParams (Wlc_Par_t *pPars)
 FUNCTION DEFINITIONS ///.
 
char * Wlc_ObjTypeName (Wlc_Obj_t *p)
 
Wlc_Ntk_tWlc_NtkAlloc (char *pName, int nObjsAlloc)
 
int Wlc_ObjAlloc (Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg)
 
int Wlc_ObjCreate (Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg, Vec_Int_t *vFanins)
 
void Wlc_ObjSetCi (Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
 
void Wlc_ObjSetCo (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int fFlopInput)
 
char * Wlc_ObjName (Wlc_Ntk_t *p, int iObj)
 
void Wlc_ObjUpdateType (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int Type)
 
void Wlc_ObjAddFanins (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFanins)
 
int Wlc_ObjDup (Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
 
void Wlc_NtkFree (Wlc_Ntk_t *p)
 
int Wlc_NtkCreateLevels (Wlc_Ntk_t *p)
 
int Wlc_NtkCreateLevelsRev (Wlc_Ntk_t *p)
 
int Wlc_NtkRemapLevels (Wlc_Ntk_t *p, Vec_Int_t *vObjs, int nLevels)
 
int Wlc_NtkCountRealPis (Wlc_Ntk_t *p)
 
void Wlc_NtkPrintNode (Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
 
void Wlc_NtkPrintNodeArray (Wlc_Ntk_t *p, Vec_Int_t *vArray)
 
void Wlc_NtkPrintNodes (Wlc_Ntk_t *p, int Type)
 
void Wlc_NtkPrintStats (Wlc_Ntk_t *p, int fDistrib, int fTwoSides, int fVerbose)
 
void Wlc_NtkPrintObjects (Wlc_Ntk_t *p)
 
void Wlc_NtkTransferNames (Wlc_Ntk_t *pNew, Wlc_Ntk_t *p)
 
char * Wlc_NtkNewName (Wlc_Ntk_t *p, int iCoId, int fSeq)
 
Wlc_Ntk_tWlc_NtkDupDfs (Wlc_Ntk_t *p, int fMarked, int fSeq)
 
Wlc_Ntk_tWlc_NtkDupDfsAbs (Wlc_Ntk_t *p, Vec_Int_t *vPisOld, Vec_Int_t *vPisNew, Vec_Int_t *vFlops)
 
Wlc_Ntk_tWlc_NtkDupDfsSimple (Wlc_Ntk_t *p)
 
void Wlc_NtkCleanMarks (Wlc_Ntk_t *p)
 
void Wlc_NtkMarkCone (Wlc_Ntk_t *p, int iCoId, int Range, int fSeq, int fAllPis)
 
void Wlc_NtkProfileCones (Wlc_Ntk_t *p)
 
Wlc_Ntk_tWlc_NtkDupSingleNodes (Wlc_Ntk_t *p)
 
void Wlc_NtkShortNames (Wlc_Ntk_t *p)
 
int Wlc_NtkDcFlopNum (Wlc_Ntk_t *p)
 
void Wlc_NtkSetRefs (Wlc_Ntk_t *p)
 
int Wlc_NtkCountObjBits (Wlc_Ntk_t *p, Vec_Int_t *vPisNew)
 
Wlc_Ntk_tWlc_ReadSmtBuffer (char *pFileName, char *pBuffer, char *pLimit, int fOldParser, int fPrintTree)
 
Wlc_Ntk_tWlc_ReadSmt (char *pFileName, int fOldParser, int fPrintTree)
 
Vec_Ptr_tWlc_NtkSimulate (Wlc_Ntk_t *p, Vec_Int_t *vNodes, int nWords, int nFrames)
 
void Wlc_NtkDeleteSim (Vec_Ptr_t *p)
 
int Wlc_StdinProcessSmt (Abc_Frame_t *pAbc, char *pCmd)
 
char * Wlc_PrsConvertInitValues (Wlc_Ntk_t *p)
 
Wlc_Ntk_tWlc_ReadVer (char *pFileName, char *pStr, int fInter)
 
Vec_Int_tWlc_NtkCollectAddMult (Wlc_Ntk_t *p, Wlc_BstPar_t *pPar, int *pCountA, int *CountM)
 
int Wlc_NtkPairIsUifable (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Wlc_Obj_t *pObj2)
 
Vec_Int_tWlc_NtkCollectMultipliers (Wlc_Ntk_t *p)
 
Vec_Int_tWlc_NtkFindUifableMultiplierPairs (Wlc_Ntk_t *p)
 
Wlc_Ntk_tWlc_NtkAbstractNodes (Wlc_Ntk_t *pNtk, Vec_Int_t *vNodes)
 
Wlc_Ntk_tWlc_NtkUifNodePairs (Wlc_Ntk_t *pNtk, Vec_Int_t *vPairs)
 
void Wlc_WinProfileArith (Wlc_Ntk_t *p)
 
void Wlc_WriteVer (Wlc_Ntk_t *p, char *pFileName, int fAddCos, int fNoFlops)
 

Macro Definition Documentation

◆ Wlc_NtkForEachCi

#define Wlc_NtkForEachCi ( p,
pCi,
i )
Value:
for ( i = 0; (i < Wlc_NtkCiNum(p)) && (((pCi) = Wlc_NtkCi(p, i)), 1); i++ )
Cube * p
Definition exorList.c:222

Definition at line 366 of file wlc.h.

366#define Wlc_NtkForEachCi( p, pCi, i ) \
367 for ( i = 0; (i < Wlc_NtkCiNum(p)) && (((pCi) = Wlc_NtkCi(p, i)), 1); i++ )

◆ Wlc_NtkForEachCo

#define Wlc_NtkForEachCo ( p,
pCo,
i )
Value:
for ( i = 0; (i < Wlc_NtkCoNum(p)) && (((pCo) = Wlc_NtkCo(p, i)), 1); i++ )

Definition at line 368 of file wlc.h.

368#define Wlc_NtkForEachCo( p, pCo, i ) \
369 for ( i = 0; (i < Wlc_NtkCoNum(p)) && (((pCo) = Wlc_NtkCo(p, i)), 1); i++ )

◆ Wlc_NtkForEachFf

#define Wlc_NtkForEachFf ( p,
pFf,
i )
Value:
for ( i = 0; (i < Vec_IntSize(&p->vFfs)) && (((pFf) = Wlc_NtkFf(p, i)), 1); i++ )

Definition at line 370 of file wlc.h.

370#define Wlc_NtkForEachFf( p, pFf, i ) \
371 for ( i = 0; (i < Vec_IntSize(&p->vFfs)) && (((pFf) = Wlc_NtkFf(p, i)), 1); i++ )

◆ Wlc_NtkForEachFf2

#define Wlc_NtkForEachFf2 ( p,
pFf,
i )
Value:
for ( i = 0; (i < Vec_IntSize(&p->vFfs2)) && (((pFf) = Wlc_NtkFf2(p, i)), 1); i++ )

Definition at line 372 of file wlc.h.

372#define Wlc_NtkForEachFf2( p, pFf, i ) \
373 for ( i = 0; (i < Vec_IntSize(&p->vFfs2)) && (((pFf) = Wlc_NtkFf2(p, i)), 1); i++ )

◆ Wlc_NtkForEachObj

#define Wlc_NtkForEachObj ( p,
pObj,
i )
Value:
for ( i = 1; (i < Wlc_NtkObjNumMax(p)) && (((pObj) = Wlc_NtkObj(p, i)), 1); i++ )

MACRO DEFINITIONS ///.

ITERATORS ///

Definition at line 356 of file wlc.h.

356#define Wlc_NtkForEachObj( p, pObj, i ) \
357 for ( i = 1; (i < Wlc_NtkObjNumMax(p)) && (((pObj) = Wlc_NtkObj(p, i)), 1); i++ )

◆ Wlc_NtkForEachObjReverse

#define Wlc_NtkForEachObjReverse ( p,
pObj,
i )
Value:
for ( i = Wlc_NtkObjNumMax(p) - 1; (i > 0) && (((pObj) = Wlc_NtkObj(p, i)), 1); i-- )

Definition at line 358 of file wlc.h.

358#define Wlc_NtkForEachObjReverse( p, pObj, i ) \
359 for ( i = Wlc_NtkObjNumMax(p) - 1; (i > 0) && (((pObj) = Wlc_NtkObj(p, i)), 1); i-- )

◆ Wlc_NtkForEachObjVec

#define Wlc_NtkForEachObjVec ( vVec,
p,
pObj,
i )
Value:
for ( i = 0; (i < Vec_IntSize(vVec)) && (((pObj) = Wlc_NtkObj(p, Vec_IntEntry(vVec, i))), 1); i++ )

Definition at line 360 of file wlc.h.

360#define Wlc_NtkForEachObjVec( vVec, p, pObj, i ) \
361 for ( i = 0; (i < Vec_IntSize(vVec)) && (((pObj) = Wlc_NtkObj(p, Vec_IntEntry(vVec, i))), 1); i++ )

◆ Wlc_NtkForEachPi

#define Wlc_NtkForEachPi ( p,
pPi,
i )
Value:
for ( i = 0; (i < Wlc_NtkPiNum(p)) && (((pPi) = Wlc_NtkPi(p, i)), 1); i++ )

Definition at line 362 of file wlc.h.

362#define Wlc_NtkForEachPi( p, pPi, i ) \
363 for ( i = 0; (i < Wlc_NtkPiNum(p)) && (((pPi) = Wlc_NtkPi(p, i)), 1); i++ )

◆ Wlc_NtkForEachPo

#define Wlc_NtkForEachPo ( p,
pPo,
i )
Value:
for ( i = 0; (i < Wlc_NtkPoNum(p)) && (((pPo) = Wlc_NtkPo(p, i)), 1); i++ )

Definition at line 364 of file wlc.h.

364#define Wlc_NtkForEachPo( p, pPo, i ) \
365 for ( i = 0; (i < Wlc_NtkPoNum(p)) && (((pPo) = Wlc_NtkPo(p, i)), 1); i++ )

◆ Wlc_ObjForEachFanin

#define Wlc_ObjForEachFanin ( pObj,
iFanin,
i )
Value:
for ( i = 0; (i < Wlc_ObjFaninNum(pObj)) && (((iFanin) = Wlc_ObjFaninId(pObj, i)), 1); i++ )

Definition at line 375 of file wlc.h.

375#define Wlc_ObjForEachFanin( pObj, iFanin, i ) \
376 for ( i = 0; (i < Wlc_ObjFaninNum(pObj)) && (((iFanin) = Wlc_ObjFaninId(pObj, i)), 1); i++ )

◆ Wlc_ObjForEachFaninObj

#define Wlc_ObjForEachFaninObj ( p,
pObj,
pFanin,
i )
Value:
for ( i = 0; (i < Wlc_ObjFaninNum(pObj)) && (((pFanin) = Wlc_NtkObj(p, Wlc_ObjFaninId(pObj, i))), 1); i++ )

Definition at line 377 of file wlc.h.

377#define Wlc_ObjForEachFaninObj( p, pObj, pFanin, i ) \
378 for ( i = 0; (i < Wlc_ObjFaninNum(pObj)) && (((pFanin) = Wlc_NtkObj(p, Wlc_ObjFaninId(pObj, i))), 1); i++ )

◆ Wlc_ObjForEachFaninReverse

#define Wlc_ObjForEachFaninReverse ( pObj,
iFanin,
i )
Value:
for ( i = Wlc_ObjFaninNum(pObj) - 1; (i >= 0) && (((iFanin) = Wlc_ObjFaninId(pObj, i)), 1); i-- )

Definition at line 379 of file wlc.h.

379#define Wlc_ObjForEachFaninReverse( pObj, iFanin, i ) \
380 for ( i = Wlc_ObjFaninNum(pObj) - 1; (i >= 0) && (((iFanin) = Wlc_ObjFaninId(pObj, i)), 1); i-- )

Typedef Documentation

◆ Wla_Man_t

typedef struct Wla_Man_t_ Wla_Man_t

Definition at line 250 of file wlc.h.

◆ Wlc_BstPar_t

typedef struct Wlc_BstPar_t_ Wlc_BstPar_t

Definition at line 207 of file wlc.h.

◆ Wlc_Ntk_t

typedef struct Wlc_Ntk_t_ Wlc_Ntk_t

Definition at line 135 of file wlc.h.

◆ Wlc_Obj_t

typedef struct Wlc_Obj_t_ Wlc_Obj_t

BASIC TYPES ///.

Definition at line 118 of file wlc.h.

◆ Wlc_Par_t

typedef struct Wlc_Par_t_ Wlc_Par_t

Definition at line 178 of file wlc.h.

Enumeration Type Documentation

◆ Wlc_ObjType_t

INCLUDES ///.

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

FileName [wlc.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Verilog parser.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 22, 2014.]

Revision [

Id
wlc.h,v 1.00 2014/09/12 00:00:00 alanmi Exp

] PARAMETERS ///

Enumerator
WLC_OBJ_NONE 
WLC_OBJ_PI 
WLC_OBJ_PO 
WLC_OBJ_FO 
WLC_OBJ_FI 
WLC_OBJ_FF 
WLC_OBJ_CONST 
WLC_OBJ_BUF 
WLC_OBJ_MUX 
WLC_OBJ_SHIFT_R 
WLC_OBJ_SHIFT_RA 
WLC_OBJ_SHIFT_L 
WLC_OBJ_SHIFT_LA 
WLC_OBJ_ROTATE_R 
WLC_OBJ_ROTATE_L 
WLC_OBJ_BIT_NOT 
WLC_OBJ_BIT_AND 
WLC_OBJ_BIT_OR 
WLC_OBJ_BIT_XOR 
WLC_OBJ_BIT_NAND 
WLC_OBJ_BIT_NOR 
WLC_OBJ_BIT_NXOR 
WLC_OBJ_BIT_SELECT 
WLC_OBJ_BIT_CONCAT 
WLC_OBJ_BIT_ZEROPAD 
WLC_OBJ_BIT_SIGNEXT 
WLC_OBJ_LOGIC_NOT 
WLC_OBJ_LOGIC_IMPL 
WLC_OBJ_LOGIC_AND 
WLC_OBJ_LOGIC_OR 
WLC_OBJ_LOGIC_XOR 
WLC_OBJ_COMP_EQU 
WLC_OBJ_COMP_NOTEQU 
WLC_OBJ_COMP_LESS 
WLC_OBJ_COMP_MORE 
WLC_OBJ_COMP_LESSEQU 
WLC_OBJ_COMP_MOREEQU 
WLC_OBJ_REDUCT_AND 
WLC_OBJ_REDUCT_OR 
WLC_OBJ_REDUCT_XOR 
WLC_OBJ_REDUCT_NAND 
WLC_OBJ_REDUCT_NOR 
WLC_OBJ_REDUCT_NXOR 
WLC_OBJ_ARI_ADD 
WLC_OBJ_ARI_SUB 
WLC_OBJ_ARI_MULTI 
WLC_OBJ_ARI_DIVIDE 
WLC_OBJ_ARI_REM 
WLC_OBJ_ARI_MODULUS 
WLC_OBJ_ARI_POWER 
WLC_OBJ_ARI_MINUS 
WLC_OBJ_ARI_SQRT 
WLC_OBJ_ARI_SQUARE 
WLC_OBJ_TABLE 
WLC_OBJ_READ 
WLC_OBJ_WRITE 
WLC_OBJ_ARI_ADDSUB 
WLC_OBJ_SEL 
WLC_OBJ_DEC 
WLC_OBJ_LUT 
WLC_OBJ_NUMBER 

Definition at line 44 of file wlc.h.

44 {
45 WLC_OBJ_NONE = 0, // 00: unknown
46 WLC_OBJ_PI, // 01: primary input
47 WLC_OBJ_PO, // 02: primary output
48 WLC_OBJ_FO, // 03: flop output
49 WLC_OBJ_FI, // 04: flop input (unused)
50 WLC_OBJ_FF, // 05: flop
51 WLC_OBJ_CONST, // 06: constant
52 WLC_OBJ_BUF, // 07: buffer
53 WLC_OBJ_MUX, // 08: multiplexer
54 WLC_OBJ_SHIFT_R, // 09: shift right
55 WLC_OBJ_SHIFT_RA, // 10: shift right (arithmetic)
56 WLC_OBJ_SHIFT_L, // 11: shift left
57 WLC_OBJ_SHIFT_LA, // 12: shift left (arithmetic)
58 WLC_OBJ_ROTATE_R, // 13: rotate right
59 WLC_OBJ_ROTATE_L, // 14: rotate left
60 WLC_OBJ_BIT_NOT, // 15: bitwise NOT
61 WLC_OBJ_BIT_AND, // 16: bitwise AND
62 WLC_OBJ_BIT_OR, // 17: bitwise OR
63 WLC_OBJ_BIT_XOR, // 18: bitwise XOR
64 WLC_OBJ_BIT_NAND, // 19: bitwise NAND
65 WLC_OBJ_BIT_NOR, // 20: bitwise OR
66 WLC_OBJ_BIT_NXOR, // 21: bitwise NXOR
67 WLC_OBJ_BIT_SELECT, // 22: bit selection
68 WLC_OBJ_BIT_CONCAT, // 23: bit concatenation
69 WLC_OBJ_BIT_ZEROPAD, // 24: zero padding
70 WLC_OBJ_BIT_SIGNEXT, // 25: sign extension
71 WLC_OBJ_LOGIC_NOT, // 26: logic NOT
72 WLC_OBJ_LOGIC_IMPL, // 27: logic implication
73 WLC_OBJ_LOGIC_AND, // 28: logic AND
74 WLC_OBJ_LOGIC_OR, // 29: logic OR
75 WLC_OBJ_LOGIC_XOR, // 30: logic XOR
76 WLC_OBJ_COMP_EQU, // 31: compare equal
77 WLC_OBJ_COMP_NOTEQU, // 32: compare not equal
78 WLC_OBJ_COMP_LESS, // 33: compare less
79 WLC_OBJ_COMP_MORE, // 34: compare more
80 WLC_OBJ_COMP_LESSEQU, // 35: compare less or equal
81 WLC_OBJ_COMP_MOREEQU, // 36: compare more or equal
82 WLC_OBJ_REDUCT_AND, // 37: reduction AND
83 WLC_OBJ_REDUCT_OR, // 38: reduction OR
84 WLC_OBJ_REDUCT_XOR, // 39: reduction XOR
85 WLC_OBJ_REDUCT_NAND, // 40: reduction NAND
86 WLC_OBJ_REDUCT_NOR, // 41: reduction NOR
87 WLC_OBJ_REDUCT_NXOR, // 42: reduction NXOR
88 WLC_OBJ_ARI_ADD, // 43: arithmetic addition
89 WLC_OBJ_ARI_SUB, // 44: arithmetic subtraction
90 WLC_OBJ_ARI_MULTI, // 45: arithmetic multiplier
91 WLC_OBJ_ARI_DIVIDE, // 46: arithmetic division
92 WLC_OBJ_ARI_REM, // 47: arithmetic remainder
93 WLC_OBJ_ARI_MODULUS, // 48: arithmetic modulus
94 WLC_OBJ_ARI_POWER, // 49: arithmetic power
95 WLC_OBJ_ARI_MINUS, // 50: arithmetic minus
96 WLC_OBJ_ARI_SQRT, // 51: integer square root
97 WLC_OBJ_ARI_SQUARE, // 52: integer square
98 WLC_OBJ_TABLE, // 53: bit table
99 WLC_OBJ_READ, // 54: read port
100 WLC_OBJ_WRITE, // 55: write port
101 WLC_OBJ_ARI_ADDSUB, // 56: adder-subtractor
102 WLC_OBJ_SEL, // 57: positionally encoded selector
103 WLC_OBJ_DEC, // 58: decoder
104 WLC_OBJ_LUT, // 59: lookup table
105 WLC_OBJ_NUMBER // 59: unused
Wlc_ObjType_t
INCLUDES ///.
Definition wlc.h:44
@ WLC_OBJ_ARI_MULTI
Definition wlc.h:90
@ WLC_OBJ_PO
Definition wlc.h:47
@ WLC_OBJ_READ
Definition wlc.h:99
@ WLC_OBJ_BIT_SIGNEXT
Definition wlc.h:70
@ WLC_OBJ_COMP_LESSEQU
Definition wlc.h:80
@ WLC_OBJ_LOGIC_XOR
Definition wlc.h:75
@ WLC_OBJ_WRITE
Definition wlc.h:100
@ WLC_OBJ_SHIFT_LA
Definition wlc.h:57
@ WLC_OBJ_BIT_ZEROPAD
Definition wlc.h:69
@ WLC_OBJ_COMP_MOREEQU
Definition wlc.h:81
@ WLC_OBJ_BUF
Definition wlc.h:52
@ WLC_OBJ_COMP_MORE
Definition wlc.h:79
@ WLC_OBJ_REDUCT_AND
Definition wlc.h:82
@ WLC_OBJ_ARI_POWER
Definition wlc.h:94
@ WLC_OBJ_ARI_REM
Definition wlc.h:92
@ WLC_OBJ_ARI_SUB
Definition wlc.h:89
@ WLC_OBJ_LOGIC_OR
Definition wlc.h:74
@ WLC_OBJ_SEL
Definition wlc.h:102
@ WLC_OBJ_LOGIC_AND
Definition wlc.h:73
@ WLC_OBJ_NUMBER
Definition wlc.h:105
@ WLC_OBJ_COMP_LESS
Definition wlc.h:78
@ WLC_OBJ_ARI_SQUARE
Definition wlc.h:97
@ WLC_OBJ_REDUCT_NOR
Definition wlc.h:86
@ WLC_OBJ_BIT_NOT
Definition wlc.h:60
@ WLC_OBJ_SHIFT_R
Definition wlc.h:54
@ WLC_OBJ_TABLE
Definition wlc.h:98
@ WLC_OBJ_BIT_AND
Definition wlc.h:61
@ WLC_OBJ_CONST
Definition wlc.h:51
@ WLC_OBJ_FO
Definition wlc.h:48
@ WLC_OBJ_ARI_DIVIDE
Definition wlc.h:91
@ WLC_OBJ_REDUCT_NAND
Definition wlc.h:85
@ WLC_OBJ_NONE
Definition wlc.h:45
@ WLC_OBJ_BIT_SELECT
Definition wlc.h:67
@ WLC_OBJ_REDUCT_OR
Definition wlc.h:83
@ WLC_OBJ_MUX
Definition wlc.h:53
@ WLC_OBJ_BIT_NAND
Definition wlc.h:64
@ WLC_OBJ_ARI_ADDSUB
Definition wlc.h:101
@ WLC_OBJ_LOGIC_NOT
Definition wlc.h:71
@ WLC_OBJ_COMP_NOTEQU
Definition wlc.h:77
@ WLC_OBJ_PI
Definition wlc.h:46
@ WLC_OBJ_REDUCT_XOR
Definition wlc.h:84
@ WLC_OBJ_BIT_NOR
Definition wlc.h:65
@ WLC_OBJ_BIT_CONCAT
Definition wlc.h:68
@ WLC_OBJ_BIT_OR
Definition wlc.h:62
@ WLC_OBJ_BIT_XOR
Definition wlc.h:63
@ WLC_OBJ_ARI_MINUS
Definition wlc.h:95
@ WLC_OBJ_DEC
Definition wlc.h:103
@ WLC_OBJ_ARI_MODULUS
Definition wlc.h:93
@ WLC_OBJ_ARI_ADD
Definition wlc.h:88
@ WLC_OBJ_COMP_EQU
Definition wlc.h:76
@ WLC_OBJ_ARI_SQRT
Definition wlc.h:96
@ WLC_OBJ_LOGIC_IMPL
Definition wlc.h:72
@ WLC_OBJ_SHIFT_L
Definition wlc.h:56
@ WLC_OBJ_FI
Definition wlc.h:49
@ WLC_OBJ_REDUCT_NXOR
Definition wlc.h:87
@ WLC_OBJ_BIT_NXOR
Definition wlc.h:66
@ WLC_OBJ_ROTATE_L
Definition wlc.h:59
@ WLC_OBJ_LUT
Definition wlc.h:104
@ WLC_OBJ_SHIFT_RA
Definition wlc.h:55
@ WLC_OBJ_FF
Definition wlc.h:50
@ WLC_OBJ_ROTATE_R
Definition wlc.h:58

Function Documentation

◆ Wlc_ManSetDefaultParams()

void Wlc_ManSetDefaultParams ( Wlc_Par_t * pPars)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file wlcNtk.c.

115{
116 memset( pPars, 0, sizeof(Wlc_Par_t) );
117 pPars->nBitsAdd = ABC_INFINITY; // adder bit-width
118 pPars->nBitsMul = ABC_INFINITY; // multiplier bit-widht
119 pPars->nBitsMux = ABC_INFINITY; // MUX bit-width
120 pPars->nBitsFlop = ABC_INFINITY; // flop bit-width
121 pPars->nIterMax = 1000; // the max number of iterations
122 pPars->nLimit = ABC_INFINITY; // the max number of signals
123 pPars->fXorOutput = 1; // XOR outputs of word-level miter
124 pPars->fCheckClauses = 1; // Check clauses in the reloaded trace
125 pPars->fPushClauses = 0; // Push clauses in the reloaded trace
126 pPars->fMFFC = 1; // Refine the entire MFFC of a PPI
127 pPars->fPdra = 0; // Use pdr -nct
128 pPars->fLoadTrace = 1; // Load previous PDR traces
129 pPars->fProofRefine = 0; // Use proof-based refinement
130 pPars->fHybrid = 1; // Use a hybrid of CBR and PBR
131 pPars->fCheckCombUnsat = 0; // Check if ABS becomes comb. unsat
132 pPars->fAbs2 = 0; // Use UFAR style createAbs
133 pPars->fProofUsePPI = 0; // Use PPI values in PBR
134 pPars->fUseBmc3 = 0; // Run BMC3 in parallel
135 pPars->fShrinkAbs = 0; // Shrink Abs with BMC
136 pPars->fShrinkScratch= 0; // Restart pdr from scratch after shrinking
137 pPars->fVerbose = 0; // verbose output`
138 pPars->fPdrVerbose = 0; // show verbose PDR output
139}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
int nBitsAdd
Definition wlc.h:181
int fCheckCombUnsat
Definition wlc.h:195
int fXorOutput
Definition wlc.h:187
int fHybrid
Definition wlc.h:194
int fPdra
Definition wlc.h:191
int fAbs2
Definition wlc.h:196
int fShrinkAbs
Definition wlc.h:199
int fShrinkScratch
Definition wlc.h:200
int nBitsMul
Definition wlc.h:182
int fProofUsePPI
Definition wlc.h:197
int nIterMax
Definition wlc.h:185
int fPdrVerbose
Definition wlc.h:202
int fVerbose
Definition wlc.h:201
int fUseBmc3
Definition wlc.h:198
int nBitsMux
Definition wlc.h:183
int nBitsFlop
Definition wlc.h:184
int fPushClauses
Definition wlc.h:189
int nLimit
Definition wlc.h:186
int fCheckClauses
Definition wlc.h:188
int fLoadTrace
Definition wlc.h:192
int fProofRefine
Definition wlc.h:193
int fMFFC
Definition wlc.h:190
char * memset()
struct Wlc_Par_t_ Wlc_Par_t
Definition wlc.h:178
Here is the call graph for this function:

◆ Wlc_NtkAbsCore()

int Wlc_NtkAbsCore ( Wlc_Ntk_t * p,
Wlc_Par_t * pPars )
extern

FUNCTION DECLARATIONS ///.

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

Synopsis [Performs abstraction.]

Description [Derives initial abstraction based on user-specified parameter values, which tell what is the smallest bit-width of a primitive that is being abstracted away. Currently only add/sub, mul/div, mux, and flop are supported with individual parameters. The second step is to refine the initial abstraction until the point when the property is proved.]

SideEffects []

SeeAlso []

Definition at line 1786 of file wlcAbs.c.

1787{
1788 abctime clk = Abc_Clock();
1789 Vec_Int_t * vBlacks = NULL;
1790 int nIters, nNodes, nDcFlops, RetValue = -1;
1791 // start the bitmap to mark objects that cannot be abstracted because of refinement
1792 // currently, this bitmap is empty because abstraction begins without refinement
1793 Vec_Bit_t * vUnmark = Vec_BitStart( Wlc_NtkObjNumMax(p) );
1794 // set up parameters to run PDR
1795 Pdr_Par_t PdrPars, * pPdrPars = &PdrPars;
1796 Pdr_ManSetDefaultParams( pPdrPars );
1797 //pPdrPars->fUseAbs = 1; // use 'pdr -t' (on-the-fly abstraction)
1798 //pPdrPars->fCtgs = 1; // use 'pdr -nc' (improved generalization)
1799 //pPdrPars->fSkipDown = 0; // use 'pdr -nc' (improved generalization)
1800 //pPdrPars->nRestLimit = 500; // reset queue or proof-obligations when it gets larger than this
1801 pPdrPars->fVerbose = pPars->fPdrVerbose;
1802 pPdrPars->fVeryVerbose = 0;
1803 // perform refinement iterations
1804 for ( nIters = 1; nIters < pPars->nIterMax; nIters++ )
1805 {
1806 Aig_Man_t * pAig;
1807 Abc_Cex_t * pCex;
1808 Vec_Int_t * vPisNew, * vRefine;
1809 Gia_Man_t * pGia, * pTemp;
1810 Wlc_Ntk_t * pAbs;
1811
1812 if ( pPars->fVerbose )
1813 printf( "\nIteration %d:\n", nIters );
1814
1815 // get abstracted GIA and the set of pseudo-PIs (vPisNew)
1816 if ( pPars->fAbs2 )
1817 {
1818 if ( vBlacks == NULL )
1819 vBlacks = Wlc_NtkGetBlacks( p, pPars );
1820 else
1821 Wlc_NtkUpdateBlacks( p, pPars, &vBlacks, vUnmark, NULL );
1822 pAbs = Wlc_NtkAbs2( p, vBlacks, NULL );
1823 vPisNew = Vec_IntDup( vBlacks );
1824 }
1825 else
1826 {
1827 if ( nIters == 1 && pPars->nLimit < ABC_INFINITY )
1828 Wlc_NtkSetUnmark( p, pPars, vUnmark );
1829
1830 pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, NULL, pPars->fVerbose );
1831 }
1832 pGia = Wlc_NtkBitBlast( pAbs, NULL );
1833
1834 // if the abstraction has flops with DC-init state,
1835 // new PIs were introduced by bit-blasting at the end of the PI list
1836 // here we move these variables to be *before* PPIs, because
1837 // PPIs are supposed to be at the end of the PI list for refinement
1838 nDcFlops = Wlc_NtkDcFlopNum(pAbs);
1839 if ( nDcFlops > 0 ) // DC-init flops are present
1840 {
1841 pGia = Gia_ManPermuteInputs( pTemp = pGia, Wlc_NtkCountObjBits(p, vPisNew), nDcFlops );
1842 Gia_ManStop( pTemp );
1843 }
1844 // if the word-level outputs have to be XORs, this is a place to do it
1845 if ( pPars->fXorOutput )
1846 {
1847 pGia = Gia_ManTransformMiter2( pTemp = pGia );
1848 Gia_ManStop( pTemp );
1849 }
1850 if ( pPars->fVerbose )
1851 {
1852 printf( "Derived abstraction with %d objects and %d PPIs. Bit-blasted AIG stats are:\n", Wlc_NtkObjNum(pAbs), Vec_IntSize(vPisNew) );
1853 Gia_ManPrintStats( pGia, NULL );
1854 }
1855 Wlc_NtkFree( pAbs );
1856
1857 // try to prove abstracted GIA by converting it to AIG and calling PDR
1858 pAig = Gia_ManToAigSimple( pGia );
1859 RetValue = Pdr_ManSolve( pAig, pPdrPars );
1860 pCex = pAig->pSeqModel; pAig->pSeqModel = NULL;
1861 Aig_ManStop( pAig );
1862
1863 // consider outcomes
1864 if ( pCex == NULL )
1865 {
1866 assert( RetValue ); // proved or undecided
1867 Gia_ManStop( pGia );
1868 Vec_IntFree( vPisNew );
1869 break;
1870 }
1871
1872 // perform refinement
1873 vRefine = Wlc_NtkAbsRefinement( p, pGia, pCex, vPisNew );
1874 Gia_ManStop( pGia );
1875 Vec_IntFree( vPisNew );
1876 if ( vRefine == NULL ) // real CEX
1877 {
1878 Abc_CexFree( pCex ); // return CEX in the future
1879 break;
1880 }
1881
1882 // update the set of objects to be un-abstracted
1883 nNodes = Wlc_NtkRemoveFromAbstraction( p, vRefine, vUnmark );
1884 if ( pPars->fVerbose )
1885 printf( "Refinement of CEX in frame %d came up with %d un-abstacted PPIs, whose MFFCs include %d objects.\n", pCex->iFrame, Vec_IntSize(vRefine), nNodes );
1886 Vec_IntFree( vRefine );
1887 Abc_CexFree( pCex );
1888 }
1889 Vec_IntFreeP( &vBlacks );
1890 Vec_BitFreeP( &vUnmark );
1891 // report the result
1892 if ( pPars->fVerbose )
1893 printf( "\n" );
1894 printf( "Abstraction " );
1895 if ( RetValue == 0 )
1896 printf( "resulted in a real CEX" );
1897 else if ( RetValue == 1 )
1898 printf( "is successfully proved" );
1899 else
1900 printf( "timed out" );
1901 printf( " after %d iterations. ", nIters );
1902 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1903 return RetValue;
1904}
ABC_INT64_T abctime
Definition abc_global.h:332
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition giaAig.c:408
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManPermuteInputs(Gia_Man_t *p, int nPpis, int nExtra)
Definition giaDup.c:2758
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManTransformMiter2(Gia_Man_t *p)
Definition giaDup.c:3409
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition giaMan.c:495
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition pdrCore.c:50
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Definition pdr.h:40
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Definition pdrCore.c:1765
void Abc_CexFree(Abc_Cex_t *p)
Definition utilCex.c:382
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition vecBit.h:42
Gia_Man_t * Wlc_NtkBitBlast(Wlc_Ntk_t *p, Wlc_BstPar_t *pPars)
Definition wlcBlast.c:1349
void Wlc_NtkFree(Wlc_Ntk_t *p)
Definition wlcNtk.c:253
struct Wlc_Ntk_t_ Wlc_Ntk_t
Definition wlc.h:135
int Wlc_NtkCountObjBits(Wlc_Ntk_t *p, Vec_Int_t *vPisNew)
Definition wlcNtk.c:1395
int Wlc_NtkDcFlopNum(Wlc_Ntk_t *p)
Definition wlcNtk.c:1351
Here is the call graph for this function:

◆ Wlc_NtkAbsCore2()

int Wlc_NtkAbsCore2 ( Wlc_Ntk_t * p,
Wlc_Par_t * pPars )
extern

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

Synopsis [Performs abstraction.]

Description [Derives initial abstraction based on user-specified parameter values, which tell what is the smallest bit-width of a primitive that is being abstracted away. Currently only add/sub, mul/div, mux, and flop are supported with individual parameters. The second step is to refine the initial abstraction until the point when the property is proved.]

SideEffects []

SeeAlso []

Definition at line 302 of file wlcAbs2.c.

303{
304 abctime clk = Abc_Clock();
305 int nIters, nNodes, nDcFlops, RetValue = -1;
306 // start the bitmap to mark objects that cannot be abstracted because of refinement
307 // currently, this bitmap is empty because abstraction begins without refinement
308 Vec_Bit_t * vUnmark = Vec_BitStart( Wlc_NtkObjNumMax(p) );
309 // set up parameters to run PDR
310 Pdr_Par_t PdrPars, * pPdrPars = &PdrPars;
311 Pdr_ManSetDefaultParams( pPdrPars );
312 pPdrPars->fUseAbs = 1; // use 'pdr -t' (on-the-fly abstraction)
313 pPdrPars->fCtgs = 1; // use 'pdr -nc' (improved generalization)
314 pPdrPars->fSkipDown = 0; // use 'pdr -nc' (improved generalization)
315 //pPdrPars->nRestLimit = 500; // reset queue or proof-obligations when it gets larger than this
316 pPdrPars->fVerbose = pPars->fPdrVerbose;
317 // perform refinement iterations
318 for ( nIters = 1; nIters < pPars->nIterMax; nIters++ )
319 {
320 Aig_Man_t * pAig;
321 Abc_Cex_t * pCex;
322 Vec_Int_t * vPisNew, * vRefine;
323 Gia_Man_t * pGia, * pTemp;
324 Wlc_Ntk_t * pAbs;
325
326 if ( pPars->fVerbose )
327 printf( "\nIteration %d:\n", nIters );
328
329 // get abstracted GIA and the set of pseudo-PIs (vPisNew)
330 pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, pPars->fVerbose );
331 pGia = Wlc_NtkBitBlast( pAbs, NULL );
332
333 // if the abstraction has flops with DC-init state,
334 // new PIs were introduced by bit-blasting at the end of the PI list
335 // here we move these variables to be *before* PPIs, because
336 // PPIs are supposed to be at the end of the PI list for refinement
337 nDcFlops = Wlc_NtkDcFlopNum(pAbs);
338 if ( nDcFlops > 0 ) // DC-init flops are present
339 {
340 pGia = Gia_ManPermuteInputs( pTemp = pGia, Wlc_NtkCountObjBits(p, vPisNew), nDcFlops );
341 Gia_ManStop( pTemp );
342 }
343 // if the word-level outputs have to be XORs, this is a place to do it
344 if ( pPars->fXorOutput )
345 {
346 pGia = Gia_ManTransformMiter2( pTemp = pGia );
347 Gia_ManStop( pTemp );
348 }
349 if ( pPars->fVerbose )
350 {
351 printf( "Derived abstraction with %d objects and %d PPIs. Bit-blasted AIG stats are:\n", Wlc_NtkObjNum(pAbs), Vec_IntSize(vPisNew) );
352 Gia_ManPrintStats( pGia, NULL );
353 }
354 Wlc_NtkFree( pAbs );
355
356 // try to prove abstracted GIA by converting it to AIG and calling PDR
357 pAig = Gia_ManToAigSimple( pGia );
358 RetValue = Pdr_ManSolve( pAig, pPdrPars );
359 pCex = pAig->pSeqModel; pAig->pSeqModel = NULL;
360 Aig_ManStop( pAig );
361
362 // consider outcomes
363 if ( pCex == NULL )
364 {
365 assert( RetValue ); // proved or undecided
366 Gia_ManStop( pGia );
367 Vec_IntFree( vPisNew );
368 break;
369 }
370
371 // perform refinement
372 vRefine = Wlc_NtkAbsRefinement( p, pGia, pCex, vPisNew );
373 Gia_ManStop( pGia );
374 Vec_IntFree( vPisNew );
375 if ( vRefine == NULL ) // real CEX
376 {
377 Abc_CexFree( pCex ); // return CEX in the future
378 break;
379 }
380
381 // update the set of objects to be un-abstracted
382 nNodes = Wlc_NtkRemoveFromAbstraction( p, vRefine, vUnmark );
383 if ( pPars->fVerbose )
384 printf( "Refinement of CEX in frame %d came up with %d un-abstacted PPIs, whose MFFCs include %d objects.\n", pCex->iFrame, Vec_IntSize(vRefine), nNodes );
385 Vec_IntFree( vRefine );
386 Abc_CexFree( pCex );
387 }
388 Vec_BitFree( vUnmark );
389 // report the result
390 if ( pPars->fVerbose )
391 printf( "\n" );
392 printf( "Abstraction " );
393 if ( RetValue == 0 )
394 printf( "resulted in a real CEX" );
395 else if ( RetValue == 1 )
396 printf( "is successfully proved" );
397 else
398 printf( "timed out" );
399 printf( " after %d iterations. ", nIters );
400 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
401 return RetValue;
402}
Here is the call graph for this function:

◆ Wlc_NtkAbstractMem()

Wlc_Ntk_t * Wlc_NtkAbstractMem ( Wlc_Ntk_t * p,
int nFrames,
int fVerbose )
extern

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

Synopsis [Perform abstraction.]

Description []

SideEffects []

SeeAlso []

Definition at line 1383 of file wlcMem.c.

1384{
1385 Vec_Int_t * vMemObjsAll = Wlc_NtkCollectMemory( p, 0 );
1386 Vec_Int_t * vMemObjsClean = Wlc_NtkCollectMemory( p, 1 );
1387 Vec_Int_t * vReachReadCi = Wlc_NtkFindReachablePiFo( p, vMemObjsClean, nFrames );
1388 Wlc_Ntk_t * pNew, * pTemp;
1389 Wlc_Obj_t * pObj;
1390 Vec_Int_t * vFanins = Vec_IntAlloc( 100 );
1391 int i, Po0, Po1, iObjNew;
1392
1393 assert( nFrames == 0 );
1394
1395 // mark memory nodes
1397 Wlc_NtkForEachObjVec( vMemObjsAll, p, pObj, i )
1398 pObj->Mark = 1;
1399
1400 // start new network
1401 Wlc_NtkCleanCopy( p );
1402 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc + Vec_IntSize(vMemObjsClean) * nFrames * 10 );
1403 pNew->fSmtLib = p->fSmtLib;
1404 pNew->fAsyncRst = p->fAsyncRst;
1405 pNew->fMemPorts = p->fMemPorts;
1406 pNew->fEasyFfs = p->fEasyFfs;
1407 pNew->vInits = Vec_IntAlloc( 100 );
1408
1409 // duplicate PIs
1410 Wlc_NtkForEachPi( p, pObj, i )
1411 if ( !pObj->Mark )
1412 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1413
1414 // create new PIs
1415 assert( Vec_IntSize(vReachReadCi) % 3 == 0 );
1416 for ( i = 0; i < Vec_IntSize(vReachReadCi)/3; i++ )
1417 {
1418 pObj = Wlc_NtkObj( p, Vec_IntEntry( vReachReadCi, 3*i ) );
1419 assert( Wlc_ObjIsRead(pObj) );
1420 iObjNew = Wlc_NtkDupOneObject( pNew, p, pObj, WLC_OBJ_PI, vFanins );
1421 Vec_IntWriteEntry( vReachReadCi, 3*i+2, iObjNew );
1422 }
1423 //Vec_IntPrint( vReachReadCi );
1424
1425 // duplicate flop outputs
1426 Wlc_NtkForEachCi( p, pObj, i )
1427 if ( !Wlc_ObjIsPi(pObj) && !pObj->Mark )
1428 {
1429 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1430 Vec_IntPush( pNew->vInits, Vec_IntEntry(p->vInits, i-Wlc_NtkPiNum(p)) );
1431 }
1432
1433/*
1434 // create flops for memory objects
1435 Wlc_NtkForEachObjVec( vMemFanins, p, pObj, i )
1436 for ( k = 0; k < nFrames; k++ )
1437 Wlc_NtkDupOneObject( pNew, p, pObj, WLC_OBJ_FO, vFanins );
1438*/
1439
1440 // create buffers for read ports
1441 Wlc_NtkForEachObjVec( vMemObjsClean, p, pObj, i )
1442 {
1443 if ( !Wlc_ObjIsRead(pObj) )
1444 continue;
1445 iObjNew = Wlc_ObjAlloc( pNew, WLC_OBJ_BUF, pObj->Signed, pObj->End, pObj->Beg );
1446 Wlc_ObjSetCopy( p, Wlc_ObjId(p, pObj), iObjNew );
1447 }
1448
1449 // duplicate objects
1450 Wlc_NtkForEachObj( p, pObj, i )
1451 if ( !Wlc_ObjIsCi(pObj) && !pObj->Mark )
1452 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1453
1454 // create memory constraints
1455 Wlc_NtkCreateMemoryConstr( pNew, p, vMemObjsClean, vReachReadCi );
1456
1457 // create outpus
1458 if ( Vec_IntSize(&p->vPoPairs) )
1459 {
1460 // create miter for the PO pairs
1461 Vec_IntForEachEntryDouble( &p->vPoPairs, Po0, Po1, i )
1462 {
1463 int iCopy0 = Wlc_ObjCopy(p, Wlc_ObjId(p, Wlc_NtkPo(p, Po0)));
1464 int iCopy1 = Wlc_ObjCopy(p, Wlc_ObjId(p, Wlc_NtkPo(p, Po1)));
1465 int iObj = Wlc_ObjAlloc( pNew, WLC_OBJ_COMP_NOTEQU, 0, 0, 0 );
1466 Wlc_Obj_t * pObjNew = Wlc_NtkObj( pNew, iObj );
1467 Vec_IntFillTwo( vFanins, 1, iCopy0, iCopy1 );
1468 Wlc_ObjAddFanins( pNew, pObjNew, vFanins );
1469 Wlc_ObjSetCo( pNew, pObjNew, 0 );
1470 }
1471 printf( "Memory abstraction created %d miter outputs.\n", Wlc_NtkPoNum(pNew) );
1472 Wlc_NtkForEachCo( p, pObj, i )
1473 if ( pObj->fIsFi && !pObj->Mark )
1474 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), pObj->fIsFi );
1475 }
1476 else
1477 {
1478 // duplicate POs
1479 Wlc_NtkForEachPo( p, pObj, i )
1480 if ( !pObj->Mark )
1481 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), pObj->fIsFi );
1482 // duplicate FIs
1483 Wlc_NtkForEachCo( p, pObj, i )
1484 if ( !Wlc_ObjIsPo(pObj) && !pObj->Mark )
1485 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), pObj->fIsFi );
1486 }
1487
1488/*
1489 // create new flop inputs
1490 Wlc_NtkForEachObjVec( vMemFanins, p, pObj, i )
1491 for ( k = 0; k < nFrames; k++ )
1492 Wlc_NtkDupOneBuffer( pNew, p, pObj, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj))-(nFrames-1-k), vFanins, 1 );
1493*/
1494
1495 // append init states
1496 pNew->pInits = Wlc_PrsConvertInitValues( pNew );
1497 if ( p->pSpec )
1498 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1499 if ( Wlc_NtkHasNameId(p) )
1500 Wlc_NtkTransferNames( pNew, p );
1501 Vec_IntFree( vFanins );
1502 Vec_IntFree( vMemObjsAll );
1503 Vec_IntFree( vMemObjsClean );
1504 Vec_IntFree( vReachReadCi );
1506 // derive topological order
1507//printf( "Objects before = %d.\n", Wlc_NtkObjNum(pNew) );
1508 pNew = Wlc_NtkDupDfs( pTemp = pNew, 0, 1 );
1509 Wlc_NtkFree( pTemp );
1510//printf( "Objects after = %d.\n", Wlc_NtkObjNum(pNew) );
1511 return pNew;
1512}
int fAsyncRst
Definition wlc.h:152
char * pSpec
Definition wlc.h:139
char * pInits
Definition wlc.h:148
int fSmtLib
Definition wlc.h:151
int fEasyFfs
Definition wlc.h:154
int fMemPorts
Definition wlc.h:153
Vec_Int_t * vInits
Definition wlc.h:147
int End
Definition wlc.h:129
unsigned fIsFi
Definition wlc.h:126
unsigned Signed
Definition wlc.h:122
unsigned Mark
Definition wlc.h:123
int Beg
Definition wlc.h:130
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
Vec_Int_t * Wlc_NtkFindReachablePiFo(Wlc_Ntk_t *p, Vec_Int_t *vMemObjsClean, int nFrames)
Definition wlcMem.c:1222
void Wlc_NtkCreateMemoryConstr(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Vec_Int_t *vMemObjsClean, Vec_Int_t *vReachReadCi)
Definition wlcMem.c:1289
Vec_Int_t * Wlc_NtkCollectMemory(Wlc_Ntk_t *p, int fClean)
Definition wlcMem.c:216
int Wlc_NtkDupOneObject(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int TypeNew, Vec_Int_t *vFanins)
Definition wlcMem.c:295
#define Wlc_NtkForEachPo(p, pPo, i)
Definition wlc.h:364
void Wlc_NtkTransferNames(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p)
Definition wlcNtk.c:830
#define Wlc_NtkForEachCi(p, pCi, i)
Definition wlc.h:366
int Wlc_ObjAlloc(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg)
Definition wlcNtk.c:199
void Wlc_NtkCleanMarks(Wlc_Ntk_t *p)
Definition wlcNtk.c:1135
void Wlc_ObjSetCo(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int fFlopInput)
Definition wlcNtk.c:188
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
Definition wlc.h:360
Wlc_Ntk_t * Wlc_NtkDupDfs(Wlc_Ntk_t *p, int fMarked, int fSeq)
Definition wlcNtk.c:986
Wlc_Ntk_t * Wlc_NtkAlloc(char *pName, int nObjsAlloc)
Definition wlcNtk.c:152
#define Wlc_NtkForEachPi(p, pPi, i)
Definition wlc.h:362
char * Wlc_PrsConvertInitValues(Wlc_Ntk_t *p)
Definition wlcReadVer.c:440
int Wlc_ObjDup(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:930
void Wlc_ObjAddFanins(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:240
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition wlc.h:356
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.
Definition wlc.h:118
#define Wlc_NtkForEachCo(p, pCo, i)
Definition wlc.h:368
Here is the call graph for this function:

◆ Wlc_NtkAbstractNodes()

Wlc_Ntk_t * Wlc_NtkAbstractNodes ( Wlc_Ntk_t * p,
Vec_Int_t * vNodesInit )
extern

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

Synopsis [Abstracts nodes by replacing their outputs with new PIs.]

Description [If array is NULL, abstract all multipliers.]

SideEffects []

SeeAlso []

Definition at line 182 of file wlcUif.c.

183{
184 Vec_Int_t * vNodes = vNodesInit;
185 Wlc_Ntk_t * pNew;
186 Wlc_Obj_t * pObj;
187 int i, k, iObj, iFanin;
188 // get multipliers if not given
189 if ( vNodes == NULL )
190 vNodes = Wlc_NtkCollectMultipliers( p );
191 if ( vNodes == NULL )
192 return NULL;
193 // mark nodes
194 Wlc_NtkForEachObjVec( vNodes, p, pObj, i )
195 pObj->Mark = 1;
196 // iterate through the nodes in the DFS order
197 Wlc_NtkCleanCopy( p );
198 Wlc_NtkForEachObj( p, pObj, i )
199 {
200 if ( i == Vec_IntSize(&p->vCopies) )
201 break;
202 if ( pObj->Mark ) {
203 // clean
204 pObj->Mark = 0;
205 // add fresh PI with the same number of bits
206 iObj = Wlc_ObjAlloc( p, WLC_OBJ_PI, Wlc_ObjIsSigned(pObj), Wlc_ObjRange(pObj) - 1, 0 );
207 }
208 else {
209 // update fanins
210 Wlc_ObjForEachFanin( pObj, iFanin, k )
211 Wlc_ObjFanins(pObj)[k] = Wlc_ObjCopy(p, iFanin);
212 // node to remain
213 iObj = i;
214 }
215 Wlc_ObjSetCopy( p, i, iObj );
216 }
217 // POs do not change in this procedure
218 if ( vNodes != vNodesInit )
219 Vec_IntFree( vNodes );
220 // reconstruct topological order
221 pNew = Wlc_NtkDupDfs( p, 0, 1 );
222 return pNew;
223}
Vec_Int_t * Wlc_NtkCollectMultipliers(Wlc_Ntk_t *p)
Definition wlcUif.c:121
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
Definition wlc.h:375
Here is the call graph for this function:

◆ Wlc_NtkAlloc()

Wlc_Ntk_t * Wlc_NtkAlloc ( char * pName,
int nObjsAlloc )
extern

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

Synopsis [Working with models.]

Description []

SideEffects []

SeeAlso []

Definition at line 152 of file wlcNtk.c.

153{
154 Wlc_Ntk_t * p;
155 p = ABC_CALLOC( Wlc_Ntk_t, 1 );
156 p->pName = pName ? Extra_FileNameGeneric( pName ) : NULL;
157 Vec_IntGrow( &p->vPis, 111 );
158 Vec_IntGrow( &p->vPos, 111 );
159 Vec_IntGrow( &p->vCis, 111 );
160 Vec_IntGrow( &p->vCos, 111 );
161 Vec_IntGrow( &p->vFfs, 111 );
162 p->pMemFanin = Mem_FlexStart();
163 p->nObjsAlloc = nObjsAlloc;
164 p->pObjs = ABC_CALLOC( Wlc_Obj_t, p->nObjsAlloc );
165 p->iObj = 1;
166 return p;
167}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
char * Extra_FileNameGeneric(char *FileName)
Mem_Flex_t * Mem_FlexStart()
Definition mem.c:327
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkBitBlast()

Gia_Man_t * Wlc_NtkBitBlast ( Wlc_Ntk_t * p,
Wlc_BstPar_t * pParIn )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1349 of file wlcBlast.c.

1350{
1351 int fVerbose = 0;
1352 int fUseOldMultiplierBlasting = 0;
1353 int fSkipBitRange = 0;
1354 Tim_Man_t * pManTime = NULL;
1355 If_LibBox_t * pBoxLib = NULL;
1356 Vec_Ptr_t * vTables = NULL;
1357 Vec_Int_t * vFf2Ci = Vec_IntAlloc( 100 );
1358 Vec_Int_t * vRegClasses = NULL;
1359 Gia_Man_t * pTemp, * pNew, * pExtra = NULL;
1360 Wlc_Obj_t * pObj, * pObj2;
1361 Vec_Int_t * vBits = &p->vBits, * vTemp0, * vTemp1, * vTemp2, * vRes, * vAddOutputs = NULL, * vAddObjs = NULL;
1362 int nBits = Wlc_NtkPrepareBits( p );
1363 int nRange, nRange0, nRange1, nRange2, nRange3;
1364 int i, k, b, iFanin, iLit, nAndPrev, * pFans0, * pFans1, * pFans2, * pFans3;
1365 int nFFins = 0, nFFouts = 0, curPi = 0, curPo = 0, nFf2Regs = 0;
1366 int nBitCis = 0, nBitCos = 0, fAdded = 0;
1367 Wlc_BstPar_t Par, * pPar = &Par;
1368 Wlc_BstParDefault( pPar );
1369 pPar = pParIn ? pParIn : pPar;
1370 Vec_IntClear( vBits );
1371 Vec_IntGrow( vBits, nBits );
1372 vTemp0 = Vec_IntAlloc( 1000 );
1373 vTemp1 = Vec_IntAlloc( 1000 );
1374 vTemp2 = Vec_IntAlloc( 1000 );
1375 vRes = Vec_IntAlloc( 1000 );
1376 // clean AND-gate counters
1377 memset( p->nAnds, 0, sizeof(int) * WLC_OBJ_NUMBER );
1378 // create AIG manager
1379 pNew = Gia_ManStart( 5 * Wlc_NtkObjNum(p) + 1000 );
1380 pNew->pName = Abc_UtilStrsav( p->pName );
1381 pNew->fGiaSimple = pPar->fGiaSimple;
1382 if ( !pPar->fGiaSimple )
1383 Gia_ManHashAlloc( pNew );
1384 if ( pPar->fAddOutputs )
1385 vAddOutputs = Vec_IntAlloc( 100 );
1386 if ( pPar->fAddOutputs )
1387 vAddObjs = Vec_IntAlloc( 100 );
1388 // prepare for AIG with boxes
1389 if ( pPar->vBoxIds )
1390 {
1391 int nNewCis = 0, nNewCos = 0;
1392 assert( Vec_IntSize(&p->vFfs2) == 0 );
1393 Wlc_NtkForEachObj( p, pObj, i )
1394 pObj->Mark = 0;
1395 // count bit-width of regular CIs/COs
1396 Wlc_NtkForEachCi( p, pObj, i )
1397 nBitCis += Wlc_ObjRange( pObj );
1398 Wlc_NtkForEachCo( p, pObj, i )
1399 nBitCos += Wlc_ObjRange( pObj );
1400 // count bit-width of additional CIs/COs due to selected multipliers
1401 assert( Vec_IntSize(pPar->vBoxIds) > 0 );
1402 Wlc_NtkForEachObjVec( pPar->vBoxIds, p, pObj, i )
1403 {
1404 // currently works only for multipliers
1405 assert( pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_ADD );
1406 nNewCis += Wlc_ObjRange( pObj );
1407 nNewCos += Wlc_ObjRange( Wlc_ObjFanin0(p, pObj) );
1408 nNewCos += Wlc_ObjRange( Wlc_ObjFanin1(p, pObj) );
1409 if ( Wlc_ObjFaninNum(pObj) > 2 )
1410 nNewCos += Wlc_ObjRange( Wlc_ObjFanin2(p, pObj) );
1411 pObj->Mark = 1;
1412 }
1413 // create hierarchy manager
1414 pManTime = Tim_ManStart( nBitCis + nNewCis, nBitCos + nNewCos );
1415 curPi = nBitCis;
1416 curPo = 0;
1417 // create AIG manager for logic of the boxes
1418 pExtra = Gia_ManStart( Wlc_NtkObjNum(p) );
1419 Gia_ManHashAlloc( pExtra );
1420 assert( !pPar->fGiaSimple );
1421 // create box library
1422 pBoxLib = If_LibBoxStart();
1423 }
1424 if ( Vec_IntSize(&p->vFfs2) > 0 )
1425 {
1426 Vec_Int_t * vSignature;
1427 int nNewCis = 0, nNewCos = 0;
1428 assert( pPar->vBoxIds == 0 );
1429 // count bit-width of regular CIs/COs
1430 Wlc_NtkForEachCi( p, pObj, i )
1431 nBitCis += Wlc_ObjRange( pObj );
1432 Wlc_NtkForEachCo( p, pObj, i )
1433 nBitCos += Wlc_ObjRange( pObj );
1434 // count bit-width of additional CIs/COs due to selected multipliers
1435 Wlc_NtkForEachFf2( p, pObj, i )
1436 {
1437 // currently works only for multipliers
1438 assert( pObj->Type == WLC_OBJ_FF );
1439 assert( Wlc_ObjRange(pObj) == Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
1440 nNewCis += Wlc_ObjRange(pObj);
1441 nNewCos += 2*Wlc_ObjRange(pObj) + 3;
1442 nFf2Regs+= Wlc_ObjRange(pObj);
1443 }
1444 // create hierarchy manager
1445 pManTime = Tim_ManStart( nBitCis + nNewCis + nFf2Regs, nBitCos + nNewCos + nFf2Regs );
1446 curPi = nBitCis + nFf2Regs;
1447 curPo = 0;
1448 // create AIG manager for logic of the boxes
1449 pExtra = Gia_ManStart( Wlc_NtkObjNum(p) );
1450 Gia_ManHashAlloc( pExtra );
1451 assert( !pPar->fGiaSimple );
1452 // create register classes
1453 vRegClasses = Vec_IntAlloc(0);
1454 vSignature = Vec_IntAlloc( 100 );
1455 Vec_IntPushTwo( vSignature, -1, -1 );
1456 Wlc_NtkForEachFf2( p, pObj, i )
1457 {
1458 int iClk0, iClk = Wlc_ObjFaninId( pObj, 1 );
1459 int iAsyn0, iAsyn = Wlc_ObjFaninId( pObj, 5 );
1460 nRange = Wlc_ObjRange(pObj);
1461 Vec_IntForEachEntryDouble( vSignature, iClk0, iAsyn0, k )
1462 if ( iClk == iClk0 && iAsyn == iAsyn0 )
1463 {
1464 for ( b = 0; b < nRange; b++ )
1465 Vec_IntPush( vRegClasses, k/2 );
1466 break;
1467 }
1468 if ( k < Vec_IntSize(vSignature) )
1469 continue;
1470 for ( b = 0; b < nRange; b++ )
1471 Vec_IntPush( vRegClasses, k/2 );
1472 Vec_IntPushTwo( vSignature, iClk, iAsyn );
1473 }
1474 assert( Vec_IntSize(vRegClasses) == nFf2Regs );
1475 Vec_IntFree( vSignature );
1476 // create box library
1477 pBoxLib = If_LibBoxStart();
1478 }
1479 //printf( "Init state: %s\n", p->pInits );
1480
1481 // blast in the topological order
1482 Wlc_NtkForEachObj( p, pObj, i )
1483 {
1484 //char * pName1 = Wlc_ObjName(p, i);
1485 //char * pName2 = Wlc_ObjFaninNum(pObj) ? Wlc_ObjName(p, Wlc_ObjFaninId0(pObj)) : NULL;
1486
1487 nAndPrev = Gia_ManAndNum(pNew);
1488 nRange = Wlc_ObjRange( pObj );
1489 nRange0 = Wlc_ObjFaninNum(pObj) > 0 ? Wlc_ObjRange( Wlc_ObjFanin0(p, pObj) ) : -1;
1490 nRange1 = Wlc_ObjFaninNum(pObj) > 1 ? Wlc_ObjRange( Wlc_ObjFanin1(p, pObj) ) : -1;
1491 nRange2 = Wlc_ObjFaninNum(pObj) > 2 ? Wlc_ObjRange( Wlc_ObjFanin2(p, pObj) ) : -1;
1492 nRange3 = Wlc_ObjFaninNum(pObj) > 3 ? Wlc_ObjRange( Wlc_ObjFanin(p, pObj, 3) ) : -1;
1493 pFans0 = pObj->Type != WLC_OBJ_FF && Wlc_ObjFaninNum(pObj) > 0 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId0(pObj)) ) : NULL;
1494 pFans1 = pObj->Type != WLC_OBJ_FF && Wlc_ObjFaninNum(pObj) > 1 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId1(pObj)) ) : NULL;
1495 pFans2 = pObj->Type != WLC_OBJ_FF && Wlc_ObjFaninNum(pObj) > 2 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId2(pObj)) ) : NULL;
1496 pFans3 = pObj->Type != WLC_OBJ_FF && Wlc_ObjFaninNum(pObj) > 3 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId(pObj,3)) ) : NULL;
1497 Vec_IntClear( vRes );
1498 assert( nRange > 0 );
1499 if ( pPar->vBoxIds && pObj->Mark )
1500 {
1501 If_Box_t * pBox;
1502 char Buffer[100];
1503 float * pTable;
1504 int CarryIn = 0;
1505
1506 pObj->Mark = 0;
1507 assert( pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB );
1508
1509 // account for carry-in
1510 if ( Wlc_ObjFaninNum(pObj) == 3 )
1511 assert( nRange2 == 1 );
1512 else
1513 nRange2 = 0;
1514
1515 // create new box
1516 if ( vTables == NULL ) {
1517 Tim_ManSetDelayTables( pManTime, (vTables = Vec_PtrAlloc(100)) );
1518 Vec_PtrPush( vTables, NULL );
1519 }
1520 Tim_ManCreateBox( pManTime, curPo, nRange0 + nRange1 + nRange2, curPi, nRange, Vec_PtrSize(vTables), 0 );
1521 Tim_ManBoxSetCopy( pManTime, Tim_ManBoxNum(pManTime)-1, Tim_ManBoxNum(pManTime)-1 );
1522 curPi += nRange;
1523 curPo += nRange0 + nRange1 + nRange2;
1524
1525 // create delay table
1526 pTable = ABC_ALLOC( float, 3 + nRange * (nRange0 + nRange1 + nRange2) );
1527 pTable[0] = Vec_PtrSize(vTables);
1528 pTable[1] = nRange0 + nRange1 + nRange2;
1529 pTable[2] = nRange;
1530 for ( k = 0; k < nRange * (nRange0 + nRange1 + nRange2); k++ )
1531 pTable[3 + k] = 1.0;
1532 Vec_PtrPush( vTables, pTable );
1533
1534 // create combinational outputs in the normal manager
1535 for ( k = 0; k < nRange0; k++ )
1536 Gia_ManAppendCo( pNew, pFans0[k] );
1537 for ( k = 0; k < nRange1; k++ )
1538 Gia_ManAppendCo( pNew, pFans1[k] );
1539 for ( k = 0; k < nRange2; k++ )
1540 Gia_ManAppendCo( pNew, pFans2[0] );
1541
1542 // make sure there is enough primary inputs in the manager
1543 for ( k = Gia_ManPiNum(pExtra); k < nRange0 + nRange1 + nRange2; k++ )
1544 Gia_ManAppendCi( pExtra );
1545 // create combinational inputs
1546 Vec_IntClear( vTemp0 );
1547 for ( k = 0; k < nRange0; k++ )
1548 Vec_IntPush( vTemp0, Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, k)) );
1549 Vec_IntClear( vTemp1 );
1550 for ( k = 0; k < nRange1; k++ )
1551 Vec_IntPush( vTemp1, Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, nRange0+k)) );
1552 if ( nRange2 == 1 )
1553 CarryIn = Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, nRange0+nRange1));
1554
1555 // get new fanin arrays
1556 pFans0 = Vec_IntArray( vTemp0 );
1557 pFans1 = Vec_IntArray( vTemp1 );
1558
1559 // bit-blast in the external manager
1560 if ( pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB )
1561 {
1562 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
1563 int * pArg0 = Wlc_VecLoadFanins( vRes, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1564 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1565 if ( pObj->Type == WLC_OBJ_ARI_ADD )
1566 Wlc_BlastAdder( pExtra, pArg0, pArg1, nRange, CarryIn ); // result is in pFan0 (vRes)
1567 else
1568 Wlc_BlastSubtract( pExtra, pArg0, pArg1, nRange, 1 ); // result is in pFan0 (vRes)
1569 Vec_IntShrink( vRes, nRange );
1570 }
1571 else if ( fUseOldMultiplierBlasting )
1572 {
1573 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
1574 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1575 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1576 Wlc_BlastMultiplier2( pExtra, pArg0, pArg1, nRange, vTemp2, vRes );
1577 Vec_IntShrink( vRes, nRange );
1578 }
1579 else
1580 {
1581 int fSigned = Wlc_ObjIsSignedFanin01(p, pObj);
1582 int nRangeMax = Abc_MaxInt(nRange0, nRange1);
1583 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, fSigned );
1584 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, fSigned );
1585 Wlc_BlastMultiplier( pExtra, pArg0, pArg1, nRangeMax, nRangeMax, vTemp2, vRes, fSigned );
1586 if ( nRange > nRangeMax + nRangeMax )
1587 Vec_IntFillExtra( vRes, nRange, fSigned ? Vec_IntEntryLast(vRes) : 0 );
1588 else
1589 Vec_IntShrink( vRes, nRange );
1590 assert( Vec_IntSize(vRes) == nRange );
1591 }
1592 // create outputs in the external manager
1593 for ( k = 0; k < nRange; k++ )
1594 Gia_ManAppendCo( pExtra, Vec_IntEntry(vRes, k) );
1595
1596 // create combinational inputs in the normal manager
1597 Vec_IntClear( vRes );
1598 for ( k = 0; k < nRange; k++ )
1599 Vec_IntPush( vRes, Gia_ManAppendCi(pNew) );
1600
1601 // add box to the library
1602 sprintf( Buffer, "%s%03d", pObj->Type == WLC_OBJ_ARI_ADD ? "add":"mul", 1+If_LibBoxNum(pBoxLib) );
1603 pBox = If_BoxStart( Abc_UtilStrsav(Buffer), 1+If_LibBoxNum(pBoxLib), nRange0 + nRange1 + nRange2, nRange, 0, 0, 0 );
1604 If_LibBoxAdd( pBoxLib, pBox );
1605 for ( k = 0; k < pBox->nPis * pBox->nPos; k++ )
1606 pBox->pDelays[k] = 1;
1607 }
1608 else if ( Wlc_ObjIsCi(pObj) || pObj->Type == WLC_OBJ_FF ) // assuming that FFs are ordered immediately after PIs
1609 {
1610 if ( pObj->Type == WLC_OBJ_FF )
1611 Vec_IntPush( vFf2Ci, Gia_ManCiNum(pNew) );
1612 if ( Wlc_ObjRangeIsReversed(pObj) )
1613 {
1614 for ( k = 0; k < nRange; k++ )
1615 Vec_IntPush( vRes, -1 );
1616 for ( k = 0; k < nRange; k++ )
1617 Vec_IntWriteEntry( vRes, Vec_IntSize(vRes)-1-k, Gia_ManAppendCi(pNew) );
1618 }
1619 else
1620 {
1621 for ( k = 0; k < nRange; k++ )
1622 Vec_IntPush( vRes, Gia_ManAppendCi(pNew) );
1623 }
1624 if ( pObj->Type == WLC_OBJ_FO )
1625 nFFouts += Vec_IntSize(vRes);
1626 if ( pObj->Type == WLC_OBJ_FF )
1627 {
1628 // complement flop output whose init state is 1
1629 }
1630 }
1631 else if ( pObj->Type == WLC_OBJ_BUF )
1632 {
1633 int nRangeMax = Abc_MaxInt( nRange0, nRange );
1634 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin0(p, pObj) );
1635 for ( k = 0; k < nRange; k++ )
1636 Vec_IntPush( vRes, pArg0[k] );
1637 }
1638 else if ( pObj->Type == WLC_OBJ_CONST )
1639 {
1640 word * pTruth = (word *)Wlc_ObjFanins(pObj);
1641 for ( k = 0; k < nRange; k++ )
1642 Vec_IntPush( vRes, Abc_TtGetBit(pTruth, k) );
1643 }
1644 else if ( pObj->Type == WLC_OBJ_MUX )
1645 {
1646 // It is strange and disturbing that Verilog standard treats these statements differently:
1647 // Statement 1:
1648 // assign o = i ? b : a;
1649 // Statement 2:
1650 // always @( i or a or b )
1651 // begin
1652 // case ( i )
1653 // 0 : o = a ;
1654 // 1 : o = b ;
1655 // endcase
1656 // end
1657 // If a is signed and b is unsigned, Statement 1 does not sign-extend a, while Statement 2 does.
1658 // The signedness of o does not matter.
1659 //
1660 // Below we (somewhat arbitrarily) distinguish these two by assuming that
1661 // Statement 1 has three fanins, while Statement 2 has more than three fanins.
1662 //
1663 int fSigned = 1;
1664 assert( nRange0 >= 1 && Wlc_ObjFaninNum(pObj) >= 3 );
1665 assert( 1 + (1 << nRange0) == Wlc_ObjFaninNum(pObj) );
1666 Wlc_ObjForEachFanin( pObj, iFanin, k )
1667 if ( k > 0 )
1668 fSigned &= Wlc_NtkObj(p, iFanin)->Signed;
1669 if ( pParIn->fBlastNew && nRange0 <= 16 )
1670 {
1671 char * pNums = Wlc_NtkMuxTreeString( nRange0 );
1672 Vec_Int_t ** pvDecs = Wlc_NtkMuxTree3DecsDerive( pNew, pFans0, nRange0, pNums );
1673 for ( b = 0; b < nRange; b++ )
1674 {
1675 Vec_IntClear( vTemp0 );
1676 Wlc_ObjForEachFanin( pObj, iFanin, k ) {
1677 if ( k > 0 )
1678 {
1679 nRange1 = Wlc_ObjRange( Wlc_NtkObj(p, iFanin) );
1680 pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, iFanin) );
1681 if ( Wlc_ObjFaninNum(pObj) == 3 ) // Statement 1
1682 Vec_IntPush( vTemp0, b < nRange1 ? pFans1[b] : (fSigned? pFans1[nRange1-1] : 0) );
1683 else // Statement 2
1684 Vec_IntPush( vTemp0, b < nRange1 ? pFans1[b] : (Wlc_NtkObj(p, iFanin)->Signed? pFans1[nRange1-1] : 0) );
1685 }
1686 }
1687 assert( (1 << nRange0) == Vec_IntSize(vTemp0) );
1688 Vec_IntPush( vRes, Wlc_NtkMuxTree3(pNew, vTemp0, pNums, pvDecs) );
1689 }
1690 Wlc_NtkMuxTree3DecsFree( pvDecs, pNums );
1691 }
1692 else
1693 {
1694 Vec_IntClear( vTemp1 );
1695 if ( pPar->fDecMuxes )
1696 {
1697 for ( k = 0; k < (1 << nRange0); k++ )
1698 {
1699 int iLitAnd = 1;
1700 for ( b = 0; b < nRange0; b++ )
1701 iLitAnd = Gia_ManHashAnd( pNew, iLitAnd, Abc_LitNotCond(pFans0[b], ((k >> b) & 1) == 0) );
1702 Vec_IntPush( vTemp1, iLitAnd );
1703 }
1704 }
1705 for ( b = 0; b < nRange; b++ )
1706 {
1707 Vec_IntClear( vTemp0 );
1708 Wlc_ObjForEachFanin( pObj, iFanin, k )
1709 if ( k > 0 )
1710 {
1711 nRange1 = Wlc_ObjRange( Wlc_NtkObj(p, iFanin) );
1712 pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, iFanin) );
1713 if ( Wlc_ObjFaninNum(pObj) == 3 ) // Statement 1
1714 Vec_IntPush( vTemp0, b < nRange1 ? pFans1[b] : (fSigned? pFans1[nRange1-1] : 0) );
1715 else // Statement 2
1716 Vec_IntPush( vTemp0, b < nRange1 ? pFans1[b] : (Wlc_NtkObj(p, iFanin)->Signed? pFans1[nRange1-1] : 0) );
1717 }
1718 if ( pPar->fDecMuxes )
1719 Vec_IntPush( vRes, Wlc_NtkMuxTree2(pNew, pFans0, nRange0, vTemp0, vTemp1, vTemp2) );
1720 else
1721 Vec_IntPush( vRes, Wlc_NtkMuxTree_rec(pNew, pFans0, nRange0, vTemp0, 0) );
1722 }
1723 }
1724 }
1725 else if ( pObj->Type == WLC_OBJ_SEL )
1726 {
1727 assert( nRange0 == Wlc_ObjFaninNum(pObj)-1 );
1728 Vec_IntClear( vTemp1 );
1729 for ( k = 0; k < nRange0; k++ )
1730 Vec_IntPush( vTemp1, pFans0[k] );
1731 for ( b = 0; b < nRange; b++ )
1732 {
1733 Vec_IntClear( vTemp0 );
1734 Wlc_ObjForEachFanin( pObj, iFanin, k )
1735 if ( k > 0 )
1736 {
1737 Wlc_Obj_t * pFanin = Wlc_NtkObj(p, iFanin);
1738 assert( nRange == Wlc_ObjRange(pFanin) );
1739 pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, iFanin) );
1740 Vec_IntPush( vTemp0, pFans1[b] );
1741 }
1742 Vec_IntPush( vRes, Wlc_NtkMuxTree2(pNew, NULL, 0, vTemp0, vTemp1, vTemp2) );
1743 }
1744 }
1745 else if ( pObj->Type == WLC_OBJ_SHIFT_R || pObj->Type == WLC_OBJ_SHIFT_RA ||
1746 pObj->Type == WLC_OBJ_SHIFT_L || pObj->Type == WLC_OBJ_SHIFT_LA )
1747 {
1748 int nRangeMax = Abc_MaxInt( nRange, nRange0 );
1749 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin0(p, pObj) );
1750 if ( pObj->Type == WLC_OBJ_SHIFT_R || pObj->Type == WLC_OBJ_SHIFT_RA )
1751 Wlc_BlastShiftRight( pNew, pArg0, nRangeMax, pFans1, nRange1, Wlc_ObjIsSignedFanin0(p, pObj) && pObj->Type == WLC_OBJ_SHIFT_RA, vRes );
1752 else
1753 Wlc_BlastShiftLeft( pNew, pArg0, nRangeMax, pFans1, nRange1, 0, vRes );
1754 Vec_IntShrink( vRes, nRange );
1755 }
1756 else if ( pObj->Type == WLC_OBJ_ROTATE_R )
1757 {
1758 assert( nRange0 == nRange );
1759 Wlc_BlastRotateRight( pNew, pFans0, nRange0, pFans1, nRange1, vRes );
1760 }
1761 else if ( pObj->Type == WLC_OBJ_ROTATE_L )
1762 {
1763 assert( nRange0 == nRange );
1764 Wlc_BlastRotateLeft( pNew, pFans0, nRange0, pFans1, nRange1, vRes );
1765 }
1766 else if ( pObj->Type == WLC_OBJ_BIT_NOT )
1767 {
1768 int nRangeMax = Abc_MaxInt( nRange, nRange0 );
1769 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin0(p, pObj) );
1770 for ( k = 0; k < nRange; k++ )
1771 Vec_IntPush( vRes, Abc_LitNot(pArg0[k]) );
1772 }
1773 else if ( pObj->Type == WLC_OBJ_BIT_AND || pObj->Type == WLC_OBJ_BIT_NAND )
1774 {
1775 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
1776 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1777 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1778 for ( k = 0; k < nRange; k++ )
1779 Vec_IntPush( vRes, Abc_LitNotCond(Gia_ManHashAnd(pNew, pArg0[k], pArg1[k]), pObj->Type == WLC_OBJ_BIT_NAND) );
1780 }
1781 else if ( pObj->Type == WLC_OBJ_BIT_OR || pObj->Type == WLC_OBJ_BIT_NOR )
1782 {
1783 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
1784 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1785 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1786 for ( k = 0; k < nRange; k++ )
1787 Vec_IntPush( vRes, Abc_LitNotCond(Gia_ManHashOr(pNew, pArg0[k], pArg1[k]), pObj->Type == WLC_OBJ_BIT_NOR) );
1788 }
1789 else if ( pObj->Type == WLC_OBJ_BIT_XOR || pObj->Type == WLC_OBJ_BIT_NXOR )
1790 {
1791 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
1792 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1793 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1794 for ( k = 0; k < nRange; k++ )
1795 Vec_IntPush( vRes, Abc_LitNotCond(Gia_ManHashXor(pNew, pArg0[k], pArg1[k]), pObj->Type == WLC_OBJ_BIT_NXOR) );
1796 }
1797 else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
1798 {
1799 Wlc_Obj_t * pFanin = Wlc_ObjFanin0(p, pObj);
1800 int End = Wlc_ObjRangeEnd(pObj);
1801 int Beg = Wlc_ObjRangeBeg(pObj);
1802 if ( End >= Beg )
1803 {
1804 assert( nRange == End - Beg + 1 );
1805 assert( pFanin->Beg <= Beg && End <= pFanin->End );
1806 for ( k = Beg; k <= End; k++ )
1807 Vec_IntPush( vRes, pFans0[k - pFanin->Beg] );
1808 }
1809 else
1810 {
1811 assert( nRange == Beg - End + 1 );
1812 assert( pFanin->End <= End && Beg <= pFanin->Beg );
1813 for ( k = End; k <= Beg; k++ )
1814 Vec_IntPush( vRes, pFans0[k - pFanin->End] );
1815 }
1816 }
1817 else if ( pObj->Type == WLC_OBJ_BIT_CONCAT )
1818 {
1819 int iFanin, nTotal = 0;
1820 Wlc_ObjForEachFanin( pObj, iFanin, k )
1821 nTotal += Wlc_ObjRange( Wlc_NtkObj(p, iFanin) );
1822 assert( nRange == nTotal );
1823 Wlc_ObjForEachFaninReverse( pObj, iFanin, k )
1824 {
1825 nRange0 = Wlc_ObjRange( Wlc_NtkObj(p, iFanin) );
1826 pFans0 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, iFanin) );
1827 for ( b = 0; b < nRange0; b++ )
1828 Vec_IntPush( vRes, pFans0[b] );
1829 }
1830 }
1831 else if ( pObj->Type == WLC_OBJ_BIT_ZEROPAD || pObj->Type == WLC_OBJ_BIT_SIGNEXT )
1832 {
1833 int Pad = pObj->Type == WLC_OBJ_BIT_ZEROPAD ? 0 : pFans0[nRange0-1];
1834 assert( nRange0 <= nRange );
1835 for ( k = 0; k < nRange0; k++ )
1836 Vec_IntPush( vRes, pFans0[k] );
1837 for ( ; k < nRange; k++ )
1838 Vec_IntPush( vRes, Pad );
1839 }
1840 else if ( pObj->Type == WLC_OBJ_LOGIC_NOT )
1841 {
1842 iLit = Wlc_BlastReduction( pNew, pFans0, nRange0, WLC_OBJ_REDUCT_OR );
1843 Vec_IntFill( vRes, 1, Abc_LitNot(iLit) );
1844 for ( k = 1; k < nRange; k++ )
1845 Vec_IntPush( vRes, 0 );
1846 }
1847 else if ( pObj->Type == WLC_OBJ_LOGIC_IMPL )
1848 {
1849 int iLit0 = Wlc_BlastReduction( pNew, pFans0, nRange0, WLC_OBJ_REDUCT_OR );
1850 int iLit1 = Wlc_BlastReduction( pNew, pFans1, nRange1, WLC_OBJ_REDUCT_OR );
1851 Vec_IntFill( vRes, 1, Gia_ManHashOr(pNew, Abc_LitNot(iLit0), iLit1) );
1852 for ( k = 1; k < nRange; k++ )
1853 Vec_IntPush( vRes, 0 );
1854 }
1855 else if ( pObj->Type == WLC_OBJ_LOGIC_AND )
1856 {
1857 int iLit0 = Wlc_BlastReduction( pNew, pFans0, nRange0, WLC_OBJ_REDUCT_OR );
1858 int iLit1 = Wlc_BlastReduction( pNew, pFans1, nRange1, WLC_OBJ_REDUCT_OR );
1859 Vec_IntFill( vRes, 1, Gia_ManHashAnd(pNew, iLit0, iLit1) );
1860 for ( k = 1; k < nRange; k++ )
1861 Vec_IntPush( vRes, 0 );
1862 }
1863 else if ( pObj->Type == WLC_OBJ_LOGIC_OR )
1864 {
1865 int iLit0 = Wlc_BlastReduction( pNew, pFans0, nRange0, WLC_OBJ_REDUCT_OR );
1866 int iLit1 = Wlc_BlastReduction( pNew, pFans1, nRange1, WLC_OBJ_REDUCT_OR );
1867 Vec_IntFill( vRes, 1, Gia_ManHashOr(pNew, iLit0, iLit1) );
1868 for ( k = 1; k < nRange; k++ )
1869 Vec_IntPush( vRes, 0 );
1870 }
1871 else if ( pObj->Type == WLC_OBJ_LOGIC_XOR )
1872 {
1873 int iLit0 = Wlc_BlastReduction( pNew, pFans0, nRange0, WLC_OBJ_REDUCT_OR );
1874 int iLit1 = Wlc_BlastReduction( pNew, pFans1, nRange1, WLC_OBJ_REDUCT_OR );
1875 Vec_IntFill( vRes, 1, Gia_ManHashXor(pNew, iLit0, iLit1) );
1876 for ( k = 1; k < nRange; k++ )
1877 Vec_IntPush( vRes, 0 );
1878 }
1879 else if ( pObj->Type == WLC_OBJ_COMP_NOTEQU && Wlc_ObjFaninNum(pObj) > 2 )
1880 {
1881 // find the max range
1882 int a, b, iRes = 1, nRangeMax = Abc_MaxInt( nRange0, nRange1 );
1883 for ( k = 2; k < Wlc_ObjFaninNum(pObj); k++ )
1884 nRangeMax = Abc_MaxInt( nRangeMax, Wlc_ObjRange( Wlc_NtkObj(p, Wlc_ObjFaninId(pObj, k)) ) );
1885 // create pairwise distinct
1886 for ( a = 0; a < Wlc_ObjFaninNum(pObj); a++ )
1887 for ( b = a+1; b < Wlc_ObjFaninNum(pObj); b++ )
1888 {
1889 int nRange0 = Wlc_ObjRange( Wlc_NtkObj(p, Wlc_ObjFaninId(pObj, a)) );
1890 int nRange1 = Wlc_ObjRange( Wlc_NtkObj(p, Wlc_ObjFaninId(pObj, b)) );
1891 int * pFans0 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId(pObj, a)) );
1892 int * pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId(pObj, b)) );
1893 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, 0 );
1894 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, 0 );
1895 int iLit = 0;
1896 for ( k = 0; k < nRangeMax; k++ )
1897 iLit = Gia_ManHashOr( pNew, iLit, Gia_ManHashXor(pNew, pArg0[k], pArg1[k]) );
1898 iRes = Gia_ManHashAnd( pNew, iRes, iLit );
1899 }
1900 Vec_IntFill( vRes, 1, iRes );
1901 for ( k = 1; k < nRange; k++ )
1902 Vec_IntPush( vRes, 0 );
1903 }
1904 else if ( pObj->Type == WLC_OBJ_COMP_EQU || pObj->Type == WLC_OBJ_COMP_NOTEQU )
1905 {
1906 int iLit = 0, nRangeMax = Abc_MaxInt( nRange0, nRange1 );
1907 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1908 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1909 for ( k = 0; k < nRangeMax; k++ )
1910 iLit = Gia_ManHashOr( pNew, iLit, Gia_ManHashXor(pNew, pArg0[k], pArg1[k]) );
1911 Vec_IntFill( vRes, 1, Abc_LitNotCond(iLit, pObj->Type == WLC_OBJ_COMP_EQU) );
1912 for ( k = 1; k < nRange; k++ )
1913 Vec_IntPush( vRes, 0 );
1914 }
1915 else if ( pObj->Type == WLC_OBJ_COMP_LESS || pObj->Type == WLC_OBJ_COMP_MOREEQU ||
1916 pObj->Type == WLC_OBJ_COMP_MORE || pObj->Type == WLC_OBJ_COMP_LESSEQU )
1917 {
1918 int nRangeMax = Abc_MaxInt( nRange0, nRange1 );
1919 int fSigned = Wlc_ObjIsSignedFanin01(p, pObj);
1920 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, fSigned );
1921 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, fSigned );
1922 int fSwap = (pObj->Type == WLC_OBJ_COMP_MORE || pObj->Type == WLC_OBJ_COMP_LESSEQU);
1923 int fCompl = (pObj->Type == WLC_OBJ_COMP_MOREEQU || pObj->Type == WLC_OBJ_COMP_LESSEQU);
1924 if ( fSwap ) ABC_SWAP( int *, pArg0, pArg1 );
1925 if ( fSigned )
1926 iLit = pParIn->fBlastNew ? Wlc_BlastLessSigned3( pNew, pArg0, pArg1, nRangeMax ) : Wlc_BlastLessSigned( pNew, pArg0, pArg1, nRangeMax );
1927 else
1928 iLit = pParIn->fBlastNew ? Wlc_BlastLess3( pNew, pArg0, pArg1, nRangeMax ) : Wlc_BlastLess( pNew, pArg0, pArg1, nRangeMax );
1929 iLit = Abc_LitNotCond( iLit, fCompl );
1930 Vec_IntFill( vRes, 1, iLit );
1931 for ( k = 1; k < nRange; k++ )
1932 Vec_IntPush( vRes, 0 );
1933 }
1934 else if ( pObj->Type == WLC_OBJ_REDUCT_AND || pObj->Type == WLC_OBJ_REDUCT_OR || pObj->Type == WLC_OBJ_REDUCT_XOR ||
1935 pObj->Type == WLC_OBJ_REDUCT_NAND || pObj->Type == WLC_OBJ_REDUCT_NOR || pObj->Type == WLC_OBJ_REDUCT_NXOR )
1936 {
1937 Vec_IntPush( vRes, Wlc_BlastReduction( pNew, pFans0, nRange0, pObj->Type ) );
1938 for ( k = 1; k < nRange; k++ )
1939 Vec_IntPush( vRes, 0 );
1940 }
1941 else if ( pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB )
1942 {
1943 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
1944 int * pArg0 = Wlc_VecLoadFanins( vRes, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1945 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1946 int CarryIn = Wlc_ObjFaninNum(pObj) == 3 ? pFans2[0] : 0;
1947 if ( pObj->Type == WLC_OBJ_ARI_ADD )
1948 {
1949 if ( pPar->fCla )
1950 Wlc_BlastAdderCLA( pNew, pArg0, pArg1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj), CarryIn ); // result is in pFan0 (vRes)
1951 //Wlc_BlastAdderFast( pNew, pArg0, pArg1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj), CarryIn ); // result is in pFan0 (vRes)
1952 else
1953 Wlc_BlastAdder( pNew, pArg0, pArg1, nRangeMax, CarryIn ); // result is in pFan0 (vRes)
1954 }
1955 else
1956 Wlc_BlastSubtract( pNew, pArg0, pArg1, nRange, 1 ); // result is in pFan0 (vRes)
1957 Vec_IntShrink( vRes, nRange );
1958 }
1959 else if ( pObj->Type == WLC_OBJ_ARI_ADDSUB )
1960 {
1961 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange2, nRange3) );
1962 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans2, nRange2, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1963 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans2, nRange2, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1964 int * pArg2 = Wlc_VecLoadFanins( vTemp2, pFans3, nRange3, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1965 int ModeIn = pFans0[0];
1966 int CarryIn = pFans1[0]; int j;
1967 Wlc_BlastAdder ( pNew, pArg0, pArg2, nRangeMax, CarryIn ); // result is in pArg0 (vTemp0)
1968 Wlc_BlastSubtract( pNew, pArg1, pArg2, nRangeMax, Abc_LitNot(CarryIn) ); // result is in pArg1 (vTemp1)
1969 Vec_IntClear( vRes );
1970 for ( j = 0; j < nRange; j++ )
1971 Vec_IntPush( vRes, Gia_ManHashMux(pNew, ModeIn, pArg0[j], pArg1[j]) );
1972 }
1973 else if ( pObj->Type == WLC_OBJ_ARI_MULTI )
1974 {
1975 if ( fUseOldMultiplierBlasting )
1976 {
1977 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
1978 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1979 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
1980 Wlc_BlastMultiplier2( pNew, pArg0, pArg1, nRange, vTemp2, vRes );
1981 Vec_IntShrink( vRes, nRange );
1982 }
1983 else
1984 {
1985 int fSigned = Wlc_ObjIsSignedFanin01(p, pObj);
1986 int nRangeMax = Abc_MaxInt(nRange0, nRange1);
1987 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, fSigned );
1988 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, fSigned );
1989 if ( nRange0 == nRange1 && Wlc_NtkCountConstBits(pArg0, nRangeMax) < Wlc_NtkCountConstBits(pArg1, nRangeMax) )
1990 ABC_SWAP( int *, pArg0, pArg1 );
1991 if ( pPar->fBooth )
1992 Wlc_BlastBooth( pNew, pArg0, pArg1, nRange0, nRange1, vRes, fSigned, pPar->fCla, NULL, pParIn->fVerbose );
1993 else if ( pPar->fCla )
1994 Wlc_BlastMultiplier3( pNew, pArg0, pArg1, nRange0, nRange1, vRes, Wlc_ObjIsSignedFanin01(p, pObj), pPar->fCla, NULL, pParIn->fVerbose );
1995 else
1996 Wlc_BlastMultiplier( pNew, pArg0, pArg1, nRangeMax, nRangeMax, vTemp2, vRes, fSigned );
1997 //Wlc_BlastMultiplierC( pNew, pArg0, pArg1, nRangeMax, nRangeMax, vTemp2, vRes, fSigned );
1998 if ( nRange > Vec_IntSize(vRes) )
1999 Vec_IntFillExtra( vRes, nRange, fSigned ? Vec_IntEntryLast(vRes) : 0 );
2000 else
2001 Vec_IntShrink( vRes, nRange );
2002 assert( Vec_IntSize(vRes) == nRange );
2003 }
2004 }
2005 else if ( pObj->Type == WLC_OBJ_ARI_DIVIDE || pObj->Type == WLC_OBJ_ARI_REM || pObj->Type == WLC_OBJ_ARI_MODULUS )
2006 {
2007 int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
2008 int fSigned = Wlc_ObjIsSignedFanin01(p, pObj);
2009 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, fSigned );
2010 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, fSigned );
2011 if ( fSigned )
2012 Wlc_BlastDividerSigned( pNew, pArg0, nRangeMax, pArg1, nRangeMax, pObj->Type == WLC_OBJ_ARI_DIVIDE, vRes, pPar->fNonRest );
2013 else
2014 Wlc_BlastDividerTop( pNew, pArg0, nRangeMax, pArg1, nRangeMax, pObj->Type == WLC_OBJ_ARI_DIVIDE, vRes, pPar->fNonRest );
2015 Vec_IntShrink( vRes, nRange );
2016 if ( !pPar->fDivBy0 )
2017 Wlc_BlastZeroCondition( pNew, pFans1, nRange1, vRes );
2018 }
2019 else if ( pObj->Type == WLC_OBJ_ARI_MINUS )
2020 {
2021 int nRangeMax = Abc_MaxInt( nRange0, nRange );
2022 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin0(p, pObj) );
2023 Wlc_BlastMinus( pNew, pArg0, nRangeMax, vRes );
2024 Vec_IntShrink( vRes, nRange );
2025 }
2026 else if ( pObj->Type == WLC_OBJ_ARI_POWER )
2027 {
2028 int nRangeMax = Abc_MaxInt(nRange0, nRange);
2029 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin0(p, pObj) );
2030 int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRange1, Wlc_ObjIsSignedFanin1(p, pObj) );
2031 Wlc_BlastPower( pNew, pArg0, nRangeMax, pArg1, nRange1, vTemp2, vRes );
2032 Vec_IntShrink( vRes, nRange );
2033 }
2034 else if ( pObj->Type == WLC_OBJ_ARI_SQRT )
2035 {
2036 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRange0 + (nRange0 & 1), 0 );
2037 nRange0 += (nRange0 & 1);
2038 if ( pPar->fNonRest )
2039 Wlc_BlastSqrtNR( pNew, pArg0, nRange0, vTemp2, vRes );
2040 else
2041 Wlc_BlastSqrt( pNew, pArg0, nRange0, vTemp2, vRes );
2042 if ( nRange > Vec_IntSize(vRes) )
2043 Vec_IntFillExtra( vRes, nRange, 0 );
2044 else
2045 Vec_IntShrink( vRes, nRange );
2046 }
2047 else if ( pObj->Type == WLC_OBJ_ARI_SQUARE )
2048 {
2049 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRange0, 0 );
2050 Wlc_BlastSquare( pNew, pArg0, nRange0, vTemp2, vRes );
2051 if ( nRange > Vec_IntSize(vRes) )
2052 Vec_IntFillExtra( vRes, nRange, 0 );
2053 else
2054 Vec_IntShrink( vRes, nRange );
2055 }
2056 else if ( pObj->Type == WLC_OBJ_DEC )
2057 {
2058 int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRange0, 0 );
2059 if ( pParIn->fBlastNew )
2060 Wlc_BlastDecoder2( pNew, pArg0, nRange0, vTemp2, vRes );
2061 else
2062 Wlc_BlastDecoder( pNew, pArg0, nRange0, vTemp2, vRes );
2063 if ( nRange > Vec_IntSize(vRes) )
2064 Vec_IntFillExtra( vRes, nRange, 0 );
2065 else
2066 Vec_IntShrink( vRes, nRange );
2067 }
2068 else if ( pObj->Type == WLC_OBJ_TABLE )
2069 Wlc_BlastTable( pNew, Wlc_ObjTable(p, pObj), pFans0, nRange0, nRange, vRes );
2070 else if ( pObj->Type == WLC_OBJ_LUT && p->vLutTruths )
2071 Wlc_BlastLut( pNew, Vec_WrdEntry(p->vLutTruths, Wlc_ObjId(p, pObj)), pFans0, nRange0, nRange, vRes );
2072 else assert( 0 );
2073 assert( Vec_IntSize(vBits) == Wlc_ObjCopy(p, i) );
2074 Vec_IntAppend( vBits, vRes );
2075 if ( vAddOutputs && !Wlc_ObjIsCo(pObj) &&
2076 (
2077 (pObj->Type >= WLC_OBJ_MUX && pObj->Type <= WLC_OBJ_ROTATE_L) ||
2078 (pObj->Type >= WLC_OBJ_COMP_EQU && pObj->Type <= WLC_OBJ_COMP_MOREEQU) ||
2079 (pObj->Type >= WLC_OBJ_ARI_ADD && pObj->Type <= WLC_OBJ_ARI_SQUARE)
2080 )
2081 )
2082 {
2083 Vec_IntAppend( vAddOutputs, vRes );
2084 Vec_IntPush( vAddObjs, Wlc_ObjId(p, pObj) );
2085 }
2086 p->nAnds[pObj->Type] += Gia_ManAndNum(pNew) - nAndPrev;
2087 }
2088 p->nAnds[0] = Gia_ManAndNum(pNew);
2089 assert( nBits == Vec_IntSize(vBits) );
2090 Vec_IntFree( vTemp0 );
2091 Vec_IntFree( vTemp1 );
2092 Vec_IntFree( vTemp2 );
2093 Vec_IntFree( vRes );
2094 // create flop boxes
2095 Wlc_NtkForEachFf2( p, pObj, i )
2096 {
2097 If_Box_t * pBox;
2098 char Buffer[100];
2099 float * pTable;
2100 Vec_Int_t * vTemp0 = Vec_IntAlloc( 100 );
2101 Vec_Int_t * vTemp1 = Vec_IntAlloc( 100 );
2102 int iLit, nRange = Wlc_ObjRange(pObj);
2103 int * pFans0, * pFans1, * pFans2, * pFans3;
2104 int iReset, iSet, iEnable;
2105 int nRangeIn = 2*nRange + 3; // D, reset, set, enable, Q
2106 int iSre = Wlc_ObjFaninId(pObj, 6);
2107
2108 assert( pObj->Type == WLC_OBJ_FF );
2109
2110 // create new box
2111 if ( vTables == NULL ) {
2112 Tim_ManSetDelayTables( pManTime, (vTables = Vec_PtrAlloc(100)) );
2113 Vec_PtrPush( vTables, NULL );
2114 }
2115 Tim_ManCreateBox( pManTime, curPo, nRangeIn, curPi, nRange, Vec_PtrSize(vTables), 0 );
2116 curPi += nRange;
2117 curPo += nRangeIn;
2118
2119 // create delay table
2120 pTable = ABC_ALLOC( float, 3 + nRange * nRangeIn );
2121 pTable[0] = Vec_PtrSize(vTables);
2122 pTable[1] = nRangeIn;
2123 pTable[2] = nRange;
2124 for ( k = 0; k < nRange * nRangeIn; k++ )
2125 pTable[3 + k] = 1.0;
2126 Vec_PtrPush( vTables, pTable );
2127
2128 // create combinational outputs in the normal manager
2129 pFans0 = Wlc_ObjFaninNum(pObj) > 0 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId0(pObj)) ) : NULL;
2130 pFans1 = Wlc_ObjFaninNum(pObj) > 2 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId(pObj,2)) ) : NULL; // reset
2131 pFans2 = Wlc_ObjFaninNum(pObj) > 3 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId(pObj,3)) ) : NULL; // set
2132 pFans3 = Wlc_ObjFaninNum(pObj) > 4 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId(pObj,4)) ) : NULL; // enable
2133 for ( k = 0; k < nRange; k++ )
2134 Gia_ManAppendCo( pNew, pFans0[k] );
2135 Gia_ManAppendCo( pNew, pFans1[0] );
2136 Gia_ManAppendCo( pNew, pFans2[0] );
2137 Gia_ManAppendCo( pNew, pFans3[0] );
2138 for ( k = 0; k < nRange; k++ )
2139 Gia_ManAppendCo( pNew, Gia_Obj2Lit(pNew, Gia_ManCi(pNew, Vec_IntEntry(vFf2Ci, i)+k)) );
2140
2141 // make sure there is enough primary inputs in the manager
2142 for ( k = Gia_ManPiNum(pExtra); k < nRangeIn; k++ )
2143 Gia_ManAppendCi( pExtra );
2144 // create combinational inputs
2145 for ( k = 0; k < nRange; k++ )
2146 Vec_IntPush( vTemp0, Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, k)) );
2147 iReset = Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, nRange+0));
2148 iSet = Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, nRange+1));
2149 iEnable = Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, nRange+2));
2150 for ( k = 0; k < nRange; k++ )
2151 Vec_IntPush( vTemp1, Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, nRangeIn-nRange+k)) );
2152
2153 // bit-blast in the external manager
2154 for ( k = 0; k < nRange; k++ )
2155 {
2156 // enable
2157 //iLitFlop = Gia_LitNotCond( Gia_ObjCopy(pObj), Gia_FlopIsOne(pObj) );
2158 //iLit = Gia_ManHashMux( Gia_ObjGia(pObj), Gia_FlopEnableCopy(pObj), iLit, iLitFlop );
2159 iLit = Gia_ManHashMux( pExtra, iEnable, Vec_IntEntry(vTemp0, k), Vec_IntEntry(vTemp1, k) );
2160 if ( iSre )
2161 {
2162 // reset
2163 //iLit = Gia_ManHashAnd( Gia_ObjGia(pObj), iLit, Gia_LitNot(Gia_FlopResetCopy(pObj)) );
2164 iLit = Gia_ManHashAnd( pExtra, iLit, Abc_LitNot(iReset) );
2165 // set
2166 //iLit = Gia_ManHashOr( Gia_ObjGia(pObj), iLit, Gia_FlopSetCopy(pObj) );
2167 iLit = Gia_ManHashOr( pExtra, iLit, iSet );
2168 }
2169 else
2170 {
2171 // set
2172 //iLit = Gia_ManHashOr( Gia_ObjGia(pObj), iLit, Gia_FlopSetCopy(pObj) );
2173 iLit = Gia_ManHashOr( pExtra, iLit, iSet );
2174 // reset
2175 //iLit = Gia_ManHashAnd( Gia_ObjGia(pObj), iLit, Gia_LitNot(Gia_FlopResetCopy(pObj)) );
2176 iLit = Gia_ManHashAnd( pExtra, iLit, Abc_LitNot(iReset) );
2177 }
2178 // create outputs in the external manager
2179 Gia_ManAppendCo( pExtra, iLit );
2180 }
2181
2182 // add box to the library
2183 sprintf( Buffer, "%s%03d", "ff_comb", 1+If_LibBoxNum(pBoxLib) );
2184 pBox = If_BoxStart( Abc_UtilStrsav(Buffer), 1+If_LibBoxNum(pBoxLib), nRangeIn, nRange, 0, 0, 0 );
2185 If_LibBoxAdd( pBoxLib, pBox );
2186 for ( k = 0; k < pBox->nPis * pBox->nPos; k++ )
2187 pBox->pDelays[k] = 1;
2188 Vec_IntFree( vTemp0 );
2189 Vec_IntFree( vTemp1 );
2190 }
2191 Vec_IntFree( vFf2Ci );
2192 // create COs
2193 if ( pPar->fCreateMiter || pPar->fCreateWordMiter )
2194 {
2195 int nPairs = 0, nBits = 0;
2196 Vec_Int_t * vOuts = Vec_IntAlloc( 100 );
2197 assert( Wlc_NtkPoNum(p) % 2 == 0 );
2198 Wlc_NtkForEachCo( p, pObj, i )
2199 {
2200 if ( pObj->fIsFi )
2201 {
2202 nRange = Wlc_ObjRange( pObj );
2203 pFans0 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj)) );
2204 if ( Wlc_ObjRangeIsReversed(pObj) )
2205 {
2206 for ( k = 0; k < nRange; k++ )
2207 Gia_ManAppendCo( pNew, pFans0[nRange-1-k] );
2208 }
2209 else
2210 {
2211 for ( k = 0; k < nRange; k++ )
2212 Gia_ManAppendCo( pNew, pFans0[k] );
2213 }
2214 nFFins += nRange;
2215 continue;
2216 }
2217 pObj2 = Wlc_NtkCo( p, ++i );
2218 nRange1 = Wlc_ObjRange( pObj );
2219 nRange2 = Wlc_ObjRange( pObj2 );
2220 assert( nRange1 == nRange2 );
2221 pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj)) );
2222 pFans2 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj2)) );
2223 if ( pPar->fCreateWordMiter )
2224 {
2225 Vec_IntClear( vOuts );
2226 if ( Wlc_ObjRangeIsReversed(pObj) )
2227 {
2228 for ( k = 0; k < nRange1; k++ )
2229 Vec_IntPushTwo( vOuts, pFans1[nRange1-1-k], pFans2[nRange2-1-k] );
2230 }
2231 else
2232 {
2233 for ( k = 0; k < nRange1; k++ )
2234 Vec_IntPushTwo( vOuts, pFans1[k], pFans2[k] );
2235 }
2236 Gia_ManAppendCo( pNew, Gia_ManHashDualMiter(pNew, vOuts) );
2237 }
2238 else
2239 {
2240 if ( Wlc_ObjRangeIsReversed(pObj) )
2241 {
2242 for ( k = 0; k < nRange1; k++ )
2243 {
2244 Gia_ManAppendCo( pNew, pFans1[nRange1-1-k] );
2245 Gia_ManAppendCo( pNew, pFans2[nRange2-1-k] );
2246 }
2247 }
2248 else
2249 {
2250 for ( k = 0; k < nRange1; k++ )
2251 {
2252 Gia_ManAppendCo( pNew, pFans1[k] );
2253 Gia_ManAppendCo( pNew, pFans2[k] );
2254 }
2255 }
2256 }
2257 nPairs++;
2258 nBits += nRange1;
2259 }
2260 Vec_IntFree( vOuts );
2261 if ( pPar->fCreateWordMiter )
2262 printf( "Derived an ordinary miter with %d bit-level outputs, one for each pair of word-level outputs.\n", nPairs );
2263 else
2264 printf( "Derived a dual-output miter with %d pairs of bits belonging to %d pairs of word-level outputs.\n", nBits, nPairs );
2265 }
2266 else
2267 {
2268 Wlc_NtkForEachCo( p, pObj, i )
2269 {
2270 // skip all outputs except the given ones
2271 if ( pPar->iOutput >= 0 && (i < pPar->iOutput || i >= pPar->iOutput + pPar->nOutputRange) )
2272 continue;
2273 // create additional PO literals
2274 if ( vAddOutputs && pObj->fIsFi )
2275 {
2276 Vec_IntForEachEntry( vAddOutputs, iLit, k )
2277 Gia_ManAppendCo( pNew, iLit );
2278 printf( "Created %d additional POs for %d interesting internal word-level variables.\n", Vec_IntSize(vAddOutputs), Vec_IntSize(vAddObjs) );
2279 Vec_IntFreeP( &vAddOutputs );
2280 }
2281 nRange = Wlc_ObjRange( pObj );
2282 pFans0 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj)) );
2283 if ( fVerbose )
2284 printf( "%s(%d) ", Wlc_ObjName(p, Wlc_ObjId(p, pObj)), Gia_ManCoNum(pNew) );
2285 if ( Wlc_ObjRangeIsReversed(pObj) )
2286 {
2287 for ( k = 0; k < nRange; k++ )
2288 Gia_ManAppendCo( pNew, pFans0[nRange-1-k] );
2289 }
2290 else
2291 {
2292 for ( k = 0; k < nRange; k++ )
2293 Gia_ManAppendCo( pNew, pFans0[k] );
2294 }
2295 if ( pObj->fIsFi )
2296 nFFins += nRange;
2297 }
2298 if ( fVerbose )
2299 printf( "\n" );
2300 }
2301 //Vec_IntErase( vBits );
2302 //Vec_IntErase( &p->vCopies );
2303 // set the number of registers
2304 if ( Vec_IntSize(&p->vFfs2) > 0 )
2305 {
2306 assert( nFFins == 0 && nFFouts == 0 );
2307 // complement flop inputs whose init state is 1
2308 for ( i = 0; i < nFf2Regs; i++ )
2309 Gia_ManAppendCo( pNew, Gia_ManAppendCi(pNew) );
2310 Gia_ManSetRegNum( pNew, nFf2Regs );
2311 }
2312 else
2313 {
2314 assert( nFFins == nFFouts );
2315 Gia_ManSetRegNum( pNew, nFFins );
2316 }
2317 // finalize AIG
2318 if ( !pPar->fGiaSimple && !pPar->fNoCleanup )
2319 {
2320 pNew = Gia_ManCleanup( pTemp = pNew );
2321 Gia_ManDupRemapLiterals( vBits, pTemp );
2322 //printf( "Cutoff ID %d became %d.\n", 75, Abc_Lit2Var(Gia_ManObj(pTemp, 73)->Value) );
2323 Gia_ManStop( pTemp );
2324 }
2325 // transform AIG with init state
2326 if ( p->pInits )
2327 {
2328 if ( (int)strlen(p->pInits) != Gia_ManRegNum(pNew) )
2329 {
2330 printf( "The number of init values (%d) does not match the number of flops (%d).\n", (int)strlen(p->pInits), Gia_ManRegNum(pNew) );
2331 printf( "It is assumed that the AIG has constant 0 initial state.\n" );
2332 }
2333 else
2334 {
2335 pNew = Gia_ManDupZeroUndc( pTemp = pNew, p->pInits, pPar->fSaveFfNames ? 1+Gia_ManRegNum(pNew) : 0, pPar->fGiaSimple, pPar->fVerbose );
2336 Gia_ManDupRemapLiterals( vBits, pTemp );
2337 Gia_ManStop( pTemp );
2338 }
2339 }
2340 // finalize AIG with boxes
2341 if ( Vec_IntSize(&p->vFfs2) > 0 )
2342 {
2343 curPo += nBitCos + nFf2Regs;
2344 assert( curPi == Tim_ManCiNum(pManTime) );
2345 assert( curPo == Tim_ManCoNum(pManTime) );
2346 // finalize the extra AIG
2347 pExtra = Gia_ManCleanup( pTemp = pExtra );
2348 Gia_ManStop( pTemp );
2349 assert( Gia_ManPoNum(pExtra) == Gia_ManCiNum(pNew) - nBitCis - nFf2Regs );
2350 // attach
2351 pNew->pAigExtra = pExtra;
2352 pNew->pManTime = pManTime;
2353 // normalize AIG
2354 pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
2355 Gia_ManTransferTiming( pNew, pTemp );
2356 Gia_ManStop( pTemp );
2357 //Tim_ManPrint( pManTime );
2358 }
2359 if ( pPar->vBoxIds )
2360 {
2361 curPo += nBitCos;
2362 assert( curPi == Tim_ManCiNum(pManTime) );
2363 assert( curPo == Tim_ManCoNum(pManTime) );
2364 // finalize the extra AIG
2365 pExtra = Gia_ManCleanup( pTemp = pExtra );
2366 Gia_ManStop( pTemp );
2367 assert( Gia_ManPoNum(pExtra) == Gia_ManCiNum(pNew) - nBitCis - nFf2Regs );
2368 // attach
2369 pNew->pAigExtra = pExtra;
2370 pNew->pManTime = pManTime;
2371 // normalize AIG
2372 pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
2373 Gia_ManTransferTiming( pNew, pTemp );
2374 Gia_ManStop( pTemp );
2375 //Tim_ManPrint( pManTime );
2376 }
2377 // create input names
2378 pNew->vNamesIn = Vec_PtrAlloc( Gia_ManCiNum(pNew) );
2379 Wlc_NtkForEachCi( p, pObj, i )
2380 if ( Wlc_ObjIsPi(pObj) )
2381 {
2382 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2383 nRange = Wlc_ObjRange( pObj );
2384 if ( fSkipBitRange && nRange == 1 )
2385 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(pName) );
2386 else
2387 for ( k = 0; k < nRange; k++ )
2388 {
2389 char Buffer[1000];
2390 sprintf( Buffer, "%s[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2391 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
2392 //printf( "Writing %s\n", Buffer );
2393 }
2394 }
2395 if ( p->pInits )
2396 {
2397 int Length = strlen(p->pInits);
2398 for ( i = 0; i < Length; i++ )
2399 if ( p->pInits[i] == 'x' || p->pInits[i] == 'X' )
2400 {
2401 char Buffer[100];
2402 sprintf( Buffer, "_%s_abc_%d_", "init", i );
2403 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
2404 fAdded = 1;
2405 }
2406 if ( pPar->fSaveFfNames )
2407 for ( i = 0; i < 1+Length; i++ )
2408 Vec_PtrPush( pNew->vNamesIn, NULL );
2409 }
2410 Wlc_NtkForEachCi( p, pObj, i )
2411 if ( !Wlc_ObjIsPi(pObj) )
2412 {
2413 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2414 nRange = Wlc_ObjRange( pObj );
2415 if ( fSkipBitRange && nRange == 1 )
2416 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(pName) );
2417 else
2418 for ( k = 0; k < nRange; k++ )
2419 {
2420 char Buffer[1000];
2421 sprintf( Buffer, "%s[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2422 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
2423 }
2424 }
2425 Wlc_NtkForEachFf2( p, pObj, i )
2426 {
2427 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2428 nRange = Wlc_ObjRange( pObj );
2429 if ( fSkipBitRange && nRange == 1 )
2430 {
2431 char Buffer[1000];
2432 sprintf( Buffer, "%s_fo", pName );
2433 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
2434 }
2435 else
2436 for ( k = 0; k < nRange; k++ )
2437 {
2438 char Buffer[1000];
2439 sprintf( Buffer, "%s_fo[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2440 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
2441 }
2442 }
2443 Wlc_NtkForEachFf2( p, pObj, i )
2444 {
2445 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2446 nRange = Wlc_ObjRange( pObj );
2447 if ( fSkipBitRange && nRange == 1 )
2448 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(pName) );
2449 else
2450 for ( k = 0; k < nRange; k++ )
2451 {
2452 char Buffer[1000];
2453 sprintf( Buffer, "%s[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2454 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
2455 }
2456 }
2457 if ( p->pInits && pPar->fSaveFfNames )
2458 {
2459 char * pName;
2460 int Length = (int)strlen(p->pInits);
2461 int NameStart = Vec_PtrSize(pNew->vNamesIn)-Length;
2462 int NullStart = Vec_PtrSize(pNew->vNamesIn)-2*Length;
2463 int SepStart = Vec_PtrSize(pNew->vNamesIn)-2*Length-1;
2464 assert( Vec_PtrEntry(pNew->vNamesIn, SepStart) == NULL );
2465 Vec_PtrWriteEntry( pNew->vNamesIn, SepStart, Abc_UtilStrsav("_abc_190121_abc_") );
2466 for ( i = 0; i < Length; i++ )
2467 {
2468 char Buffer[100];
2469 sprintf( Buffer, "%c%s", p->pInits[i], (char *)Vec_PtrEntry(pNew->vNamesIn, NameStart+i) );
2470 assert( Vec_PtrEntry(pNew->vNamesIn, NullStart+i) == NULL );
2471 Vec_PtrWriteEntry( pNew->vNamesIn, NullStart+i, Abc_UtilStrsav(Buffer) );
2472 }
2473 Vec_PtrForEachEntry( char *, pNew->vNamesIn, pName, i )
2474 assert( pName != NULL );
2475 }
2476 if ( p->pInits && fAdded )
2477 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav("abc_reset_flop") );
2478 if ( pPar->vBoxIds )
2479 {
2480 Wlc_NtkForEachObjVec( pPar->vBoxIds, p, pObj, i )
2481 {
2482 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2483 nRange = Wlc_ObjRange( pObj );
2484 assert( nRange > 1 );
2485 for ( k = 0; k < nRange; k++ )
2486 {
2487 char Buffer[1000];
2488 sprintf( Buffer, "%s[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2489 Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
2490 }
2491 }
2492 }
2493 assert( Vec_PtrSize(pNew->vNamesIn) == Gia_ManCiNum(pNew) );
2494 // create output names
2495 pNew->vNamesOut = Vec_PtrAlloc( Gia_ManCoNum(pNew) );
2496 Wlc_NtkForEachFf2( p, pObj, i )
2497 {
2498 int iFanin;
2499 Wlc_ObjForEachFanin( pObj, iFanin, b )
2500 {
2501 char * pName = Wlc_ObjName(p, iFanin);
2502 nRange = Wlc_ObjRange( Wlc_NtkObj(p, iFanin) );
2503 if ( fSkipBitRange && nRange == 1 )
2504 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(pName) );
2505 else
2506 for ( k = 0; k < nRange; k++ )
2507 {
2508 char Buffer[1000];
2509 Wlc_Obj_t * pFanin = Wlc_NtkObj(p, iFanin);
2510 sprintf( Buffer, "%s[%d]", pName, pFanin->Beg < pFanin->End ? pFanin->Beg+k : pFanin->Beg-k );
2511 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2512 }
2513 if ( b == 3 )
2514 break;
2515 }
2516 {
2517 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2518 nRange = Wlc_ObjRange( pObj );
2519 if ( fSkipBitRange && nRange == 1 )
2520 {
2521 char Buffer[1000];
2522 sprintf( Buffer, "%s_in", pName );
2523 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2524 }
2525 else
2526 for ( k = 0; k < nRange; k++ )
2527 {
2528 char Buffer[1000];
2529 sprintf( Buffer, "%s_in[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2530 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2531 }
2532 }
2533 }
2534 if ( pPar->vBoxIds )
2535 {
2536 Wlc_NtkForEachObjVec( pPar->vBoxIds, p, pObj, i )
2537 {
2538 int iFanin, f;
2539 Wlc_ObjForEachFanin( pObj, iFanin, f )
2540 {
2541 char * pName = Wlc_ObjName(p, iFanin);
2542 nRange = Wlc_ObjRange( Wlc_NtkObj(p, iFanin) );
2543 assert( nRange >= 1 );
2544 for ( k = 0; k < nRange; k++ )
2545 {
2546 char Buffer[1000];
2547 Wlc_Obj_t * pFanin = Wlc_NtkObj(p, iFanin);
2548 sprintf( Buffer, "%s[%d]", pName, pFanin->Beg < pFanin->End ? pFanin->Beg+k : pFanin->Beg-k );
2549 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2550 }
2551 }
2552 }
2553 }
2554 // add real primary outputs
2555 Wlc_NtkForEachCo( p, pObj, i )
2556 if ( Wlc_ObjIsPo(pObj) )
2557 {
2558 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2559 nRange = Wlc_ObjRange( pObj );
2560 if ( pPar->fCreateWordMiter )
2561 {
2562 Wlc_Obj_t * pObj2 = Wlc_NtkCo( p, ++i );
2563 char * pName2 = Wlc_ObjName(p, Wlc_ObjId(p, pObj2));
2564 char Buffer[1000];
2565 sprintf( Buffer, "%s_xor_%s", pName, pName2 );
2566 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2567 //printf( "Adding output %s\n", Buffer );
2568 }
2569 else if ( pPar->fCreateMiter && nRange > 1 )
2570 {
2571 Wlc_Obj_t * pObj2 = Wlc_NtkCo( p, ++i );
2572 char * pName2 = Wlc_ObjName(p, Wlc_ObjId(p, pObj2));
2573 int nRange1 = Wlc_ObjRange( pObj );
2574 assert( nRange == nRange1 );
2575 for ( k = 0; k < nRange; k++ )
2576 {
2577 char Buffer[1000];
2578 sprintf( Buffer, "%s[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2579 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2580 sprintf( Buffer, "%s[%d]", pName2, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2581 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2582 }
2583 }
2584 else
2585 {
2586 if ( fSkipBitRange && nRange == 1 )
2587 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(pName) );
2588 else
2589 for ( k = 0; k < nRange; k++ )
2590 {
2591 char Buffer[1000];
2592 sprintf( Buffer, "%s[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2593 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2594 }
2595 }
2596 }
2597 if ( vAddObjs )
2598 {
2599 // add internal primary outputs
2600 Wlc_NtkForEachObjVec( vAddObjs, p, pObj, i )
2601 {
2602 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2603 nRange = Wlc_ObjRange( pObj );
2604 if ( fSkipBitRange && nRange == 1 )
2605 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(pName) );
2606 else
2607 for ( k = 0; k < nRange; k++ )
2608 {
2609 char Buffer[1000];
2610 sprintf( Buffer, "%s[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2611 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2612 }
2613 }
2614 Vec_IntFreeP( &vAddObjs );
2615 }
2616 // add flop outputs
2617 if ( fAdded )
2618 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav("abc_reset_flop_in") );
2619 Wlc_NtkForEachCo( p, pObj, i )
2620 if ( !Wlc_ObjIsPo(pObj) )
2621 {
2622 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2623 nRange = Wlc_ObjRange( pObj );
2624 if ( fSkipBitRange && nRange == 1 )
2625 {
2626 char Buffer[1000];
2627 sprintf( Buffer, "%s_fi", pName );
2628 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2629 }
2630 else
2631 for ( k = 0; k < nRange; k++ )
2632 {
2633 char Buffer[1000];
2634 sprintf( Buffer, "%s_fi[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2635 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2636 }
2637 }
2638 Wlc_NtkForEachFf2( p, pObj, i )
2639 {
2640 char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
2641 nRange = Wlc_ObjRange( pObj );
2642 if ( fSkipBitRange && nRange == 1 )
2643 {
2644 char Buffer[1000];
2645 sprintf( Buffer, "%s_fi", pName );
2646 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2647 }
2648 else
2649 for ( k = 0; k < nRange; k++ )
2650 {
2651 char Buffer[1000];
2652 sprintf( Buffer, "%s_fi[%d]", pName, pObj->Beg < pObj->End ? pObj->Beg+k : pObj->Beg-k );
2653 Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
2654 }
2655 }
2656 assert( Vec_PtrSize(pNew->vNamesOut) == Gia_ManCoNum(pNew) );
2657
2658 // replace the current library
2659 if ( pBoxLib )
2660 {
2662 Abc_FrameSetLibBox( pBoxLib );
2663 }
2664
2665 //pNew->pSpec = Abc_UtilStrsav( p->pSpec ? p->pSpec : p->pName );
2666 // dump the miter parts
2667 if ( 0 )
2668 {
2669 char pFileName0[1000], pFileName1[1000];
2670 char * pNameGeneric = Extra_FileNameGeneric( p->pSpec );
2671 Vec_Int_t * vOrder = Vec_IntStartNatural( Gia_ManPoNum(pNew) );
2672 Gia_Man_t * pGia0 = Gia_ManDupCones( pNew, Vec_IntArray(vOrder), Vec_IntSize(vOrder)/2, 0 );
2673 Gia_Man_t * pGia1 = Gia_ManDupCones( pNew, Vec_IntArray(vOrder) + Vec_IntSize(vOrder)/2, Vec_IntSize(vOrder)/2, 0 );
2674 assert( Gia_ManPoNum(pNew) % 2 == 0 );
2675 sprintf( pFileName0, "%s_lhs_.aig", pNameGeneric );
2676 sprintf( pFileName1, "%s_rhs_.aig", pNameGeneric );
2677 Gia_AigerWrite( pGia0, pFileName0, 0, 0, 0 );
2678 Gia_AigerWrite( pGia1, pFileName1, 0, 0, 0 );
2679 Gia_ManStop( pGia0 );
2680 Gia_ManStop( pGia1 );
2681 Vec_IntFree( vOrder );
2682 ABC_FREE( pNameGeneric );
2683 printf( "Dumped two parts of the miter into files \"%s\" and \"%s\".\n", pFileName0, pFileName1 );
2684 }
2685 //Wlc_NtkPrintNameArray( pNew->vNamesIn );
2686 //Wlc_NtkPrintNameArray( pNew->vNamesOut );
2687 if ( pPar->vBoxIds )
2688 {
2689 Vec_PtrFreeFree( pNew->vNamesIn ); pNew->vNamesIn = NULL;
2690 Vec_PtrFreeFree( pNew->vNamesOut ); pNew->vNamesOut = NULL;
2691 }
2692 pNew->vRegClasses = vRegClasses;
2693 return pNew;
2694}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
int nTotal
DECLARATIONS ///.
Definition cutTruth.c:37
ABC_DLL void Abc_FrameSetLibBox(void *pLib)
Definition mainFrame.c:94
ABC_DLL void * Abc_FrameReadLibBox()
Definition mainFrame.c:58
int Gia_ManHashDualMiter(Gia_Man_t *p, Vec_Int_t *vOuts)
Definition giaHash.c:809
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
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
void Gia_ManDupRemapLiterals(Vec_Int_t *vLits, Gia_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition giaDup.c:54
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition giaHash.c:692
Gia_Man_t * Gia_ManDupCones(Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
Definition giaDup.c:3880
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
Definition giaTim.c:139
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
Gia_Man_t * Gia_ManDupZeroUndc(Gia_Man_t *p, char *pInit, int nNewPis, int fGiaSimple, int fVerbose)
Definition giaDup.c:3569
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
Definition giaAiger.c:1595
struct If_LibBox_t_ If_LibBox_t
Definition if.h:83
If_Box_t * If_BoxStart(char *pName, int Id, int nPis, int nPos, int fSeq, int fBlack, int fOuter)
FUNCTION DEFINITIONS ///.
Definition ifLibBox.c:49
int If_LibBoxNum(If_LibBox_t *p)
Definition ifLibBox.c:144
void If_LibBoxAdd(If_LibBox_t *p, If_Box_t *pBox)
Definition ifLibBox.c:136
struct If_Box_t_ If_Box_t
Definition if.h:364
void If_LibBoxFree(If_LibBox_t *p)
Definition ifLibBox.c:98
If_LibBox_t * If_LibBoxStart()
Definition ifLibBox.c:86
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Gia_Man_t * pAigExtra
Definition gia.h:167
Vec_Ptr_t * vNamesIn
Definition gia.h:181
Vec_Ptr_t * vNamesOut
Definition gia.h:182
int fGiaSimple
Definition gia.h:116
Vec_Int_t * vRegClasses
Definition gia.h:160
void * pManTime
Definition gia.h:194
char * pName
Definition gia.h:99
int nPos
Definition if.h:374
int nPis
Definition if.h:373
int * pDelays
Definition if.h:375
int fNonRest
Definition wlc.h:218
int fNoCleanup
Definition wlc.h:221
int fGiaSimple
Definition wlc.h:214
int fAddOutputs
Definition wlc.h:215
int fDivBy0
Definition wlc.h:220
int fDecMuxes
Definition wlc.h:224
int fSaveFfNames
Definition wlc.h:225
int fCreateWordMiter
Definition wlc.h:223
int fCreateMiter
Definition wlc.h:222
int nOutputRange
Definition wlc.h:211
int fCla
Definition wlc.h:219
Vec_Int_t * vBoxIds
Definition wlc.h:228
int fVerbose
Definition wlc.h:227
int fBlastNew
Definition wlc.h:226
int iOutput
Definition wlc.h:210
int fBooth
Definition wlc.h:217
unsigned Type
Definition wlc.h:121
void Tim_ManSetDelayTables(Tim_Man_t *p, Vec_Ptr_t *vDelayTables)
Definition timMan.c:765
int Tim_ManBoxNum(Tim_Man_t *p)
Definition timMan.c:722
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition tim.h:92
int Tim_ManCiNum(Tim_Man_t *p)
Definition timMan.c:700
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable, int fBlack)
ITERATORS ///.
Definition timBox.c:44
void Tim_ManBoxSetCopy(Tim_Man_t *p, int iBox, int iCopy)
Definition timBox.c:291
Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition timMan.c:45
int Tim_ManCoNum(Tim_Man_t *p)
Definition timMan.c:704
int strlen()
char * sprintf()
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
int Wlc_BlastAdder(Gia_Man_t *pNew, int *pAdd0, int *pAdd1, int nBits, int Carry)
Definition wlcBlast.c:429
void Wlc_BlastDividerSigned(Gia_Man_t *pNew, int *pNum, int nNum, int *pDiv, int nDiv, int fQuo, Vec_Int_t *vRes, int fNonRest)
Definition wlcBlast.c:764
int Wlc_NtkPrepareBits(Wlc_Ntk_t *p)
Definition wlcBlast.c:67
Vec_Int_t * Wlc_BlastDecoder2(Gia_Man_t *pNew, int *pNum, int nNum, Vec_Int_t *vTmp, Vec_Int_t *vRes)
Definition wlcBlast.c:1234
void Wlc_BlastMultiplier2(Gia_Man_t *pNew, int *pArg0, int *pArg1, int nBits, Vec_Int_t *vTemp, Vec_Int_t *vRes)
Definition wlcBlast.c:613
char * Wlc_NtkMuxTreeString(int nIns)
Definition wlcBlast.c:171
int Wlc_NtkMuxTree2(Gia_Man_t *pNew, int *pCtrl, int nCtrl, Vec_Int_t *vData, Vec_Int_t *vAnds, Vec_Int_t *vTemp)
Definition wlcBlast.c:126
void Wlc_BlastPower(Gia_Man_t *pNew, int *pNum, int nNum, int *pExp, int nExp, Vec_Int_t *vTemp, Vec_Int_t *vRes)
Definition wlcBlast.c:844
void Wlc_BlastZeroCondition(Gia_Man_t *pNew, int *pDiv, int nDiv, Vec_Int_t *vRes)
Definition wlcBlast.c:799
void Wlc_BlastShiftRight(Gia_Man_t *pNew, int *pNum, int nNum, int *pShift, int nShift, int fSticky, Vec_Int_t *vRes)
Definition wlcBlast.c:228
ABC_NAMESPACE_IMPL_START int Wlc_NtkCountConstBits(int *pArray, int nSize)
DECLARATIONS ///.
Definition wlcBlast.c:48
void Wlc_BlastRotateLeft(Gia_Man_t *pNew, int *pNum, int nNum, int *pShift, int nShift, Vec_Int_t *vRes)
Definition wlcBlast.c:291
void Wlc_BlastBooth(Gia_Man_t *pNew, int *pArgA, int *pArgB, int nArgA, int nArgB, Vec_Int_t *vRes, int fSigned, int fCla, Vec_Wec_t **pvProds, int fVerbose)
Definition wlcBlast.c:1242
int Wlc_BlastLessSigned(Gia_Man_t *pNew, int *pArg0, int *pArg1, int nBits)
Definition wlcBlast.c:372
void Wlc_BlastSquare(Gia_Man_t *pNew, int *pNum, int nNum, Vec_Int_t *vTmp, Vec_Int_t *vRes)
Definition wlcBlast.c:1174
void Wlc_BlastMinus(Gia_Man_t *pNew, int *pNum, int nNum, Vec_Int_t *vRes)
Definition wlcBlast.c:603
void Wlc_NtkMuxTree3DecsFree(Vec_Int_t **pvDecs, char *pNums)
Definition wlcBlast.c:164
void Wlc_BlastSqrtNR(Gia_Man_t *pNew, int *pNum, int nNum, Vec_Int_t *vTmp, Vec_Int_t *vRes)
Definition wlcBlast.c:899
void Wlc_BlastRotateRight(Gia_Man_t *pNew, int *pNum, int nNum, int *pShift, int nShift, Vec_Int_t *vRes)
Definition wlcBlast.c:281
void Wlc_BlastMultiplier3(Gia_Man_t *pNew, int *pArgA, int *pArgB, int nArgA, int nArgB, Vec_Int_t *vRes, int fSigned, int fCla, Vec_Wec_t **pvProds, int fVerbose)
Definition wlcBlast.c:1140
void Wlc_BlastLut(Gia_Man_t *pNew, word Truth, int *pFans, int nFans, int nOuts, Vec_Int_t *vRes)
Definition wlcBlast.c:830
void Wlc_BlastShiftLeft(Gia_Man_t *pNew, int *pNum, int nNum, int *pShift, int nShift, int fSticky, Vec_Int_t *vRes)
Definition wlcBlast.c:264
void Wlc_BlastSqrt(Gia_Man_t *pNew, int *pNum, int nNum, Vec_Int_t *vTmp, Vec_Int_t *vRes)
Definition wlcBlast.c:868
Vec_Int_t ** Wlc_NtkMuxTree3DecsDerive(Gia_Man_t *p, int *pIns, int nIns, char *pNums)
Definition wlcBlast.c:153
int Wlc_NtkMuxTree_rec(Gia_Man_t *pNew, int *pCtrl, int nCtrl, Vec_Int_t *vData, int Shift)
Definition wlcBlast.c:105
int Wlc_NtkMuxTree3(Gia_Man_t *p, Vec_Int_t *vData, char *pNums, Vec_Int_t **pvDecs)
Definition wlcBlast.c:136
void Wlc_BlastDividerTop(Gia_Man_t *pNew, int *pNum, int nNum, int *pDiv, int nDiv, int fQuo, Vec_Int_t *vRes, int fNonRest)
Definition wlcBlast.c:757
void Wlc_BlastSubtract(Gia_Man_t *pNew, int *pAdd0, int *pAdd1, int nBits, int Carry)
Definition wlcBlast.c:436
void Wlc_BlastTable(Gia_Man_t *pNew, word *pTable, int *pFans, int nFans, int nOuts, Vec_Int_t *vRes)
Definition wlcBlast.c:805
void Wlc_BlastMultiplier(Gia_Man_t *pNew, int *pArgA, int *pArgB, int nArgA, int nArgB, Vec_Int_t *vTemp, Vec_Int_t *vRes, int fSigned)
Definition wlcBlast.c:635
int Wlc_BlastLess(Gia_Man_t *pNew, int *pArg0, int *pArg1, int nBits)
Definition wlcBlast.c:364
int Wlc_BlastLess3(Gia_Man_t *p, int *pArg1, int *pArg0, int nBits)
Definition wlcBlast.c:377
int Wlc_BlastLessSigned3(Gia_Man_t *pNew, int *pArg0, int *pArg1, int nBits)
Definition wlcBlast.c:396
int Wlc_BlastReduction(Gia_Man_t *pNew, int *pFans, int nFans, int Type)
Definition wlcBlast.c:305
int * Wlc_VecLoadFanins(Vec_Int_t *vOut, int *pFanins, int nFanins, int nTotal, int fSigned)
Definition wlcBlast.c:86
void Wlc_BlastAdderCLA(Gia_Man_t *pNew, int *pAdd0, int *pAdd1, int nBits, int fSign, int CarryIn)
Definition wlcBlast.c:492
void Wlc_BlastDecoder(Gia_Man_t *pNew, int *pNum, int nNum, Vec_Int_t *vTmp, Vec_Int_t *vRes)
Definition wlcBlast.c:1199
#define Wlc_NtkForEachFf2(p, pFf, i)
Definition wlc.h:372
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
Definition wlcNtk.c:225
#define Wlc_ObjForEachFaninReverse(pObj, iFanin, i)
Definition wlc.h:379
struct Wlc_BstPar_t_ Wlc_BstPar_t
Definition wlc.h:207
Here is the caller graph for this function:

◆ Wlc_NtkCleanMarks()

void Wlc_NtkCleanMarks ( Wlc_Ntk_t * p)
extern

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

Synopsis [Select the cone of the given output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1135 of file wlcNtk.c.

1136{
1137 Wlc_Obj_t * pObj;
1138 int i;
1139 Wlc_NtkForEachObj( p, pObj, i )
1140 pObj->Mark = 0;
1141}
Here is the caller graph for this function:

◆ Wlc_NtkCollectAddMult()

Vec_Int_t * Wlc_NtkCollectAddMult ( Wlc_Ntk_t * p,
Wlc_BstPar_t * pPar,
int * pCountA,
int * CountM )
extern

Definition at line 54 of file wlcUif.c.

55{
56 Vec_Int_t * vBoxIds;
57 Wlc_Obj_t * pObj; int i;
58 *pCountA = *pCountM = 0;
59 if ( pPar->nAdderLimit == 0 && pPar->nMultLimit == 0 )
60 return NULL;
61 vBoxIds = Vec_IntAlloc( 100 );
62 Wlc_NtkForEachObj( p, pObj, i )
63 {
64 if ( pObj->Type == WLC_OBJ_ARI_ADD && pPar->nAdderLimit && Wlc_ObjRange(pObj) >= pPar->nAdderLimit )
65 Vec_IntPush( vBoxIds, i ), (*pCountA)++;
66 else if ( pObj->Type == WLC_OBJ_ARI_MULTI && pPar->nMultLimit && Wlc_ObjRange(pObj) >= pPar->nMultLimit )
67 Vec_IntPush( vBoxIds, i ), (*pCountM)++;
68 }
69 if ( Vec_IntSize( vBoxIds ) > 0 )
70 {
71 Wlc_NtkCollectBoxes( p, vBoxIds );
72 return vBoxIds;
73 }
74 Vec_IntFree( vBoxIds );
75 return NULL;
76}
int nMultLimit
Definition wlc.h:213
int nAdderLimit
Definition wlc.h:212
ABC_NAMESPACE_IMPL_START void Wlc_NtkCollectBoxes(Wlc_Ntk_t *p, Vec_Int_t *vBoxIds)
DECLARATIONS ///.
Definition wlcUif.c:44
Here is the call graph for this function:

◆ Wlc_NtkCollectMemory()

Vec_Int_t * Wlc_NtkCollectMemory ( Wlc_Ntk_t * p,
int fClean )
extern

Definition at line 216 of file wlcMem.c.

217{
218 Wlc_Obj_t * pObj; int i;
219 Vec_Int_t * vMemSizes = Wlc_NtkCollectMemSizes( p );
220 Vec_Int_t * vMemObjs = Vec_IntAlloc( 10 );
221 Wlc_NtkForEachObj( p, pObj, i )
222 {
223 if ( Wlc_ObjType(pObj) == WLC_OBJ_WRITE || Wlc_ObjType(pObj) == WLC_OBJ_READ )
224 Vec_IntPush( vMemObjs, i );
225 else if ( Vec_IntFind(vMemSizes, Wlc_ObjRange(pObj)) >= 0 )
226 Vec_IntPush( vMemObjs, i );
227 }
228 Vec_IntFree( vMemSizes );
229 Vec_IntSort( vMemObjs, 0 );
230 //Wlc_NtkPrintNodeArray( p, vMemObjs );
231 if ( fClean )
232 {
233 Vec_Int_t * vTemp;
234 vMemObjs = Wlc_NtkCleanObjects( p, vTemp = vMemObjs );
235 Vec_IntFree( vTemp );
236 }
237 return vMemObjs;
238}
Vec_Int_t * Wlc_NtkCollectMemSizes(Wlc_Ntk_t *p)
Definition wlcMem.c:175
Vec_Int_t * Wlc_NtkCleanObjects(Wlc_Ntk_t *p, Vec_Int_t *vObjs)
Definition wlcMem.c:203
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCollectMultipliers()

Vec_Int_t * Wlc_NtkCollectMultipliers ( Wlc_Ntk_t * p)
extern

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

Synopsis [Collect IDs of the multipliers.]

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file wlcUif.c.

122{
123 Wlc_Obj_t * pObj; int i;
124 Vec_Int_t * vBoxIds = Vec_IntAlloc( 100 );
125 Wlc_NtkForEachObj( p, pObj, i )
126 if ( pObj->Type == WLC_OBJ_ARI_MULTI )
127 Vec_IntPush( vBoxIds, i );
128 if ( Vec_IntSize( vBoxIds ) > 0 )
129 return vBoxIds;
130 Vec_IntFree( vBoxIds );
131 return NULL;
132}
Here is the caller graph for this function:

◆ Wlc_NtkCountObjBits()

int Wlc_NtkCountObjBits ( Wlc_Ntk_t * p,
Vec_Int_t * vPisNew )
extern

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

Synopsis [This procedure simply count the number of PPI bits.]

Description []

SideEffects []

SeeAlso []

Definition at line 1395 of file wlcNtk.c.

1396{
1397 Wlc_Obj_t * pObj;
1398 int i, Count = 0;
1399 Wlc_NtkForEachObjVec( vPisNew, p, pObj, i )
1400 Count += Wlc_ObjRange(pObj);
1401 return Count;
1402}
Here is the caller graph for this function:

◆ Wlc_NtkCountRealPis()

int Wlc_NtkCountRealPis ( Wlc_Ntk_t * p)
extern

Definition at line 445 of file wlcNtk.c.

446{
447 Wlc_Obj_t * pObj;
448 int i, Count = 0;
449 Wlc_NtkMarkCone( p, -1, -1, 1, 0 );
450 Wlc_NtkForEachPi( p, pObj, i )
451 Count += pObj->Mark;
453 return Count;
454}
void Wlc_NtkCleanMarks(Wlc_Ntk_t *p)
Definition wlcNtk.c:1135
void Wlc_NtkMarkCone(Wlc_Ntk_t *p, int iCoId, int Range, int fSeq, int fAllPis)
Definition wlcNtk.c:1181
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCreateLevels()

int Wlc_NtkCreateLevels ( Wlc_Ntk_t * p)
extern

Definition at line 372 of file wlcNtk.c.

373{
374 Wlc_Obj_t * pObj; int i, LeveMax = 0;
375 Vec_IntFill( &p->vLevels, Wlc_NtkObjNumMax(p), 0 );
376 Wlc_NtkForEachObj( p, pObj, i )
377 Wlc_NtkCreateLevels_rec( p, pObj );
378 Wlc_NtkForEachObj( p, pObj, i )
379 if ( !Wlc_ObjIsCi(pObj) && Wlc_ObjFaninNum(pObj) )
380 Vec_IntAddToEntry( &p->vLevels, i, 1 );
381 LeveMax = Vec_IntFindMax( &p->vLevels );
382 Wlc_NtkForEachFf2( p, pObj, i )
383 Vec_IntWriteEntry( &p->vLevels, Wlc_ObjId(p, pObj), LeveMax+1 );
384 //Wlc_NtkPrintObjects( p );
385 return LeveMax+1;
386}
void Wlc_NtkCreateLevels_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:361
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCreateLevelsRev()

int Wlc_NtkCreateLevelsRev ( Wlc_Ntk_t * p)
extern

Definition at line 326 of file wlcNtk.c.

327{
328 Wlc_Obj_t * pObj;
329 int i, k, iFanin, Level, LevelMax = 0;
330 Vec_IntFill( &p->vLevels, Wlc_NtkObjNumMax(p), 0 );
331 Wlc_NtkForEachObjReverse( p, pObj, i )
332 {
333 if ( Wlc_ObjIsCi(pObj) )
334 continue;
335 Level = Wlc_ObjLevel(p, pObj) + 1;
336 Wlc_ObjForEachFanin( pObj, iFanin, k )
337 Vec_IntUpdateEntry( &p->vLevels, iFanin, Level );
338 LevelMax = Abc_MaxInt( LevelMax, Level );
339 }
340 // reverse the values
341 Wlc_NtkForEachObj( p, pObj, i )
342 Vec_IntWriteEntry( &p->vLevels, i, LevelMax - Wlc_ObjLevelId(p, i) );
343 Wlc_NtkForEachCi( p, pObj, i )
344 Vec_IntWriteEntry( &p->vLevels, Wlc_ObjId(p, pObj), 0 );
345 //Wlc_NtkForEachObj( p, pObj, i )
346 // printf( "%d -> %d\n", i, Wlc_ObjLevelId(p, i) );
347 return LevelMax;
348}
#define Wlc_NtkForEachObjReverse(p, pObj, i)
Definition wlc.h:358

◆ Wlc_NtkDcFlopNum()

int Wlc_NtkDcFlopNum ( Wlc_Ntk_t * p)
extern

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

Synopsis [Count the number of flops initialized to DC value.]

Description []

SideEffects []

SeeAlso []

Definition at line 1351 of file wlcNtk.c.

1352{
1353 int i, nFlops, Count = 0;
1354 if ( p->pInits == NULL )
1355 return 0;
1356 nFlops = strlen(p->pInits);
1357 for ( i = 0; i < nFlops; i++ )
1358 Count += (p->pInits[i] == 'x' || p->pInits[i] == 'X');
1359 return Count;
1360}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkDeleteSim()

void Wlc_NtkDeleteSim ( Vec_Ptr_t * p)
extern

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

Synopsis [Performs simulation of a word-level network.]

Description [Returns vRes, a 2D array of simulation information for the output of each bit of each object listed in vNodes. In particular, Vec_Ptr_t * vSimObj = (Vec_Ptr_t *)Vec_PtrEntry(vRes, iObj) and Vec_Ptr_t * vSimObjBit = (Vec_Ptr_t *)Vec_PtrEntry(vSimObj, iBit) are arrays containing the simulation info for each object (vSimObj) and for each output bit of this object (vSimObjBit). Alternatively, Vec_Ptr_t * vSimObjBit = Vec_VecEntryEntry( (Vec_Vec_t *)vRes, iObj, iBit ). The output bitwidth of an object is Wlc_ObjRange( Wlc_NtkObj(pNtk, iObj) ). Simulation information is binary data constaining the given number (nWords) of 64-bit machine words for the given number (nFrames) of consecutive timeframes. The total number of timeframes is nWords * nFrames for each bit of each object.]

SideEffects []

SeeAlso []

Definition at line 120 of file wlcSim.c.

121{
122 word * pInfo; int i, k;
123 Vec_Vec_t * vVec = (Vec_Vec_t *)p;
124 Vec_VecForEachEntry( word *, vVec, pInfo, i, k )
125 ABC_FREE( pInfo );
126 Vec_VecFree( vVec );
127}
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
Definition vecVec.h:87
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the caller graph for this function:

◆ Wlc_NtkDupDfs()

Wlc_Ntk_t * Wlc_NtkDupDfs ( Wlc_Ntk_t * p,
int fMarked,
int fSeq )
extern

Definition at line 986 of file wlcNtk.c.

987{
988 Wlc_Ntk_t * pNew;
989 Wlc_Obj_t * pObj, * pObjNew;
990 Vec_Int_t * vFanins;
991 int i, k, iObj, iFanin;
992 vFanins = Vec_IntAlloc( 100 );
993 Wlc_NtkCleanCopy( p );
994 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
995 pNew->fSmtLib = p->fSmtLib;
996 pNew->fAsyncRst = p->fAsyncRst;
997 pNew->fMemPorts = p->fMemPorts;
998 pNew->fEasyFfs = p->fEasyFfs;
999 Wlc_NtkForEachCi( p, pObj, i )
1000 if ( !fMarked || pObj->Mark )
1001 {
1002 unsigned Type = pObj->Type;
1003 if ( !fSeq ) pObj->Type = WLC_OBJ_PI;
1004 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1005 pObj->Type = Type;
1006 }
1007 Wlc_NtkForEachFf2( p, pObj, i )
1008 {
1009 int iObjNew = Wlc_ObjAlloc( pNew, pObj->Type, Wlc_ObjIsSigned(pObj), pObj->End, pObj->Beg );
1010 Wlc_ObjSetCopy( p, Wlc_ObjId(p, pObj), iObjNew );
1011 Vec_IntPush( &pNew->vFfs2, iObjNew );
1012 }
1013 Wlc_NtkForEachCo( p, pObj, i )
1014 if ( !fMarked || pObj->Mark )
1015 Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1016 Wlc_NtkForEachCo( p, pObj, i )
1017 if ( !fMarked || pObj->Mark )
1018 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), fSeq ? pObj->fIsFi : 0 );
1019 Wlc_NtkForEachFf2( p, pObj, i )
1020 {
1021 iObj = Wlc_ObjId(p, pObj);
1022 Wlc_ObjForEachFanin( pObj, iFanin, k )
1023 Wlc_NtkDupDfs_rec( pNew, p, iFanin, vFanins );
1024 Wlc_ObjCollectCopyFanins( p, iObj, vFanins );
1025 pObjNew = Wlc_NtkObj( pNew, Wlc_ObjCopy(p, iObj) );
1026 Wlc_ObjAddFanins( pNew, pObjNew, vFanins );
1027 pObjNew->fXConst = pObj->fXConst;
1028 }
1029 Vec_IntFree( vFanins );
1030 if ( fSeq && p->vInits )
1031 {
1032 if ( fMarked )
1033 {
1034 if ( p->vInits )
1035 pNew->vInits = Wlc_ReduceMarkedInitVec( p, p->vInits );
1036 if ( p->pInits )
1037 pNew->pInits = Wlc_ReduceMarkedInitStr( p, p->pInits );
1038 }
1039 else
1040 {
1041 if ( p->vInits )
1042 pNew->vInits = Vec_IntDup( p->vInits );
1043 if ( p->pInits )
1044 pNew->pInits = Abc_UtilStrsav( p->pInits );
1045 }
1046 }
1047 if ( p->pSpec )
1048 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1049 if ( Wlc_NtkHasNameId(p) )
1050 Wlc_NtkTransferNames( pNew, p );
1051 if ( Vec_IntSize(&p->vPoPairs) )
1052 Vec_IntAppend( &pNew->vPoPairs, &p->vPoPairs );
1053 return pNew;
1054}
Vec_Int_t vFfs2
Definition wlc.h:145
Vec_Int_t vPoPairs
Definition wlc.h:175
unsigned fXConst
Definition wlc.h:127
void Wlc_NtkTransferNames(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p)
Definition wlcNtk.c:830
void Wlc_NtkDupDfs_rec(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:941
int Wlc_ObjAlloc(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg)
Definition wlcNtk.c:199
void Wlc_ObjSetCo(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int fFlopInput)
Definition wlcNtk.c:188
Vec_Int_t * Wlc_ReduceMarkedInitVec(Wlc_Ntk_t *p, Vec_Int_t *vInit)
Definition wlcNtk.c:865
Wlc_Ntk_t * Wlc_NtkAlloc(char *pName, int nObjsAlloc)
Definition wlcNtk.c:152
int Wlc_ObjDup(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:930
void Wlc_ObjAddFanins(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:240
void Wlc_ObjCollectCopyFanins(Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:904
char * Wlc_ReduceMarkedInitStr(Wlc_Ntk_t *p, char *pInit)
Definition wlcNtk.c:876
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkDupDfsAbs()

Wlc_Ntk_t * Wlc_NtkDupDfsAbs ( Wlc_Ntk_t * p,
Vec_Int_t * vPisOld,
Vec_Int_t * vPisNew,
Vec_Int_t * vFlops )
extern

Definition at line 1055 of file wlcNtk.c.

1056{
1057 Wlc_Ntk_t * pNew;
1058 Wlc_Obj_t * pObj;
1059 Vec_Int_t * vFanins;
1060 int i;
1061 Wlc_NtkCleanCopy( p );
1062 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
1063 pNew->fSmtLib = p->fSmtLib;
1064 pNew->fAsyncRst = p->fAsyncRst;
1065 pNew->fMemPorts = p->fMemPorts;
1066 pNew->fEasyFfs = p->fEasyFfs;
1067
1068 // duplicate marked PIs
1069 vFanins = Vec_IntAlloc( 100 );
1070 Wlc_NtkForEachObjVec( vPisOld, p, pObj, i )
1071 {
1072 assert( Wlc_ObjIsPi(pObj) );
1073 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1074 }
1075 // duplicate additional PIs
1076 Wlc_NtkForEachObjVec( vPisNew, p, pObj, i )
1077 {
1078 unsigned Type = pObj->Type;
1079 int nFanins = Wlc_ObjFaninNum(pObj);
1080 assert( !Wlc_ObjIsPi(pObj) );
1081 pObj->Type = WLC_OBJ_PI;
1082 pObj->nFanins = 0;
1083 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1084 pObj->Type = Type;
1085 pObj->nFanins = (unsigned)nFanins;
1086 }
1087 // duplicate flop outputs
1088 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1089 {
1090 assert( !Wlc_ObjIsPi(pObj) && Wlc_ObjIsCi(pObj) );
1091 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1092 }
1093
1094 // duplicate logic cones of primary outputs
1095 Wlc_NtkForEachPo( p, pObj, i )
1096 Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1097 // duplidate logic cone of flop inputs
1098 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1099 Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, Wlc_ObjFo2Fi(p, pObj)), vFanins );
1100
1101 // duplicate POs
1102 Wlc_NtkForEachPo( p, pObj, i )
1103 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), 0 );
1104 // duplicate flop inputs
1105 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1106 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, Wlc_ObjFo2Fi(p, pObj)), 1 );
1107 Vec_IntFree( vFanins );
1108
1109 // mark flop outputs
1110 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1111 pObj->Mark = 1;
1112 if ( p->vInits )
1113 pNew->vInits = Wlc_ReduceMarkedInitVec( p, p->vInits );
1114 if ( p->pInits )
1115 pNew->pInits = Wlc_ReduceMarkedInitStr( p, p->pInits );
1117
1118 if ( p->pSpec )
1119 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1120 //Wlc_NtkTransferNames( pNew, p );
1121 return pNew;
1122}
unsigned nFanins
Definition wlc.h:128
Here is the call graph for this function:

◆ Wlc_NtkDupDfsSimple()

Wlc_Ntk_t * Wlc_NtkDupDfsSimple ( Wlc_Ntk_t * p)
extern

Definition at line 957 of file wlcNtk.c.

958{
959 Wlc_Ntk_t * pNew;
960 Wlc_Obj_t * pObj;
961 Vec_Int_t * vFanins;
962 int i;
963 Wlc_NtkCleanCopy( p );
964 vFanins = Vec_IntAlloc( 100 );
965 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
966 pNew->fSmtLib = p->fSmtLib;
967 pNew->fAsyncRst = p->fAsyncRst;
968 pNew->fMemPorts = p->fMemPorts;
969 pNew->fEasyFfs = p->fEasyFfs;
970 Wlc_NtkForEachCi( p, pObj, i )
971 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
972 Wlc_NtkForEachCo( p, pObj, i )
973 Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, pObj), vFanins );
974 Wlc_NtkForEachCo( p, pObj, i )
975 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), pObj->fIsFi );
976 if ( p->vInits )
977 pNew->vInits = Vec_IntDup( p->vInits );
978 if ( p->pInits )
979 pNew->pInits = Abc_UtilStrsav( p->pInits );
980 Vec_IntFree( vFanins );
981 if ( p->pSpec )
982 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
983 return pNew;
984}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkDupSingleNodes()

Wlc_Ntk_t * Wlc_NtkDupSingleNodes ( Wlc_Ntk_t * p)
extern

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

Synopsis [Duplicates the network by copying each node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1232 of file wlcNtk.c.

1233{
1234 Wlc_Ntk_t * pNew;
1235 Vec_Int_t * vFanins;
1236 Wlc_Obj_t * pObj, * pObjNew;
1237 Wlc_Obj_t * pFanin, * pFaninNew;
1238 int i, k, iFanin, iFaninNew, iObjNew, Count = 0;
1239 // count objects
1240 Wlc_NtkForEachObj( p, pObj, i )
1241 if ( !Wlc_ObjIsCi(pObj) )
1242 Count += 1 + Wlc_ObjFaninNum(pObj);
1243 // copy objects
1244 Wlc_NtkCleanCopy( p );
1245 vFanins = Vec_IntAlloc( 100 );
1246 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
1247 pNew->fSmtLib = p->fSmtLib;
1248 pNew->fAsyncRst = p->fAsyncRst;
1249 pNew->fMemPorts = p->fMemPorts;
1250 pNew->fEasyFfs = p->fEasyFfs;
1251 Wlc_NtkForEachObj( p, pObj, i )
1252 {
1253 if ( Wlc_ObjIsCi(pObj) )
1254 continue;
1255 if ( pObj->Type == WLC_OBJ_ARI_MULTI )
1256 continue;
1257 if ( pObj->Type == WLC_OBJ_MUX && Wlc_ObjFaninNum(pObj) > 3 )
1258 continue;
1259 // create CIs for the fanins
1260 Wlc_ObjForEachFanin( pObj, iFanin, k )
1261 {
1262 pFanin = Wlc_NtkObj(p, iFanin);
1263 iFaninNew = Wlc_ObjAlloc( pNew, WLC_OBJ_PI, pFanin->Signed, pFanin->End, pFanin->Beg );
1264 pFaninNew = Wlc_NtkObj(pNew, iFaninNew);
1265 Wlc_ObjSetCopy( p, iFanin, iFaninNew );
1266 //Wlc_ObjSetCi( pNew, pFaninNew );
1267 }
1268 // create object
1269 iObjNew = Wlc_ObjDup( pNew, p, i, vFanins );
1270 pObjNew = Wlc_NtkObj(pNew, iObjNew);
1271 pObjNew->fIsPo = 1;
1272 Vec_IntPush( &pNew->vPos, iObjNew );
1273 }
1274 Vec_IntFree( vFanins );
1275 Wlc_NtkTransferNames( pNew, p );
1276 if ( p->pSpec )
1277 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1278 return pNew;
1279}
Vec_Int_t vPos
Definition wlc.h:141
unsigned fIsPo
Definition wlc.h:125
Here is the call graph for this function:

◆ Wlc_NtkFindUifableMultiplierPairs()

Vec_Int_t * Wlc_NtkFindUifableMultiplierPairs ( Wlc_Ntk_t * p)
extern

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

Synopsis [Returns all pairs of uifable multipliers.]

Description []

SideEffects []

SeeAlso []

Definition at line 145 of file wlcUif.c.

146{
148 Vec_Int_t * vPairs = Vec_IntAlloc( 2 );
149 Wlc_Obj_t * pObj, * pObj2; int i, k;
150 // iterate through unique pairs
151 Wlc_NtkForEachObjVec( vMultis, p, pObj, i )
152 Wlc_NtkForEachObjVec( vMultis, p, pObj2, k )
153 {
154 if ( k == i )
155 break;
156 if ( Wlc_NtkPairIsUifable( p, pObj, pObj2 ) )
157 {
158 Vec_IntPush( vPairs, Wlc_ObjId(p, pObj) );
159 Vec_IntPush( vPairs, Wlc_ObjId(p, pObj2) );
160 }
161 }
162 Vec_IntFree( vMultis );
163 if ( Vec_IntSize( vPairs ) > 0 )
164 return vPairs;
165 Vec_IntFree( vPairs );
166 return NULL;
167}
int Wlc_NtkPairIsUifable(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Wlc_Obj_t *pObj2)
Definition wlcUif.c:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkFree()

void Wlc_NtkFree ( Wlc_Ntk_t * p)
extern

Definition at line 253 of file wlcNtk.c.

254{
255 if ( p->pManName )
256 Abc_NamStop( p->pManName );
257 if ( p->pMemFanin )
258 Mem_FlexStop( p->pMemFanin, 0 );
259 if ( p->pMemTable )
260 Mem_FlexStop( p->pMemTable, 0 );
261 ABC_FREE( p->vPoPairs.pArray );
262 Vec_PtrFreeP( &p->vTables );
263 Vec_WrdFreeP( &p->vLutTruths );
264 ABC_FREE( p->vPis.pArray );
265 ABC_FREE( p->vPos.pArray );
266 ABC_FREE( p->vCis.pArray );
267 ABC_FREE( p->vCos.pArray );
268 ABC_FREE( p->vFfs.pArray );
269 ABC_FREE( p->vFfs2.pArray );
270 Vec_IntFreeP( &p->vInits );
271 Vec_IntFreeP( &p->vArsts );
272 ABC_FREE( p->vTravIds.pArray );
273 ABC_FREE( p->vNameIds.pArray );
274 ABC_FREE( p->vValues.pArray );
275 ABC_FREE( p->vCopies.pArray );
276 ABC_FREE( p->vBits.pArray );
277 ABC_FREE( p->vLevels.pArray );
278 ABC_FREE( p->vRefs.pArray );
279 ABC_FREE( p->pInits );
280 ABC_FREE( p->pObjs );
281 ABC_FREE( p->pName );
282 ABC_FREE( p->pSpec );
283 ABC_FREE( p );
284}
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition mem.c:359
void Abc_NamStop(Abc_Nam_t *p)
Definition utilNam.c:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkFromNdr()

Wlc_Ntk_t * Wlc_NtkFromNdr ( void * pData)
extern

Definition at line 366 of file wlcNdr.c.

367{
368 Ndr_Data_t * p = (Ndr_Data_t *)pData;
369 Wlc_Obj_t * pObj; Vec_Int_t * vName2Obj, * vFanins = Vec_IntAlloc( 100 );
370 int Mod = 2, i, k, Obj, * pArray, fFound, NameId, NameIdMax;
371 unsigned char nDigits;
372 Vec_Wrd_t * vTruths = NULL; int nTruths[2] = {0};
373 Wlc_Ntk_t * pTemp, * pNtk = Wlc_NtkAlloc( "top", Ndr_DataObjNum(p, Mod)+1 );
374 Wlc_NtkCheckIntegrity( pData );
375 Vec_IntClear( &pNtk->vFfs );
376 //pNtk->pSpec = Abc_UtilStrsav( pFileName );
377 // construct network and save name IDs
378 Wlc_NtkCleanNameId( pNtk );
379 Ndr_ModForEachPi( p, Mod, Obj )
380 {
381 int End, Beg, Signed = Ndr_ObjReadRange(p, Obj, &End, &Beg);
382 int iObj = Wlc_ObjAlloc( pNtk, WLC_OBJ_PI, Signed, End, Beg );
383 int NameId = Ndr_ObjReadBody( p, Obj, NDR_OUTPUT );
384 Wlc_ObjSetNameId( pNtk, iObj, NameId );
385 }
386 Ndr_ModForEachNode( p, Mod, Obj )
387 {
388 int End, Beg, Signed = Ndr_ObjReadRange(p, Obj, &End, &Beg);
389 int Type = Ndr_ObjReadBody( p, Obj, NDR_OPERTYPE );
390 int nArray = Ndr_ObjReadArray( p, Obj, NDR_INPUT, &pArray );
391 Vec_Int_t F = {nArray, nArray, pArray}, * vTemp = &F;
392 int iObj = Wlc_ObjAlloc( pNtk, Ndr_TypeNdr2Wlc(Type), Signed, End, Beg );
393 int NameId = Ndr_ObjReadBody( p, Obj, NDR_OUTPUT );
394 Vec_IntClear( vFanins );
395 Vec_IntAppend( vFanins, vTemp );
396 if ( Type == ABC_OPER_DFF )
397 {
398 // save init state
399 if ( pNtk->vInits == NULL )
400 pNtk->vInits = Vec_IntAlloc( 100 );
401 if ( Vec_IntSize(vFanins) == 2 )
402 Vec_IntPush( pNtk->vInits, Vec_IntPop(vFanins) );
403 else // assume const0 if init is not given
404 Vec_IntPush( pNtk->vInits, -(End-Beg+1) );
405 // save flop output
406 pObj = Wlc_NtkObj(pNtk, iObj);
407 assert( Wlc_ObjType(pObj) == WLC_OBJ_FO );
408 Wlc_ObjSetNameId( pNtk, iObj, NameId );
409 Vec_IntPush( &pNtk->vFfs, NameId );
410 // save flop input
411 assert( Vec_IntSize(vFanins) == 1 );
412 Vec_IntPush( &pNtk->vFfs, Vec_IntEntry(vFanins, 0) );
413 continue;
414 }
415 if ( Type == ABC_OPER_DFFRSE )
416 Vec_IntPush( &pNtk->vFfs2, iObj );
417 if ( Type == ABC_OPER_LUT )
418 {
419 word * pTruth;
420 if ( vTruths == NULL )
421 vTruths = Vec_WrdStart( 1000 );
422 if ( NameId >= Vec_WrdSize(vTruths) )
423 Vec_WrdFillExtra( vTruths, 2*NameId, 0 );
424 pTruth = (word *)Ndr_ObjReadBodyP(p, Obj, NDR_FUNCTION);
425 Vec_WrdWriteEntry( vTruths, NameId, pTruth ? *pTruth : 0 );
426 nTruths[ pTruth != NULL ]++;
427 }
428 if ( Type == ABC_OPER_SLICE )
429 Vec_IntPushTwo( vFanins, End, Beg );
430 else if ( Type == ABC_OPER_CONST )
431 Ndr_ObjReadConstant( vFanins, (char *)Ndr_ObjReadBodyP(p, Obj, NDR_FUNCTION) );
432 else if ( Type == ABC_OPER_BIT_MUX && Vec_IntSize(vFanins) == 3 )
433 ABC_SWAP( int, Vec_IntEntryP(vFanins, 1)[0], Vec_IntEntryP(vFanins, 2)[0] );
434 Wlc_ObjAddFanins( pNtk, Wlc_NtkObj(pNtk, iObj), vFanins );
435 Wlc_ObjSetNameId( pNtk, iObj, NameId );
436 if ( Type == ABC_OPER_ARI_SMUL )
437 {
438 pObj = Wlc_NtkObj(pNtk, iObj);
439 assert( Wlc_ObjFaninNum(pObj) == 2 );
440 Wlc_ObjFanin0(pNtk, pObj)->Signed = 1;
441 Wlc_ObjFanin1(pNtk, pObj)->Signed = 1;
442 }
443 }
444 if ( nTruths[0] )
445 printf( "Warning! The number of LUTs without function is %d (out of %d).\n", nTruths[0], nTruths[0]+nTruths[1] );
446 // mark primary outputs
447 Ndr_ModForEachPo( p, Mod, Obj )
448 {
449 int End, Beg, Signed = Ndr_ObjReadRange(p, Obj, &End, &Beg);
450 int nArray = Ndr_ObjReadArray( p, Obj, NDR_INPUT, &pArray );
451 int iObj = Wlc_ObjAlloc( pNtk, WLC_OBJ_BUF, Signed, End, Beg );
452 int NameId = Ndr_ObjReadBody( p, Obj, NDR_OUTPUT );
453 assert( nArray == 1 && NameId == -1 );
454 pObj = Wlc_NtkObj( pNtk, iObj );
455 Vec_IntFill( vFanins, 1, pArray[0] );
456 Wlc_ObjAddFanins( pNtk, pObj, vFanins );
457 Wlc_ObjSetCo( pNtk, pObj, 0 );
458 }
459 Vec_IntFree( vFanins );
460 // map name IDs into object IDs
461 vName2Obj = Vec_IntInvert( &pNtk->vNameIds, 0 );
462 Wlc_NtkForEachObj( pNtk, pObj, i )
463 {
464 int * pFanins = Wlc_ObjFanins(pObj);
465 for ( k = 0; k < Wlc_ObjFaninNum(pObj); k++ )
466 pFanins[k] = Vec_IntEntry(vName2Obj, pFanins[k]);
467 }
468 if ( pNtk->vInits )
469 {
470 Vec_IntForEachEntry( &pNtk->vFfs, NameId, i )
471 Vec_IntWriteEntry( &pNtk->vFfs, i, Vec_IntEntry(vName2Obj, NameId) );
472 Vec_IntForEachEntry( pNtk->vInits, NameId, i )
473 if ( NameId > 0 )
474 Vec_IntWriteEntry( pNtk->vInits, i, Vec_IntEntry(vName2Obj, NameId) );
475 // move FO/FI to be part of CI/CO
476 assert( (Vec_IntSize(&pNtk->vFfs) & 1) == 0 );
477 assert( Vec_IntSize(&pNtk->vFfs) == 2 * Vec_IntSize(pNtk->vInits) );
478 Wlc_NtkForEachFf( pNtk, pObj, i )
479 if ( i & 1 )
480 Wlc_ObjSetCo( pNtk, pObj, 1 );
481 //else
482 // Wlc_ObjSetCi( pNtk, pObj );
483 Vec_IntClear( &pNtk->vFfs );
484 // convert init values into binary string
485 //Vec_IntPrint( &p->pNtk->vInits );
486 pNtk->pInits = Wlc_PrsConvertInitValues( pNtk );
487 //printf( "%s", p->pNtk->pInits );
488 }
489 Vec_IntFree(vName2Obj);
490 // create fake object names
491 NameIdMax = Vec_IntFindMax(&pNtk->vNameIds);
492 nDigits = (unsigned char)Abc_Base10Log( NameIdMax+1 );
493 pNtk->pManName = Abc_NamStart( NameIdMax+1, 10 );
494 for ( i = 1; i <= NameIdMax; i++ )
495 {
496 char pName[1000]; sprintf( pName, "s%0*d", nDigits, i );
497 NameId = Abc_NamStrFindOrAdd( pNtk->pManName, pName, &fFound );
498 assert( !fFound && i == NameId );
499 }
500 //Ndr_NtkPrintNodes( pNtk );
501 //Wlc_WriteVer( pNtk, "temp_ndr.v", 0, 0 );
502 // derive topological order
503 pNtk = Wlc_NtkDupDfs( pTemp = pNtk, 0, 1 );
504 Wlc_NtkFree( pTemp );
505 // copy truth tables
506 if ( vTruths )
507 {
508 pNtk->vLutTruths = Vec_WrdStart( Wlc_NtkObjNumMax(pNtk) );
509 Wlc_NtkForEachObj( pNtk, pObj, i )
510 {
511 int iObj = Wlc_ObjId(pNtk, pObj);
512 int NameId = Wlc_ObjNameId(pNtk, iObj);
513 word Truth;
514 if ( pObj->Type != WLC_OBJ_LUT || NameId == 0 )
515 continue;
516 Truth = Vec_WrdEntry(vTruths, NameId);
517 assert( sizeof(void *) == 8 || Wlc_ObjFaninNum(pObj) < 6 );
518 Vec_WrdWriteEntry( pNtk->vLutTruths, iObj, Truth );
519 }
520 Vec_WrdFreeP( &vTruths );
521 }
522 //Ndr_NtkPrintNodes( pNtk );
523 pNtk->fMemPorts = 1; // the network contains memory ports
524 pNtk->fEasyFfs = 1; // the network contains simple flops
525 return pNtk;
526}
@ ABC_OPER_DFF
Definition abcOper.h:142
@ ABC_OPER_ARI_SMUL
Definition abcOper.h:102
@ ABC_OPER_LUT
Definition abcOper.h:127
@ ABC_OPER_DFFRSE
Definition abcOper.h:143
@ ABC_OPER_BIT_MUX
Definition abcOper.h:65
@ ABC_OPER_CONST
Definition abcOper.h:153
@ ABC_OPER_SLICE
Definition abcOper.h:146
@ NDR_INPUT
Definition ndr.h:103
@ NDR_FUNCTION
Definition ndr.h:108
@ NDR_OPERTYPE
Definition ndr.h:105
@ NDR_OUTPUT
Definition ndr.h:104
struct Ndr_Data_t_ Ndr_Data_t
BASIC TYPES ///.
Definition ndr.h:119
#define Ndr_ModForEachPo(p, Mod, Obj)
Definition ndr.h:159
#define Ndr_ModForEachPi(p, Mod, Obj)
Definition ndr.h:155
#define Ndr_ModForEachNode(p, Mod, Obj)
Definition ndr.h:163
Vec_Int_t vFfs
Definition wlc.h:144
Vec_Wrd_t * vLutTruths
Definition wlc.h:163
Abc_Nam_t * pManName
Definition wlc.h:165
Vec_Int_t vNameIds
Definition wlc.h:166
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition utilNam.c:453
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
Definition utilNam.c:80
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42
int Ndr_ObjReadRange(Ndr_Data_t *p, int Obj, int *End, int *Beg)
Definition wlcNdr.c:285
void Wlc_NtkCheckIntegrity(void *pData)
Definition wlcNdr.c:337
ABC_NAMESPACE_IMPL_START int Ndr_TypeNdr2Wlc(int Type)
DECLARATIONS ///.
Definition wlcNdr.c:45
void Ndr_ObjReadConstant(Vec_Int_t *vFanins, char *pStr)
Definition wlcNdr.c:299
#define Wlc_NtkForEachFf(p, pFf, i)
Definition wlc.h:370
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkMarkCone()

void Wlc_NtkMarkCone ( Wlc_Ntk_t * p,
int iCoId,
int Range,
int fSeq,
int fAllPis )
extern

Definition at line 1181 of file wlcNtk.c.

1182{
1183 Vec_Int_t * vFlops;
1184 Wlc_Obj_t * pObj;
1185 int i, CiId, CoId;
1187 if ( fAllPis )
1188 Wlc_NtkForEachPi( p, pObj, i )
1189 pObj->Mark = 1;
1190 vFlops = Vec_IntAlloc( 100 );
1191 Wlc_NtkForEachCo( p, pObj, i )
1192 if ( iCoId == -1 || (i >= iCoId && i < iCoId + Range) )
1193 Wlc_NtkMarkCone_rec( p, pObj, vFlops );
1194 if ( fSeq )
1195 Vec_IntForEachEntry( vFlops, CiId, i )
1196 {
1197 CoId = Wlc_NtkPoNum(p) + CiId - Wlc_NtkPiNum(p);
1198 Wlc_NtkMarkCone_rec( p, Wlc_NtkCo(p, CoId), vFlops );
1199 }
1200 Vec_IntFree( vFlops );
1201}
void Wlc_NtkMarkCone_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFlops)
Definition wlcNtk.c:1166
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkMemAbstract()

int Wlc_NtkMemAbstract ( Wlc_Ntk_t * p,
int nIterMax,
int fDumpAbs,
int fPdrVerbose,
int fVerbose )
extern

Definition at line 986 of file wlcMem.c.

987{
988 abctime clk = Abc_Clock();
989 Wlc_Ntk_t * pNewFull, * pNew; Aig_Man_t * pAig, * pTempAig;
990 Gia_Man_t * pAbsFull, * pAbs;
991 Abc_Cex_t * pCex = NULL; Vec_Wrd_t * vValues = NULL;
992 Vec_Wec_t * vRefines = Vec_WecAlloc( 100 );
993 Vec_Int_t * vNodeFrames = Vec_IntAlloc( 100 );
994 Vec_Int_t * vMemObjs, * vMemFanins, * vFirstTotal, * vRefine;
995 int RetValue = -1, iFirstMemPi, iFirstCi, iFirstMemCi, nDcBits, nIters;
996
997 vMemObjs = Wlc_NtkCollectMemory( p, 0 );
998 vMemFanins = Wlc_NtkCollectMemFanins( p, vMemObjs );
999 pNewFull = Wlc_NtkAbstractMemory( p, vMemObjs, vMemFanins, &iFirstMemPi, &iFirstCi, &iFirstMemCi, NULL, NULL );
1000 nDcBits = Wlc_CountDcs( pNewFull->pInits );
1001 vFirstTotal = Wlc_NtkDeriveFirstTotal( p, vMemObjs, vMemFanins, iFirstMemPi, nDcBits + iFirstMemCi, fVerbose );
1002
1003 pAbsFull = Wlc_NtkBitBlast( pNewFull, NULL );
1004 assert( Gia_ManPiNum(pAbsFull) == iFirstCi + nDcBits );
1005 Wlc_NtkFree( pNewFull );
1006
1007 // perform abstraction
1008 for ( nIters = 0; nIters < nIterMax; nIters++ )
1009 {
1010 // set up parameters to run PDR
1011 Pdr_Par_t PdrPars, * pPdrPars = &PdrPars;
1012 Pdr_ManSetDefaultParams( pPdrPars );
1013 pPdrPars->fUseAbs = 0; // use 'pdr -t' (on-the-fly abstraction)
1014 pPdrPars->fVerbose = fVerbose;
1015
1016 // derive specific abstraction
1017 pNew = Wlc_NtkAbstractMemory( p, vMemObjs, NULL, &iFirstMemPi, &iFirstCi, &iFirstMemCi, vRefines, vNodeFrames );
1018 pAbs = Wlc_NtkBitBlast( pNew, NULL );
1019 // simplify the AIG
1020 //pAbs = Gia_ManSeqStructSweep( pGiaTemp = pAbs, 1, 1, 0 );
1021 //Gia_ManStop( pGiaTemp );
1022
1023 // roll in the constraints
1024 pAig = Gia_ManToAigSimple( pAbs );
1025 Gia_ManStop( pAbs );
1026 pAig->nConstrs = 1;
1027 pAig = Saig_ManDupFoldConstrsFunc( pTempAig = pAig, 0, 0, 1 );
1028 Aig_ManStop( pTempAig );
1029 pAbs = Gia_ManFromAigSimple( pAig );
1030 Aig_ManStop( pAig );
1031
1032 // try to prove abstracted GIA by converting it to AIG and calling PDR
1033 pAig = Gia_ManToAigSimple( pAbs );
1034 RetValue = Pdr_ManSolve( pAig, pPdrPars );
1035 pCex = pAig->pSeqModel; pAig->pSeqModel = NULL;
1036 Aig_ManStop( pAig );
1037
1038 if ( fVerbose )
1039 printf( "\nITERATIONS %d:\n", nIters );
1040 if ( fVerbose )
1041 Wlc_NtkPrintCex( p, pNew, pCex );
1042 Wlc_NtkFree( pNew );
1043
1044 if ( fDumpAbs )
1045 {
1046 char * pFileName = "mem_abs.aig";
1047 Gia_AigerWrite( pAbs, pFileName, 0, 0, 0 );
1048 printf( "Iteration %3d: Dumped abstraction in file \"%s\" after finding CEX in frame %d.\n", nIters, pFileName, pCex ? pCex->iFrame : -1 );
1049 }
1050
1051 // check if proved or undecided
1052 if ( pCex == NULL )
1053 {
1054 assert( RetValue );
1055 Gia_ManStop( pAbs );
1056 break;
1057 }
1058
1059 // analyze counter-example
1060 vValues = Wlc_NtkConvertCex( vFirstTotal, pAbsFull, pCex, fVerbose );
1061 Gia_ManStop( pAbs );
1062 vRefine = Wlc_NtkFindConflict( p, vMemObjs, vValues, pCex->iFrame + 1 );
1063 Vec_WrdFree( vValues );
1064 if ( vRefine == NULL ) // cannot refine
1065 break;
1066 Abc_CexFreeP( &pCex );
1067
1068 // save refinement for the future
1069 if ( fVerbose )
1070 Wlc_NtkPrintConflict( p, vRefine );
1071 Vec_WecPushLevel( vRefines );
1072 Vec_IntAppend( Vec_WecEntryLast(vRefines), vRefine );
1073 Wlc_NtkAbsAddToNodeFrames( vNodeFrames, vRefine );
1074 Vec_IntFree( vRefine );
1075 }
1076 // cleanup
1077 Gia_ManStop( pAbsFull );
1078 Vec_WecFree( vRefines );
1079 Vec_IntFreeP( &vMemObjs );
1080 Vec_IntFreeP( &vMemFanins );
1081 Vec_IntFreeP( &vFirstTotal );
1082 Vec_IntFreeP( &vNodeFrames );
1083
1084 // report the result
1085 if ( fVerbose )
1086 printf( "\n" );
1087 printf( "Abstraction " );
1088 if ( RetValue == 0 && pCex )
1089 printf( "resulted in a real CEX in frame %d", pCex->iFrame );
1090 else if ( RetValue == 1 )
1091 printf( "is successfully proved" );
1092 else
1093 printf( "timed out" );
1094 printf( " after %d iterations. ", nIters );
1095 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1096 Abc_CexFreeP( &pCex ); // return CEX in the future
1097 return RetValue;
1098}
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition giaAig.c:212
Aig_Man_t * Saig_ManDupFoldConstrsFunc(Aig_Man_t *pAig, int fCompl, int fVerbose, int fSeqCleanup)
void Abc_CexFreeP(Abc_Cex_t **p)
Definition utilCex.c:361
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
void Wlc_NtkAbsAddToNodeFrames(Vec_Int_t *vNodeFrames, Vec_Int_t *vLevel)
Definition wlcMem.c:322
Vec_Wrd_t * Wlc_NtkConvertCex(Vec_Int_t *vFirstTotal, Gia_Man_t *pAbs, Abc_Cex_t *pCex, int fVerbose)
Definition wlcMem.c:751
Wlc_Ntk_t * Wlc_NtkAbstractMemory(Wlc_Ntk_t *p, Vec_Int_t *vMemObjs, Vec_Int_t *vMemFanins, int *piFirstMemPi, int *piFirstCi, int *piFirstMemCi, Vec_Wec_t *vConstrs, Vec_Int_t *vNodeFrames)
Definition wlcMem.c:516
void Wlc_NtkPrintConflict(Wlc_Ntk_t *p, Vec_Int_t *vTrace)
Definition wlcMem.c:909
Vec_Int_t * Wlc_NtkCollectMemFanins(Wlc_Ntk_t *p, Vec_Int_t *vMemObjs)
Definition wlcMem.c:259
Vec_Int_t * Wlc_NtkFindConflict(Wlc_Ntk_t *p, Vec_Int_t *vMemObjs, Vec_Wrd_t *vValues, int nFrames)
Definition wlcMem.c:850
void Wlc_NtkPrintCex(Wlc_Ntk_t *p, Wlc_Ntk_t *pAbs, Abc_Cex_t *pCex)
Definition wlcMem.c:916
int Wlc_CountDcs(char *pInit)
Definition wlcMem.c:288
Vec_Int_t * Wlc_NtkDeriveFirstTotal(Wlc_Ntk_t *p, Vec_Int_t *vMemObjs, Vec_Int_t *vMemFanins, int iFirstMemPi, int iFirstMemCi, int fVerbose)
Definition wlcMem.c:670
Here is the call graph for this function:

◆ Wlc_NtkMemAbstractTest()

Wlc_Ntk_t * Wlc_NtkMemAbstractTest ( Wlc_Ntk_t * p)
extern

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

Synopsis [Perform abstraction.]

Description []

SideEffects []

SeeAlso []

Definition at line 954 of file wlcMem.c.

955{
956 int iFirstMemPi, iFirstCi, iFirstMemCi, nDcBits;
957 Vec_Int_t * vRefine;
958 Vec_Int_t * vMemObjs = Wlc_NtkCollectMemory( p, 0 );
959 Vec_Int_t * vMemFanins = Wlc_NtkCollectMemFanins( p, vMemObjs );
960
961 Vec_Wec_t * vRefines = Vec_WecAlloc( 100 );
962 Vec_Int_t * vNodeFrames = Vec_IntAlloc( 100 );
963 Wlc_Ntk_t * pNewFull;
964
965 vRefine = Vec_WecPushLevel(vRefines);
966 Vec_IntPush( vRefine, (11 << 11) | 0 );
967 Vec_IntPush( vRefine, (10 << 11) | 0 );
968 Vec_IntPush( vRefine, ( 8 << 11) | 0 );
969 Vec_IntPush( vRefine, ( 9 << 11) | 0 );
970 Wlc_NtkAbsAddToNodeFrames( vNodeFrames, vRefine );
971
972// pNewFull = Wlc_NtkAbstractMemory( p, vMemObjs, vMemFanins, &iFirstMemPi, &iFirstCi, &iFirstMemCi, NULL, NULL );
973 pNewFull = Wlc_NtkAbstractMemory( p, vMemObjs, NULL, &iFirstMemPi, &iFirstCi, &iFirstMemCi, vRefines, vNodeFrames );
974
975 Vec_WecFree( vRefines );
976 Vec_IntFree( vNodeFrames );
977
978 nDcBits = Wlc_CountDcs( pNewFull->pInits );
979 printf( "iFirstMemPi = %d iFirstCi = %d iFirstMemCi = %d nDcBits = %d\n", iFirstMemPi, iFirstCi, iFirstMemCi, nDcBits );
980
981 Vec_IntFreeP( &vMemObjs );
982 Vec_IntFreeP( &vMemFanins );
983 return pNewFull;
984}
Here is the call graph for this function:

◆ Wlc_NtkNewName()

char * Wlc_NtkNewName ( Wlc_Ntk_t * p,
int iCoId,
int fSeq )
extern

Definition at line 847 of file wlcNtk.c.

848{
849 static char pBuffer[1000];
850 sprintf( pBuffer, "%s_o%d_%s", p->pName, iCoId, fSeq ? "seq": "comb" );
851 return pBuffer;
852}
Here is the call graph for this function:

◆ Wlc_NtkPairIsUifable()

int Wlc_NtkPairIsUifable ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
Wlc_Obj_t * pObj2 )
extern

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

Synopsis [Check if two objects have the same input/output signatures.]

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file wlcUif.c.

90{
91 Wlc_Obj_t * pFanin, * pFanin2; int k;
92 if ( Wlc_ObjRange(pObj) != Wlc_ObjRange(pObj2) )
93 return 0;
94 if ( Wlc_ObjIsSigned(pObj) != Wlc_ObjIsSigned(pObj2) )
95 return 0;
96 if ( Wlc_ObjFaninNum(pObj) != Wlc_ObjFaninNum(pObj2) )
97 return 0;
98 for ( k = 0; k < Wlc_ObjFaninNum(pObj); k++ )
99 {
100 pFanin = Wlc_ObjFanin(p, pObj, k);
101 pFanin2 = Wlc_ObjFanin(p, pObj2, k);
102 if ( Wlc_ObjRange(pFanin) != Wlc_ObjRange(pFanin2) )
103 return 0;
104 if ( Wlc_ObjIsSigned(pFanin) != Wlc_ObjIsSigned(pFanin2) )
105 return 0;
106 }
107 return 1;
108}
Here is the caller graph for this function:

◆ Wlc_NtkPdrAbs()

int Wlc_NtkPdrAbs ( Wlc_Ntk_t * p,
Wlc_Par_t * pPars )
extern

Definition at line 1755 of file wlcAbs.c.

1756{
1757 Wla_Man_t * pWla = NULL;
1758
1759 int RetValue = -1;
1760
1761 pWla = Wla_ManStart( p, pPars );
1762
1763 RetValue = Wla_ManSolve( pWla, pPars );
1764
1765 Wla_ManStop( pWla );
1766
1767 return RetValue;
1768}
void Wla_ManStop(Wla_Man_t *p)
Definition wlcAbs.c:1687
Wla_Man_t * Wla_ManStart(Wlc_Ntk_t *pNtk, Wlc_Par_t *pPars)
Definition wlcAbs.c:1653
int Wla_ManSolve(Wla_Man_t *pWla, Wlc_Par_t *pPars)
Definition wlcAbs.c:1698
struct Wla_Man_t_ Wla_Man_t
Definition wlc.h:250
Here is the call graph for this function:

◆ Wlc_NtkPrintMemory()

void Wlc_NtkPrintMemory ( Wlc_Ntk_t * p)
extern

Definition at line 239 of file wlcMem.c.

240{
241 Vec_Int_t * vMemory;
242 vMemory = Wlc_NtkCollectMemory( p, 1 );
243 printf( "Memory subsystem is composed of the following objects:\n" );
244 Wlc_NtkPrintNodeArray( p, vMemory );
245 Vec_IntFree( vMemory );
246}
void Wlc_NtkPrintNodeArray(Wlc_Ntk_t *p, Vec_Int_t *vArray)
Definition wlcNtk.c:764
Here is the call graph for this function:

◆ Wlc_NtkPrintNode()

void Wlc_NtkPrintNode ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj )
extern

Definition at line 703 of file wlcNtk.c.

704{
705 printf( "%8d : ", Wlc_ObjId(p, pObj) );
706 if ( Vec_IntSize(&p->vLevels) )
707 printf( "Lev = %2d ", Vec_IntEntry(&p->vLevels, Wlc_ObjId(p,pObj)) );
708 printf( "%6d%s = ", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s" : " " );
709 if ( pObj->Type == WLC_OBJ_PI )
710 {
711 printf( " PI : %-12s\n", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
712 return;
713 }
714 if ( pObj->Type == WLC_OBJ_FO )
715 {
716 printf( " FO : %-12s = %-12s\n", Wlc_ObjName(p, Wlc_ObjId(p, pObj)), Wlc_ObjName(p, Wlc_ObjId(p, Wlc_ObjFo2Fi(p, pObj))) );
717 return;
718 }
719 if ( pObj->Type != WLC_OBJ_CONST && Wlc_ObjFaninNum(pObj) == 0 )
720 {
721 printf( "Unknown object without fanins : %-12s\n", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
722 return;
723 }
724 if ( pObj->Type != WLC_OBJ_CONST )
725 {
726 printf( "%6d%s %5s ", Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin0(p, pObj)) ? "s" : " ", Wlc_Names[(int)pObj->Type] );
727 if ( Wlc_ObjFaninNum(pObj) > 1 )
728 printf( "%6d%s ", Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin1(p, pObj)) ? "s" : " " );
729 else
730 printf( " " );
731 if ( Wlc_ObjFaninNum(pObj) > 2 )
732 printf( "%6d%s ", Wlc_ObjRange(Wlc_ObjFanin2(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin2(p, pObj)) ? "s" : " " );
733 else
734 printf( " " );
735 }
736 else
737 printf( " " );
738 printf( " : " );
739 printf( "%-12s", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
740 if ( pObj->Type == WLC_OBJ_CONST )
741 {
742 printf( " = %d\'%sh", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s":"" );
743 if ( pObj->fXConst )
744 {
745 int k;
746 for ( k = 0; k < (Wlc_ObjRange(pObj) + 3) / 4; k++ )
747 printf( "x" );
748 }
749 else
750 Abc_TtPrintHexArrayRev( stdout, (word *)Wlc_ObjConstValue(pObj), (Wlc_ObjRange(pObj) + 3) / 4 );
751 }
752 else
753 {
754 printf( " = %-12s %5s ", Wlc_ObjName(p, Wlc_ObjFaninId0(pObj)), Wlc_Names[(int)pObj->Type] );
755 if ( Wlc_ObjFaninNum(pObj) > 1 )
756 printf( "%-12s ", Wlc_ObjName(p, Wlc_ObjFaninId1(pObj)) );
757 else
758 printf( " " );
759 if ( Wlc_ObjFaninNum(pObj) > 2 )
760 printf( "%-12s ", Wlc_ObjName(p, Wlc_ObjFaninId2(pObj)) );
761 }
762 printf( "\n" );
763}
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
Definition wlcNtk.c:225
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkPrintNodeArray()

void Wlc_NtkPrintNodeArray ( Wlc_Ntk_t * p,
Vec_Int_t * vArray )
extern

Definition at line 764 of file wlcNtk.c.

765{
766 Wlc_Obj_t * pObj;
767 int i;
768 Wlc_NtkForEachObjVec( vArray, p, pObj, i )
769 Wlc_NtkPrintNode( p, pObj );
770}
void Wlc_NtkPrintNode(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:703
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkPrintNodes()

void Wlc_NtkPrintNodes ( Wlc_Ntk_t * p,
int Type )
extern

Definition at line 771 of file wlcNtk.c.

772{
773 Wlc_Obj_t * pObj;
774 int i, Counter = 0;
775 printf( "Operation %s\n", Wlc_Names[Type] );
776 Wlc_NtkForEachObj( p, pObj, i )
777 {
778 if ( (int)pObj->Type != Type )
779 continue;
780 printf( "%8d :", Counter++ );
781 Wlc_NtkPrintNode( p, pObj );
782 }
783}
Here is the call graph for this function:

◆ Wlc_NtkPrintObjects()

void Wlc_NtkPrintObjects ( Wlc_Ntk_t * p)
extern

Definition at line 812 of file wlcNtk.c.

813{
814 Wlc_Obj_t * pObj; int i;
815 Wlc_NtkForEachObj( p, pObj, i )
816 Wlc_NtkPrintNode( p, pObj );
817}
Here is the call graph for this function:

◆ Wlc_NtkPrintStats()

void Wlc_NtkPrintStats ( Wlc_Ntk_t * p,
int fDistrib,
int fTwoSides,
int fVerbose )
extern

Definition at line 784 of file wlcNtk.c.

785{
786 int i;
787 printf( "%-20s : ", p->pName );
788 printf( "PI = %4d ", Wlc_NtkCountRealPis(p) ); //Wlc_NtkPiNum(p) );
789 printf( "PO = %4d ", Wlc_NtkPoNum(p) );
790 printf( "FF = %4d ", Wlc_NtkFfNum(p) );
791 printf( "Obj = %6d ", Wlc_NtkObjNum(p) - Wlc_NtkPiNum(p) - Wlc_NtkPoNum(p) - Wlc_NtkFfNum(p) );
792 printf( "Mem = %.3f MB", 1.0*Wlc_NtkMemUsage(p)/(1<<20) );
793 printf( "\n" );
794 if ( fDistrib )
795 {
796 Wlc_NtkPrintDistrib( p, fTwoSides, fVerbose );
797 return;
798 }
799 if ( !fVerbose )
800 return;
801 printf( "Node type statistics:\n" );
802 for ( i = 1; i < WLC_OBJ_NUMBER; i++ )
803 {
804 if ( !p->nObjs[i] )
805 continue;
806 if ( p->nAnds[0] && p->nAnds[i] )
807 printf( "%2d : %-8s %6d %7.2f %%\n", i, Wlc_Names[i], p->nObjs[i], 100.0*p->nAnds[i]/p->nAnds[0] );
808 else
809 printf( "%2d : %-8s %6d\n", i, Wlc_Names[i], p->nObjs[i] );
810 }
811}
int Wlc_NtkCountRealPis(Wlc_Ntk_t *p)
Definition wlcNtk.c:445
int Wlc_NtkMemUsage(Wlc_Ntk_t *p)
Definition wlcNtk.c:285
void Wlc_NtkPrintDistrib(Wlc_Ntk_t *p, int fTwoSides, int fVerbose)
Definition wlcNtk.c:510
Here is the call graph for this function:

◆ Wlc_NtkProfileCones()

void Wlc_NtkProfileCones ( Wlc_Ntk_t * p)
extern

Definition at line 1202 of file wlcNtk.c.

1203{
1204 Wlc_Obj_t * pObj;
1205 int i, nPis, nFos, nNodes, nAdders, nMults;
1206 Wlc_NtkForEachCo( p, pObj, i )
1207 {
1208 Wlc_NtkMarkCone( p, i, 1, 0, 0 );
1209 nNodes = Wlc_NtkCountMarked( p, &nPis, &nFos, &nAdders, &nMults );
1210 printf( "Cone %5d : ", i );
1211 printf( "PI = %4d ", nPis );
1212 printf( "FO = %4d ", nFos );
1213 printf( "Node = %6d ", nNodes );
1214 printf( "Add/Sub = %4d ", nAdders );
1215 printf( "Mult = %4d ", nMults );
1216 printf( "\n" );
1217 }
1219}
int Wlc_NtkCountMarked(Wlc_Ntk_t *p, int *pnPis, int *pnFos, int *pnAdders, int *pnMults)
Definition wlcNtk.c:1142
Here is the call graph for this function:

◆ Wlc_NtkRemapLevels()

int Wlc_NtkRemapLevels ( Wlc_Ntk_t * p,
Vec_Int_t * vObjs,
int nLevels )
extern

Definition at line 387 of file wlcNtk.c.

388{
389 int i, k, iFanin, iObj, Entry, Level = 0, Res = nLevels;
390 Vec_Int_t * vMap = Vec_IntStart( nLevels+1 );
391 Vec_Int_t * vUsed = Vec_IntStart( nLevels+1 );
392 // mark used levels
393 Vec_IntWriteEntry( vUsed, nLevels, 1 );
394 Vec_IntForEachEntry( vObjs, iObj, i )
395 {
396 Vec_IntWriteEntry( vUsed, Wlc_ObjLevelId(p, iObj), 1 );
397 Wlc_ObjForEachFanin( Wlc_NtkObj(p, iObj), iFanin, k ) if ( iFanin )
398 Vec_IntWriteEntry( vUsed, Wlc_ObjLevelId(p, iFanin), 1 );
399 }
400 // create level map
401 Vec_IntForEachEntry( vUsed, Entry, i )
402 if ( Entry )
403 Vec_IntWriteEntry( vMap, i, Level++ );
404 //printf( "Total used levels %d -> %d\n", nLevels, Level );
405 // remap levels
406 Vec_IntForEachEntry( &p->vLevels, Level, i )
407 {
408 if ( Vec_IntEntry(vUsed, Level) )
409 Vec_IntWriteEntry( &p->vLevels, i, Vec_IntEntry(vMap, Level) );
410 else
411 Vec_IntWriteEntry( &p->vLevels, i, -1 );
412 }
413 Res = Vec_IntEntry( vMap, nLevels );
414 Vec_IntFree( vUsed );
415 Vec_IntFree( vMap );
416 return Res;
417}
Here is the caller graph for this function:

◆ Wlc_NtkSetRefs()

void Wlc_NtkSetRefs ( Wlc_Ntk_t * p)
extern

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

Synopsis [Create references.]

Description []

SideEffects []

SeeAlso []

Definition at line 1373 of file wlcNtk.c.

1374{
1375 Wlc_Obj_t * pObj; int i, k, Fanin;
1376 Vec_IntFill( &p->vRefs, Wlc_NtkObjNumMax(p), 0 );
1377 Wlc_NtkForEachObj( p, pObj, i )
1378 Wlc_ObjForEachFanin( pObj, Fanin, k )
1379 Vec_IntAddToEntry( &p->vRefs, Fanin, 1 );
1380 Wlc_NtkForEachCo( p, pObj, i )
1381 Vec_IntAddToEntry( &p->vRefs, Wlc_ObjId(p, pObj), 1 );
1382}
Here is the caller graph for this function:

◆ Wlc_NtkShortNames()

void Wlc_NtkShortNames ( Wlc_Ntk_t * p)
extern

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

Synopsis [Creates short names for all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 1292 of file wlcNtk.c.

1293{
1294 Wlc_Obj_t * pObj;
1295 char pBuffer[1000];
1296 int NameId, fFound, i;
1297 int nFlops = Wlc_NtkCoNum(p) - Wlc_NtkPoNum(p);
1298 unsigned char nDigits = (unsigned char)Abc_Base10Log( nFlops );
1299 Wlc_NtkForEachCo( p, pObj, i )
1300 {
1301 if ( Wlc_ObjIsPo(pObj) )
1302 continue;
1303 sprintf( pBuffer, "%s%0*d", "fi", nDigits, i - Wlc_NtkPoNum(p) );
1304 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1305 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1306 }
1307 Wlc_NtkForEachCi( p, pObj, i )
1308 {
1309 if ( Wlc_ObjIsPi(pObj) )
1310 continue;
1311 sprintf( pBuffer, "%s%0*d", "fo", nDigits, i - Wlc_NtkPiNum(p) );
1312 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1313 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1314 }
1315 nDigits = Abc_Base10Log( Wlc_NtkPoNum(p) );
1316 Wlc_NtkForEachPo( p, pObj, i )
1317 {
1318 sprintf( pBuffer, "%s%0*d", "po", nDigits, i );
1319 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1320 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1321 }
1322 nDigits = Abc_Base10Log( Wlc_NtkPiNum(p) );
1323 Wlc_NtkForEachPi( p, pObj, i )
1324 {
1325 sprintf( pBuffer, "%s%0*d", "pi", nDigits, i );
1326 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1327 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1328 }
1329 nDigits = Abc_Base10Log( Wlc_NtkObjNum(p) );
1330 Wlc_NtkForEachObj( p, pObj, i )
1331 {
1332 if ( Wlc_ObjIsCi(pObj) || Wlc_ObjIsCo(pObj) )
1333 continue;
1334 sprintf( pBuffer, "%s%0*d", "n", nDigits, i );
1335 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1336 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1337 }
1338}
Here is the call graph for this function:

◆ Wlc_NtkSimulate()

Vec_Ptr_t * Wlc_NtkSimulate ( Wlc_Ntk_t * p,
Vec_Int_t * vNodes,
int nWords,
int nFrames )
extern

Definition at line 128 of file wlcSim.c.

129{
130 Gia_Obj_t * pObj;
131 Vec_Ptr_t * vOne, * vRes;
132 Gia_Man_t * pGia = Wlc_NtkBitBlast( p, NULL );
133 Wlc_Obj_t * pWlcObj;
134 int f, i, k, w, nBits, Counter = 0;
135 // allocate simulation info for one timeframe
136 Vec_WrdFreeP( &pGia->vSims );
137 pGia->vSims = Vec_WrdStart( Gia_ManObjNum(pGia) * nWords );
138 pGia->nSimWords = nWords;
139 // allocate resulting simulation info
140 vRes = Vec_PtrAlloc( Vec_IntSize(vNodes) );
141 Wlc_NtkForEachObjVec( vNodes, p, pWlcObj, i )
142 {
143 nBits = Wlc_ObjRange(pWlcObj);
144 vOne = Vec_PtrAlloc( nBits );
145 for ( k = 0; k < nBits; k++ )
146 Vec_PtrPush( vOne, ABC_CALLOC(word, nWords * nFrames) );
147 Vec_PtrPush( vRes, vOne );
148 }
149 // perform simulation (const0 and flop outputs are already initialized)
150 Gia_ManRandomW( 1 );
151 for ( f = 0; f < nFrames; f++ )
152 {
153 Gia_ManForEachObj1( pGia, pObj, i )
154 {
155 if ( Gia_ObjIsAnd(pObj) )
156 Wlc_ObjSimAnd( pGia, i );
157 else if ( Gia_ObjIsCo(pObj) )
158 Wlc_ObjSimCo( pGia, i );
159 else if ( Gia_ObjIsPi(pGia, pObj) )
160 Wlc_ObjSimPi( pGia, i );
161 else if ( Gia_ObjIsRo(pGia, pObj) )
162 Wlc_ObjSimRo( pGia, i );
163 }
164 // collect simulation data
165 Wlc_NtkForEachObjVec( vNodes, p, pWlcObj, i )
166 {
167 int nBits = Wlc_ObjRange(pWlcObj);
168 int iFirst = Vec_IntEntry( &p->vCopies, Wlc_ObjId(p, pWlcObj) );
169 for ( k = 0; k < nBits; k++ )
170 {
171 int iLit = Vec_IntEntry( &p->vBits, iFirst + k );
172 word * pInfo = (word*)Vec_VecEntryEntry( (Vec_Vec_t *)vRes, i, k );
173 if ( iLit == -1 )
174 {
175 Counter++;
176 for ( w = 0; w < nWords; w++ )
177 pInfo[f * nWords + w] = 0;
178 }
179 else
180 {
181 word * pInfoObj = Wlc_ObjSim( pGia, Abc_Lit2Var(iLit) );
182 for ( w = 0; w < nWords; w++ )
183 pInfo[f * nWords + w] = Abc_LitIsCompl(iLit) ? ~pInfoObj[w] : pInfoObj[w];
184 }
185 }
186 }
187 if ( f == 0 && Counter )
188 printf( "Replaced %d dangling internal bits with constant 0.\n", Counter );
189 }
190 Vec_WrdFreeP( &pGia->vSims );
191 pGia->nSimWords = 0;
192 Gia_ManStop( pGia );
193 return vRes;
194}
int nWords
Definition abcNpn.c:127
word Gia_ManRandomW(int fReset)
Definition giaUtil.c:67
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
Vec_Wrd_t * vSims
Definition gia.h:213
int nSimWords
Definition gia.h:209
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkToNdr()

void * Wlc_NtkToNdr ( Wlc_Ntk_t * pNtk)
extern

Definition at line 190 of file wlcNdr.c.

191{
192 Wlc_Obj_t * pObj;
193 int i, k, iFanin, iOutId, Type;
194 // create a new module
195 void * pDesign = Ndr_Create( 1 );
196 int ModId = Ndr_AddModule( pDesign, 1 );
197 // add primary inputs
198 Vec_Int_t * vFanins = Vec_IntAlloc( 10 );
199 Wlc_NtkForEachPi( pNtk, pObj, i )
200 {
201 iOutId = Wlc_ObjId(pNtk, pObj);
202 Ndr_AddObject( pDesign, ModId, ABC_OPER_CI, 0,
203 pObj->End, pObj->Beg, pObj->Signed,
204 0, NULL, 1, &iOutId, NULL ); // no fanins
205 }
206 // add internal nodes
207 Wlc_NtkForEachObj( pNtk, pObj, iOutId )
208 {
209 char * pFunction = NULL;
210 if ( Wlc_ObjIsPi(pObj) || pObj->Type == 0 )
211 continue;
212 Vec_IntClear( vFanins );
213 Wlc_ObjForEachFanin( pObj, iFanin, k )
214 Vec_IntPush( vFanins, iFanin );
215 if ( pObj->Type == WLC_OBJ_CONST )
216 pFunction = Ndr_ObjWriteConstant( (unsigned *)Wlc_ObjFanins(pObj), Wlc_ObjRange(pObj) );
217 if ( pObj->Type == WLC_OBJ_MUX && Wlc_ObjRange(Wlc_ObjFanin0(pNtk, pObj)) > 1 )
218 Type = ABC_OPER_SEL_NMUX;
219 else if ( pObj->Type == WLC_OBJ_FO )
220 {
221 Wlc_Obj_t * pFi = Wlc_ObjFo2Fi( pNtk, pObj );
222 assert( Vec_IntSize(vFanins) == 0 );
223 Vec_IntPush( vFanins, Wlc_ObjId(pNtk, pFi) );
224 Vec_IntFillExtra( vFanins, 7, 0 );
225 Type = ABC_OPER_DFFRSE;
226 }
227 else
228 Type = Ndr_TypeWlc2Ndr(pObj->Type);
229 assert( Type > 0 );
230 Ndr_AddObject( pDesign, ModId, Type, 0,
231 pObj->End, pObj->Beg, pObj->Signed,
232 Vec_IntSize(vFanins), Vec_IntArray(vFanins), 1, &iOutId, pFunction );
233 }
234 // add primary outputs
235 Wlc_NtkForEachObj( pNtk, pObj, iOutId )
236 {
237 if ( !Wlc_ObjIsPo(pObj) )
238 continue;
239 Vec_IntFill( vFanins, 1, iOutId );
240 Ndr_AddObject( pDesign, ModId, ABC_OPER_CO, 0,
241 pObj->End, pObj->Beg, pObj->Signed,
242 1, Vec_IntArray(vFanins), 0, NULL, NULL );
243 }
244 Vec_IntFree( vFanins );
245 return pDesign;
246}
@ ABC_OPER_CI
Definition abcOper.h:45
@ ABC_OPER_SEL_NMUX
Definition abcOper.h:91
@ ABC_OPER_CO
Definition abcOper.h:46
int Ndr_TypeWlc2Ndr(int Type)
DECLARATIONS ///.
Definition wlcNdr.c:106
char * Ndr_ObjWriteConstant(unsigned *pBits, int nBits)
Definition wlcNdr.c:179
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkTransferNames()

void Wlc_NtkTransferNames ( Wlc_Ntk_t * pNew,
Wlc_Ntk_t * p )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 830 of file wlcNtk.c.

831{
832 int i;
833 assert( !Wlc_NtkHasCopy(pNew) && Wlc_NtkHasCopy(p) );
834 assert( !Wlc_NtkHasNameId(pNew) && Wlc_NtkHasNameId(p) );
835 assert( pNew->pManName == NULL && p->pManName != NULL );
836 Wlc_NtkCleanNameId( pNew );
837 for ( i = 0; i < p->nObjsAlloc; i++ )
838 if ( Wlc_ObjCopy(p, i) > 0 && i < Vec_IntSize(&p->vNameIds) && Wlc_ObjNameId(p, i) )
839 Wlc_ObjSetNameId( pNew, Wlc_ObjCopy(p, i), Wlc_ObjNameId(p, i) );
840 pNew->pManName = p->pManName;
841 p->pManName = NULL;
842 Vec_IntErase( &p->vNameIds );
843 // transfer table
844 pNew->pMemTable = p->pMemTable; p->pMemTable = NULL;
845 pNew->vTables = p->vTables; p->vTables = NULL;
846}
Mem_Flex_t * pMemTable
Definition wlc.h:161
Vec_Ptr_t * vTables
Definition wlc.h:162
Here is the caller graph for this function:

◆ Wlc_NtkUifNodePairs()

Wlc_Ntk_t * Wlc_NtkUifNodePairs ( Wlc_Ntk_t * p,
Vec_Int_t * vPairsInit )
extern

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

Synopsis [Adds UIF constraints to node pairs and updates POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file wlcUif.c.

237{
238 Vec_Int_t * vPairs = vPairsInit;
239 Wlc_Ntk_t * pNew;
240 Wlc_Obj_t * pObj, * pObj2;
241 Vec_Int_t * vUifConstrs, * vCompares, * vFanins;
242 int i, k, iObj, iObj2, iObjNew, iObjNew2;
243 int iFanin, iFanin2, iFaninNew;
244 // get multiplier pairs if not given
245 if ( vPairs == NULL )
247 if ( vPairs == NULL )
248 return NULL;
249 // sanity checks
250 assert( Vec_IntSize(vPairs) > 0 && Vec_IntSize(vPairs) % 2 == 0 );
251 // iterate through node pairs
252 vFanins = Vec_IntAlloc( 100 );
253 vCompares = Vec_IntAlloc( 100 );
254 vUifConstrs = Vec_IntAlloc( 100 );
255 Vec_IntForEachEntryDouble( vPairs, iObj, iObj2, i )
256 {
257 // get two nodes
258 pObj = Wlc_NtkObj( p, iObj );
259 pObj2 = Wlc_NtkObj( p, iObj2 );
260 assert( Wlc_NtkPairIsUifable(p, pObj, pObj2) );
261 // create fanin comparator nodes
262 Vec_IntClear( vCompares );
263 Wlc_ObjForEachFanin( pObj, iFanin, k )
264 {
265 iFanin2 = Wlc_ObjFaninId( pObj2, k );
266 Vec_IntFillTwo( vFanins, 2, iFanin, iFanin2 );
267 iFaninNew = Wlc_ObjCreate( p, WLC_OBJ_COMP_NOTEQU, 0, 0, 0, vFanins );
268 Vec_IntPush( vCompares, iFaninNew );
269 // note that a pointer to Wlc_Obj_t (for example, pObj) can be invalidated after a call to
270 // Wlc_ObjCreate() due to a possible realloc of the internal array of objects...
271 pObj = Wlc_NtkObj( p, iObj );
272 }
273 // concatenate fanin comparators
274 iObjNew = Wlc_ObjCreate( p, WLC_OBJ_BIT_CONCAT, 0, Vec_IntSize(vCompares) - 1, 0, vCompares );
275 // create reduction-OR node
276 Vec_IntFill( vFanins, 1, iObjNew );
277 iObjNew = Wlc_ObjCreate( p, WLC_OBJ_REDUCT_OR, 0, 0, 0, vFanins );
278 // craete output comparator node
279 Vec_IntFillTwo( vFanins, 2, iObj, iObj2 );
280 iObjNew2 = Wlc_ObjCreate( p, WLC_OBJ_COMP_EQU, 0, 0, 0, vFanins );
281 // create implication node (iObjNew is already complemented above)
282 Vec_IntFillTwo( vFanins, 2, iObjNew, iObjNew2 );
283 iObjNew = Wlc_ObjCreate( p, WLC_OBJ_LOGIC_OR, 0, 0, 0, vFanins );
284 // save the constraint
285 Vec_IntPush( vUifConstrs, iObjNew );
286 }
287 // derive the AND of the UIF contraints
288 assert( Vec_IntSize(vUifConstrs) > 0 );
289 if ( Vec_IntSize(vUifConstrs) == 1 )
290 iObjNew = Vec_IntEntry( vUifConstrs, 0 );
291 else
292 {
293 // concatenate
294 iObjNew = Wlc_ObjCreate( p, WLC_OBJ_BIT_CONCAT, 0, Vec_IntSize(vUifConstrs) - 1, 0, vUifConstrs );
295 // create reduction-AND node
296 Vec_IntFill( vFanins, 1, iObjNew );
297 iObjNew = Wlc_ObjCreate( p, WLC_OBJ_REDUCT_AND, 0, 0, 0, vFanins );
298 }
299 // update each PO to point to the new node
300 Wlc_NtkForEachPo( p, pObj, i )
301 {
302 iObj = Wlc_ObjId(p, pObj);
303 Vec_IntFillTwo( vFanins, 2, iObj, iObjNew );
304 iObjNew = Wlc_ObjCreate( p, WLC_OBJ_LOGIC_AND, 0, 0, 0, vFanins );
305 // note that a pointer to Wlc_Obj_t (for example, pObj) can be invalidated after a call to
306 // Wlc_ObjCreate() due to a possible realloc of the internal array of objects...
307 pObj = Wlc_NtkObj( p, iObj );
308 // update PO/CO arrays
309 assert( Vec_IntEntry(&p->vPos, i) == iObj );
310 assert( Vec_IntEntry(&p->vCos, i) == iObj );
311 Vec_IntWriteEntry( &p->vPos, i, iObjNew );
312 Vec_IntWriteEntry( &p->vCos, i, iObjNew );
313 // transfer the PO attribute
314 Wlc_NtkObj(p, iObjNew)->fIsPo = 1;
315 assert( pObj->fIsPo );
316 pObj->fIsPo = 0;
317 }
318 // cleanup
319 Vec_IntFree( vUifConstrs );
320 Vec_IntFree( vCompares );
321 Vec_IntFree( vFanins );
322 if ( vPairs != vPairsInit )
323 Vec_IntFree( vPairs );
324 // reconstruct topological order
325 pNew = Wlc_NtkDupDfs( p, 0, 1 );
326 return pNew;
327}
Vec_Int_t * Wlc_NtkFindUifableMultiplierPairs(Wlc_Ntk_t *p)
Definition wlcUif.c:145
int Wlc_ObjCreate(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg, Vec_Int_t *vFanins)
Definition wlcNtk.c:219
Here is the call graph for this function:

◆ Wlc_ObjAddFanins()

void Wlc_ObjAddFanins ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
Vec_Int_t * vFanins )
extern

Definition at line 240 of file wlcNtk.c.

241{
242 assert( pObj->nFanins == 0 );
243 pObj->nFanins = Vec_IntSize(vFanins);
244 // special treatment of CONST, SELECT and TABLE
245 if ( pObj->Type == WLC_OBJ_CONST )
246 pObj->nFanins = 0;
247 else if ( pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_TABLE )
248 pObj->nFanins = 1;
249 if ( Wlc_ObjHasArray(pObj) )
250 pObj->pFanins[0] = (int *)Mem_FlexEntryFetch( p->pMemFanin, Vec_IntSize(vFanins) * sizeof(int) );
251 memcpy( Wlc_ObjFanins(pObj), Vec_IntArray(vFanins), sizeof(int) * Vec_IntSize(vFanins) );
252}
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition mem.c:388
int * pFanins[1]
Definition wlc.h:132
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjAlloc()

int Wlc_ObjAlloc ( Wlc_Ntk_t * p,
int Type,
int Signed,
int End,
int Beg )
extern

Definition at line 199 of file wlcNtk.c.

200{
201 Wlc_Obj_t * pObj;
202 assert( Type != WLC_OBJ_PO && Type != WLC_OBJ_FI );
203 if ( p->iObj == p->nObjsAlloc )
204 {
205 p->pObjs = ABC_REALLOC( Wlc_Obj_t, p->pObjs, 2 * p->nObjsAlloc );
206 memset( p->pObjs + p->nObjsAlloc, 0, sizeof(Wlc_Obj_t) * p->nObjsAlloc );
207 p->nObjsAlloc *= 2;
208 }
209 pObj = Wlc_NtkObj( p, p->iObj );
210 pObj->Type = Type;
211 pObj->Signed = Signed;
212 pObj->End = End;
213 pObj->Beg = Beg;
214 if ( Wlc_ObjIsCi(pObj) )
215 Wlc_ObjSetCi( p, pObj );
216 p->nObjs[Type]++;
217 return p->iObj++;
218}
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
void Wlc_ObjSetCi(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:168
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjCreate()

int Wlc_ObjCreate ( Wlc_Ntk_t * p,
int Type,
int Signed,
int End,
int Beg,
Vec_Int_t * vFanins )
extern

Definition at line 219 of file wlcNtk.c.

220{
221 int iFaninNew = Wlc_ObjAlloc( p, Type, Signed, End, Beg );
222 Wlc_ObjAddFanins( p, Wlc_NtkObj(p, iFaninNew), vFanins );
223 return iFaninNew;
224}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjDup()

int Wlc_ObjDup ( Wlc_Ntk_t * pNew,
Wlc_Ntk_t * p,
int iObj,
Vec_Int_t * vFanins )
extern

Definition at line 930 of file wlcNtk.c.

931{
932 Wlc_Obj_t * pObj = Wlc_NtkObj( p, iObj );
933 int iFaninNew = Wlc_ObjAlloc( pNew, pObj->Type, Wlc_ObjIsSigned(pObj), pObj->End, pObj->Beg );
934 Wlc_Obj_t * pObjNew = Wlc_NtkObj(pNew, iFaninNew);
935 Wlc_ObjCollectCopyFanins( p, iObj, vFanins );
936 Wlc_ObjAddFanins( pNew, pObjNew, vFanins );
937 Wlc_ObjSetCopy( p, iObj, iFaninNew );
938 pObjNew->fXConst = pObj->fXConst;
939 return iFaninNew;
940}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjName()

char * Wlc_ObjName ( Wlc_Ntk_t * p,
int iObj )
extern

Definition at line 225 of file wlcNtk.c.

226{
227 static char Buffer[100];
228 if ( Wlc_NtkHasNameId(p) && Wlc_ObjNameId(p, iObj) )
229 return Abc_NamStr( p->pManName, Wlc_ObjNameId(p, iObj) );
230 sprintf( Buffer, "n%d", iObj );
231 return Buffer;
232}
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:

◆ Wlc_ObjSetCi()

void Wlc_ObjSetCi ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj )
extern

Definition at line 168 of file wlcNtk.c.

169{
170 assert( Wlc_ObjIsCi(pObj) );
171 assert( Wlc_ObjFaninNum(pObj) == 0 );
172 if ( Wlc_NtkPiNum(p) == Wlc_NtkCiNum(p) || pObj->Type != WLC_OBJ_PI )
173 {
174 pObj->Fanins[1] = Vec_IntSize(&p->vCis);
175 Vec_IntPush( &p->vCis, Wlc_ObjId(p, pObj) );
176 }
177 else // insert in the array of CI at the end of PIs
178 {
179 Wlc_Obj_t * pTemp; int i;
180 Vec_IntInsert( &p->vCis, Wlc_NtkPiNum(p), Wlc_ObjId(p, pObj) );
181 // other CI IDs are invalidated... naive fix!
182 Wlc_NtkForEachCi( p, pTemp, i )
183 pTemp->Fanins[1] = i;
184 }
185 if ( pObj->Type == WLC_OBJ_PI )
186 Vec_IntPush( &p->vPis, Wlc_ObjId(p, pObj) );
187}
int Fanins[2]
Definition wlc.h:131
Here is the caller graph for this function:

◆ Wlc_ObjSetCo()

void Wlc_ObjSetCo ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
int fFlopInput )
extern

Definition at line 188 of file wlcNtk.c.

189{
190// pObj->Fanins[1] = Vec_IntSize(&p->vCos);
191 Vec_IntPush( &p->vCos, Wlc_ObjId(p, pObj) );
192 if ( !fFlopInput )
193 Vec_IntPush( &p->vPos, Wlc_ObjId(p, pObj) );
194 if ( fFlopInput )
195 pObj->fIsFi = 1;
196 else
197 pObj->fIsPo = 1;
198}
Here is the caller graph for this function:

◆ Wlc_ObjTypeName()

char * Wlc_ObjTypeName ( Wlc_Obj_t * p)
extern

Definition at line 97 of file wlcNtk.c.

97{ return p ? (p->Type < WLC_OBJ_NUMBER ? Wlc_Names[p->Type] : (char *)"out_of_bound") : (char *)"no_obj"; }
Here is the caller graph for this function:

◆ Wlc_ObjUpdateType()

void Wlc_ObjUpdateType ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
int Type )
extern

Definition at line 233 of file wlcNtk.c.

234{
235 assert( pObj->Type == WLC_OBJ_NONE );
236 p->nObjs[pObj->Type]--;
237 pObj->Type = Type;
238 p->nObjs[pObj->Type]++;
239}
Here is the caller graph for this function:

◆ Wlc_PrsConvertInitValues()

char * Wlc_PrsConvertInitValues ( Wlc_Ntk_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 440 of file wlcReadVer.c.

441{
442 Wlc_Obj_t * pObj;
443 int i, k, Value, * pInits;
444 char * pResult;
445 Vec_Str_t * vStr = Vec_StrAlloc( 1000 );
446 Vec_IntForEachEntry( p->vInits, Value, i )
447 {
448 if ( Value < 0 )
449 {
450 for ( k = 0; k < -Value; k++ )
451 Vec_StrPush( vStr, '0' );
452 continue;
453 }
454 pObj = Wlc_NtkObj( p, Value );
455 Value = Wlc_ObjRange(pObj);
456 while ( pObj->Type == WLC_OBJ_BUF )
457 pObj = Wlc_NtkObj( p, Wlc_ObjFaninId0(pObj) );
458 pInits = (pObj->Type == WLC_OBJ_CONST && !pObj->fXConst) ? Wlc_ObjConstValue(pObj) : NULL;
459 for ( k = 0; k < Abc_MinInt(Value, Wlc_ObjRange(pObj)); k++ )
460 Vec_StrPush( vStr, (char)(pInits ? '0' + Abc_InfoHasBit((unsigned *)pInits, k) : 'x') );
461 // extend values with zero, in case the init value signal has different range compared to constant used
462 for ( ; k < Value; k++ )
463 Vec_StrPush( vStr, '0' );
464 // update vInits to contain either number of values or PI index
465 Vec_IntWriteEntry( p->vInits, i, (pInits || pObj->fXConst) ? -Value : Wlc_ObjCiId(pObj) );
466 }
467 Vec_StrPush( vStr, '\0' );
468 pResult = Vec_StrReleaseArray( vStr );
469 Vec_StrFree( vStr );
470 return pResult;
471}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
Here is the caller graph for this function:

◆ Wlc_ReadNdr()

Wlc_Ntk_t * Wlc_ReadNdr ( char * pFileName)
extern

Definition at line 551 of file wlcNdr.c.

552{
553 void * pData = Ndr_Read( pFileName );
554 Wlc_Ntk_t * pNtk = Wlc_NtkFromNdr( pData );
555 //Ndr_DumpNdr( pData );
556 //char * ppNames[10] = { NULL, "a", "b", "c", "d", "e", "f", "g", "h", "i" };
557 //Ndr_WriteVerilog( NULL, pData, ppNames, 0 );
558 //Ndr_Delete( pData );
560 return pNtk;
561}
ABC_DLL void Abc_FrameInputNdr(Abc_Frame_t *pAbc, void *pData)
Definition mainFrame.c:89
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
Wlc_Ntk_t * Wlc_NtkFromNdr(void *pData)
Definition wlcNdr.c:366
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ReadSmt()

Wlc_Ntk_t * Wlc_ReadSmt ( char * pFileName,
int fOldParser,
int fPrintTree )
extern

Definition at line 1766 of file wlcReadSmt.c.

1767{
1768 Wlc_Ntk_t * pNtk = NULL;
1769 char * pBuffer, * pLimit;
1770 pBuffer = Smt_PrsLoadFile( pFileName, &pLimit );
1771 if ( pBuffer == NULL )
1772 return NULL;
1773 pNtk = Wlc_ReadSmtBuffer( pFileName, pBuffer, pLimit, fOldParser, fPrintTree );
1774 ABC_FREE( pBuffer );
1775 return pNtk;
1776}
Wlc_Ntk_t * Wlc_ReadSmtBuffer(char *pFileName, char *pBuffer, char *pLimit, int fOldParser, int fPrintTree)
Here is the call graph for this function:

◆ Wlc_ReadSmtBuffer()

Wlc_Ntk_t * Wlc_ReadSmtBuffer ( char * pFileName,
char * pBuffer,
char * pLimit,
int fOldParser,
int fPrintTree )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1751 of file wlcReadSmt.c.

1752{
1753 Wlc_Ntk_t * pNtk = NULL;
1754 int nCount = Smt_PrsRemoveComments( pBuffer, pLimit );
1755 Smt_Prs_t * p = Smt_PrsAlloc( pFileName, pBuffer, pLimit, nCount );
1756 if ( p == NULL )
1757 return NULL;
1759 if ( fPrintTree )
1761 if ( Smt_PrsErrorPrint(p) )
1762 pNtk = fOldParser ? Smt_PrsBuild(p) : Smt_PrsBuild2(p);
1763 Smt_PrsFree( p );
1764 return pNtk;
1765}
Wlc_Ntk_t * Smt_PrsBuild(Smt_Prs_t *p)
Definition wlcReadSmt.c:799
void Smt_PrsReadLines(Smt_Prs_t *p)
Wlc_Ntk_t * Smt_PrsBuild2(Smt_Prs_t *p)
void Smt_PrsPrintParser(Smt_Prs_t *p)
typedefABC_NAMESPACE_IMPL_START struct Smt_Prs_t_ Smt_Prs_t
DECLARATIONS ///.
Definition wlcReadSmt.c:31
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ReadVer()

Wlc_Ntk_t * Wlc_ReadVer ( char * pFileName,
char * pStr,
int fInter )
extern

Definition at line 1693 of file wlcReadVer.c.

1694{
1695 Wlc_Prs_t * p;
1696 Wlc_Ntk_t * pNtk = NULL;
1697 // either file name or string is given
1698 assert( (pFileName == NULL) != (pStr == NULL) );
1699 // start the parser
1700 p = Wlc_PrsStart( pFileName, pStr );
1701 if ( p == NULL )
1702 return NULL;
1703 // detect lines
1704 if ( !Wlc_PrsPrepare( p ) )
1705 goto finish;
1706 // parse models
1707 if ( !Wlc_PrsDerive( p, fInter ) )
1708 {
1709 if ( fInter )
1710 {
1711 printf( "Finished deriving interface for module \"%s\".\n", p->pNtk->pName );
1712 pNtk = p->pNtk; p->pNtk = NULL;
1713 pNtk->pSpec = Abc_UtilStrsav( pFileName );
1714 if ( Vec_IntSize(&pNtk->vNameIds) == 0 )
1715 {
1716 Vec_Int_t * vTemp = Vec_IntStartNatural( Wlc_NtkObjNumMax(pNtk) );
1717 pNtk->vNameIds = *vTemp, Vec_IntZero(vTemp);
1718 Vec_IntFree( vTemp );
1719 }
1720 return pNtk;
1721 }
1722 goto finish;
1723 }
1724 // derive topological order
1725 if ( p->pNtk )
1726 {
1727 Wlc_Obj_t * pObj; int i;
1728 Wlc_NtkForEachObj( p->pNtk, pObj, i )
1729 if ( pObj->Type == WLC_OBJ_FF )
1730 Vec_IntPush( &p->pNtk->vFfs2, Wlc_ObjId(p->pNtk, pObj) );
1731 pNtk = Wlc_NtkDupDfs( p->pNtk, 0, 1 );
1732 pNtk->pSpec = Abc_UtilStrsav( pFileName );
1733 }
1734finish:
1736 Wlc_PrsStop( p );
1737 return pNtk;
1738}
int Wlc_PrsPrepare(Wlc_Prs_t *p)
Definition wlcReadVer.c:306
void Wlc_PrsPrintErrorMessage(Wlc_Prs_t *p)
Definition wlcReadVer.c:150
Wlc_Prs_t * Wlc_PrsStart(char *pFileName, char *pStr)
FUNCTION DEFINITIONS ///.
Definition wlcReadVer.c:79
struct Wlc_Prs_t_ Wlc_Prs_t
Definition wlcReadVer.c:33
void Wlc_PrsStop(Wlc_Prs_t *p)
Definition wlcReadVer.c:95
int Wlc_PrsDerive(Wlc_Prs_t *p, int fInter)
Definition wlcReadVer.c:954
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_SetNtk()

void Wlc_SetNtk ( Abc_Frame_t * pAbc,
Wlc_Ntk_t * pNtk )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file wlcCom.c.

134{
135 Wlc_AbcUpdateNtk( pAbc, pNtk );
136}
Here is the caller graph for this function:

◆ Wlc_StdinProcessSmt()

int Wlc_StdinProcessSmt ( Abc_Frame_t * pAbc,
char * pCmd )
extern

Definition at line 190 of file wlcStdin.c.

191{
192 // collect stdin until (check-sat)
193 Vec_Str_t * vInput = Wlc_StdinCollectProblem( "(check-sat)" );
194 // parse input
195 Wlc_Ntk_t * pNtk = Wlc_ReadSmtBuffer( "top", Vec_StrArray(vInput), Vec_StrArray(vInput) + Vec_StrSize(vInput), 0, 0 );
196 Vec_StrFree( vInput );
197 // install current network
198 Wlc_SetNtk( pAbc, pNtk );
199 // execute command
200 if ( Cmd_CommandExecute(pAbc, pCmd) )
201 {
202 Abc_Print( 1, "Something did not work out with the command \"%s\".\n", pCmd );
203 return 0;
204 }
205 // solver finished
206 if ( Abc_FrameReadProbStatus(pAbc) == -1 )
207 printf( "undecided\n" );
208 else if ( Abc_FrameReadProbStatus(pAbc) == 1 )
209 printf( "unsat\n" );
210 else if ( Abc_FrameReadProbStatus(pAbc) == 0 )
211 printf( "sat\n" );
212 else assert( 0 );
213 fflush( stdout );
214 // wait for stdin for give directions
215 while ( (vInput = Wlc_StdinCollectQuery()) != NULL )
216 {
217 char * pName = strtok( Vec_StrArray(vInput), " \n\t\r()" );
218 // check directive
219 if ( strcmp(pName, "get-value") )
220 {
221 Abc_Print( 1, "ABC is expecting \"get-value\" in a follow-up input of the satisfiable problem.\n" );
222 Vec_StrFree( vInput );
223 return 0;
224 }
225 // check status
226 if ( Abc_FrameReadProbStatus(pAbc) != 0 )
227 {
228 Abc_Print( 1, "ABC received a follow-up input for a problem that is not known to be satisfiable.\n" );
229 Vec_StrFree( vInput );
230 return 0;
231 }
232 // get the variable number
233 pName = strtok( NULL, "() \n\t\r" );
234 // get the counter-example
235 if ( Abc_FrameReadCex(pAbc) == NULL )
236 {
237 Abc_Print( 1, "ABC does not have a counter-example available to process a \"get-value\" request.\n" );
238 Vec_StrFree( vInput );
239 return 0;
240 }
241 // report value of this variable
242 Wlc_NtkReport( (Wlc_Ntk_t *)pAbc->pAbcWlc, (Abc_Cex_t *)Abc_FrameReadCex(pAbc), pName, 16 );
243 Vec_StrFree( vInput );
244 fflush( stdout );
245 }
246 return 1;
247}
ABC_DLL int Abc_FrameReadProbStatus(Abc_Frame_t *pAbc)
Definition mainFrame.c:74
ABC_DLL void * Abc_FrameReadCex(Abc_Frame_t *pAbc)
Definition mainFrame.c:75
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Definition cmdApi.c:193
int strcmp()
char * strtok()
Vec_Str_t * Wlc_StdinCollectQuery()
Definition wlcStdin.c:170
void Wlc_NtkReport(Wlc_Ntk_t *p, Abc_Cex_t *pCex, char *pName, int Radix)
Definition wlcStdin.c:110
Vec_Str_t * Wlc_StdinCollectProblem(char *pDir)
Definition wlcStdin.c:157
Wlc_Ntk_t * Wlc_ReadSmtBuffer(char *pFileName, char *pBuffer, char *pLimit, int fOldParser, int fPrintTree)
void Wlc_SetNtk(Abc_Frame_t *pAbc, Wlc_Ntk_t *pNtk)
Definition wlcCom.c:133
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_WinProfileArith()

void Wlc_WinProfileArith ( Wlc_Ntk_t * p)
extern

Definition at line 132 of file wlcWin.c.

133{
134 Vec_Int_t * vLeaves = Vec_IntAlloc( 1000 );
135 Vec_Int_t * vNodes = Vec_IntAlloc( 1000 );
136 Wlc_Obj_t * pObj; int i, Count = 0;
137 Wlc_NtkForEachObj( p, pObj, i )
138 pObj->Mark = 0;
139 Wlc_NtkForEachObj( p, pObj, i )
140 if ( Wlc_ObjHasArithm_rec(p, pObj) ? Wlc_ObjIsCo(pObj) : Wlc_ObjHasArithmFanins(p, pObj) )
141 {
142 Wlc_WinCompute( p, pObj, vLeaves, vNodes );
143 if ( Wlc_ManCountArithmReal(p, vNodes) < 2 )
144 continue;
145
146 printf( "Arithmetic cone of node %d (%s):\n", Wlc_ObjId(p, pObj), Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
147 Wlc_NtkPrintNode( p, pObj );
148 Vec_IntReverseOrder( vNodes );
149 Wlc_NtkPrintNodeArray( p, vNodes );
150 printf( "\n" );
151 Count++;
152 }
153 Wlc_NtkForEachObj( p, pObj, i )
154 assert( pObj->Mark == 0 );
155 printf( "Finished printing %d arithmetic cones.\n", Count );
156 Vec_IntFree( vLeaves );
157 Vec_IntFree( vNodes );
158}
void Wlc_WinCompute(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Int_t *vNodes)
Definition wlcWin.c:111
int Wlc_ObjHasArithmFanins(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcWin.c:78
int Wlc_ManCountArithmReal(Wlc_Ntk_t *p, Vec_Int_t *vNodes)
Definition wlcWin.c:60
int Wlc_ObjHasArithm_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcWin.c:68
void Wlc_NtkPrintNode(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:703
Here is the call graph for this function:

◆ Wlc_WriteNdr()

void Wlc_WriteNdr ( Wlc_Ntk_t * pNtk,
char * pFileName )
extern

Definition at line 247 of file wlcNdr.c.

248{
249 void * pDesign = Wlc_NtkToNdr( pNtk );
250 Ndr_Write( pFileName, pDesign );
251 Ndr_Delete( pDesign );
252 printf( "Dumped the current design into file \"%s\".\n", pFileName );
253}
void * Wlc_NtkToNdr(Wlc_Ntk_t *pNtk)
Definition wlcNdr.c:190
Here is the call graph for this function:

◆ Wlc_WriteVer()

void Wlc_WriteVer ( Wlc_Ntk_t * p,
char * pFileName,
int fAddCos,
int fNoFlops )
extern

Definition at line 597 of file wlcWriteVer.c.

598{
599 FILE * pFile;
600 pFile = fopen( pFileName, "w" );
601 if ( pFile == NULL )
602 {
603 fprintf( stdout, "Wlc_WriteVer(): Cannot open the output file \"%s\".\n", pFileName );
604 return;
605 }
606 fprintf( pFile, "// Benchmark \"%s\" from file \"%s\" written by ABC on %s\n", p->pName, p->pSpec ? p->pSpec : "unknown", Extra_TimeStamp() );
607 fprintf( pFile, "\n" );
608 Wlc_WriteTables( pFile, p );
609 if ( fAddCos )
611 Wlc_WriteVerInt( pFile, p, fNoFlops );
612 fprintf( pFile, "\n" );
613 fclose( pFile );
614}
char * Extra_TimeStamp()
void Wlc_WriteVerInt(FILE *pFile, Wlc_Ntk_t *p, int fNoFlops)
void Wlc_WriteTables(FILE *pFile, Wlc_Ntk_t *p)
Definition wlcWriteVer.c:64
void Wlc_WriteAddPos(Wlc_Ntk_t *p)
Definition wlcWriteVer.c:99
Here is the call graph for this function:
Here is the caller graph for this function: