Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
3974ff75
Commit
3974ff75
authored
Mar 17, 2017
by
Yen-Sheng Ho
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
4d7cec50
d66ff2cf
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
402 additions
and
32 deletions
+402
-32
abclib.dsp
+4
-0
src/aig/miniaig/ndr.h
+24
-2
src/base/cba/cbaCom.c
+18
-18
src/base/wlc/module.make
+1
-0
src/base/wlc/wlc.h
+2
-1
src/base/wlc/wlcAbs.c
+5
-5
src/base/wlc/wlcAbs2.c
+1
-1
src/base/wlc/wlcBlast.c
+2
-2
src/base/wlc/wlcCom.c
+49
-1
src/base/wlc/wlcGraft.c
+294
-0
src/base/wlc/wlcReadVer.c
+1
-1
src/base/wlc/wlcSim.c
+1
-1
No files found.
abclib.dsp
View file @
3974ff75
...
...
@@ -799,6 +799,10 @@ SOURCE=.\src\base\wlc\wlcCom.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wlc\wlcGraft.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wlc\wlcJson.c
# End Source File
# Begin Source File
...
...
src/aig/miniaig/ndr.h
View file @
3974ff75
...
...
@@ -113,7 +113,8 @@ typedef enum {
NDR_NAME
,
// 7: name
NDR_RANGE
,
// 8: bit range
NDR_FUNCTION
,
// 9: specified for some operators (PLAs, etc)
NDR_UNKNOWN
// 10: unknown
NDR_TARGET
,
// 10: target
NDR_UNKNOWN
// 11: unknown
}
Ndr_RecordType_t
;
// operator types
...
...
@@ -337,7 +338,6 @@ static inline void Ndr_DataPushString( Ndr_Data_t * p, int Type, char * pFunc )
Ndr_DataPushArray
(
p
,
Type
,
(
strlen
(
pFunc
)
+
4
)
/
4
,
(
int
*
)
pFunc
);
}
////////////////////////////////////////////////////////////////////////
/// VERILOG WRITING ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -409,6 +409,28 @@ static inline char * Ndr_ObjReadInName( Ndr_Data_t * p, int Obj, char ** pNames
return
pNames
[
Ndr_ObjReadBody
(
p
,
Obj
,
NDR_INPUT
)];
}
static
inline
int
Ndr_DataCiNum
(
Ndr_Data_t
*
p
,
int
Mod
)
{
int
Obj
,
Count
=
0
;
Ndr_ModForEachPi
(
p
,
Mod
,
Obj
)
Count
++
;
return
Count
;
}
static
inline
int
Ndr_DataCoNum
(
Ndr_Data_t
*
p
,
int
Mod
)
{
int
Obj
,
Count
=
0
;
Ndr_ModForEachPo
(
p
,
Mod
,
Obj
)
Count
++
;
return
Count
;
}
static
inline
int
Ndr_DataObjNum
(
Ndr_Data_t
*
p
,
int
Mod
)
{
int
Obj
,
Count
=
0
;
Ndr_ModForEachObj
(
p
,
Mod
,
Obj
)
Count
++
;
return
Count
;
}
// to write signal names, this procedure takes a mapping of name IDs into actual char-strings (pNames)
static
inline
void
Ndr_ModuleWriteVerilog
(
char
*
pFileName
,
void
*
pModule
,
char
**
pNames
)
{
...
...
src/base/cba/cbaCom.c
View file @
3974ff75
...
...
@@ -59,15 +59,15 @@ static inline void Cba_AbcUpdateMan( Abc_Frame_t * pAbc, Cba_Man_t * p )
******************************************************************************/
void
Cba_Init
(
Abc_Frame_t
*
pAbc
)
{
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
read"
,
Cba_CommandRead
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
write"
,
Cba_CommandWrite
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
ps"
,
Cba_CommandPs
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
put"
,
Cba_CommandPut
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
get"
,
Cba_CommandGet
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
clp"
,
Cba_CommandClp
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
blast"
,
Cba_CommandBlast
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
cec"
,
Cba_CommandCec
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
@
test"
,
Cba_CommandTest
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
read"
,
Cba_CommandRead
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
write"
,
Cba_CommandWrite
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
ps"
,
Cba_CommandPs
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
put"
,
Cba_CommandPut
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
get"
,
Cba_CommandGet
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
clp"
,
Cba_CommandClp
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
blast"
,
Cba_CommandBlast
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
cec"
,
Cba_CommandCec
,
0
);
Cmd_CommandAdd
(
pAbc
,
"New word level"
,
"
:
test"
,
Cba_CommandTest
,
0
);
}
/**Function********************************************************************
...
...
@@ -173,7 +173,7 @@ int Cba_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
Cba_AbcUpdateMan
(
pAbc
,
p
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
read [-tdvh] <file_name>
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
read [-tdvh] <file_name>
\n
"
);
Abc_Print
(
-
2
,
"
\t
reads hierarchical design
\n
"
);
Abc_Print
(
-
2
,
"
\t
-t : toggle testing the parser [default = %s]
\n
"
,
fTest
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-d : toggle computing DFS ordering [default = %s]
\n
"
,
fDfs
?
"yes"
:
"no"
);
...
...
@@ -248,7 +248,7 @@ int Cba_CommandWrite( Abc_Frame_t * pAbc, int argc, char ** argv )
}
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
write [-cvh]
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
write [-cvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
writes the design into a file in BLIF or Verilog
\n
"
);
Abc_Print
(
-
2
,
"
\t
-c : toggle inlining input concatenations [default = %s]
\n
"
,
fInclineCats
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
...
...
@@ -327,7 +327,7 @@ int Cba_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
Cba_NtkPrintNodes
(
Cba_ManRoot
(
p
),
CBA_BOX_ADD
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
ps [-M num] [-madvh]
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
ps [-M num] [-madvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
prints statistics
\n
"
);
Abc_Print
(
-
2
,
"
\t
-M num : the number of first modules to report [default = %d]
\n
"
,
nModules
);
Abc_Print
(
-
2
,
"
\t
-m : toggle printing multipliers [default = %s]
\n
"
,
fShowMulti
?
"yes"
:
"no"
);
...
...
@@ -388,7 +388,7 @@ int Cba_CommandPut( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_FrameUpdateGia
(
pAbc
,
pGia
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
put [-bsvh]
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
put [-bsvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
extracts AIG from the hierarchical design
\n
"
);
Abc_Print
(
-
2
,
"
\t
-b : toggle using barrier buffers [default = %s]
\n
"
,
fBarBufs
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-s : toggle blasting sequential elements [default = %s]
\n
"
,
fSeq
?
"yes"
:
"no"
);
...
...
@@ -456,7 +456,7 @@ int Cba_CommandGet( Abc_Frame_t * pAbc, int argc, char ** argv )
Cba_AbcUpdateMan
(
pAbc
,
pNew
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
get [-mvh]
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
get [-mvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
extracts AIG or mapped network into the hierarchical design
\n
"
);
Abc_Print
(
-
2
,
"
\t
-m : toggle using mapped network from main-space [default = %s]
\n
"
,
fMapped
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
...
...
@@ -502,7 +502,7 @@ int Cba_CommandClp( Abc_Frame_t * pAbc, int argc, char ** argv )
Cba_AbcUpdateMan
(
pAbc
,
pNew
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
clp [-vh]
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
clp [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
collapses the current hierarchical design
\n
"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
...
...
@@ -556,7 +556,7 @@ int Cba_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_FrameUpdateGia
(
pAbc
,
pNew
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
blast [-svh]
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
blast [-svh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs bit-blasting of the word-level design
\n
"
);
Abc_Print
(
-
2
,
"
\t
-s : toggle blasting sequential elements [default = %s]
\n
"
,
fSeq
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
...
...
@@ -672,7 +672,7 @@ int Cba_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv )
Gia_ManStop
(
pSecond
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
cec [-vh]
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
cec [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
combinational equivalence checking
\n
"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
pPars
->
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
...
...
@@ -715,7 +715,7 @@ int Cba_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
}
return
0
;
usage:
Abc_Print
(
-
2
,
"usage:
@
test [-vh]
\n
"
);
Abc_Print
(
-
2
,
"usage:
:
test [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
experiments with word-level networks
\n
"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
...
...
src/base/wlc/module.make
View file @
3974ff75
...
...
@@ -3,6 +3,7 @@ SRC += src/base/wlc/wlcAbs.c \
src/base/wlc/wlcAbc.c
\
src/base/wlc/wlcBlast.c
\
src/base/wlc/wlcCom.c
\
src/base/wlc/wlcGraft.c
\
src/base/wlc/wlcJson.c
\
src/base/wlc/wlcNtk.c
\
src/base/wlc/wlcReadSmt.c
\
...
...
src/base/wlc/wlc.h
View file @
3974ff75
...
...
@@ -206,6 +206,7 @@ static inline int Wlc_ObjIsCo( Wlc_Obj_t * p )
static
inline
int
Wlc_ObjId
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
)
{
return
pObj
-
p
->
pObjs
;
}
static
inline
int
Wlc_ObjCiId
(
Wlc_Obj_t
*
p
)
{
assert
(
Wlc_ObjIsCi
(
p
)
);
return
p
->
Fanins
[
1
];
}
static
inline
int
Wlc_ObjType
(
Wlc_Obj_t
*
pObj
)
{
return
pObj
->
Type
;
}
static
inline
int
Wlc_ObjFaninNum
(
Wlc_Obj_t
*
p
)
{
return
p
->
nFanins
;
}
static
inline
int
Wlc_ObjHasArray
(
Wlc_Obj_t
*
p
)
{
return
p
->
nFanins
>
2
||
p
->
Type
==
WLC_OBJ_CONST
||
p
->
Type
==
WLC_OBJ_BIT_SELECT
;
}
static
inline
int
*
Wlc_ObjFanins
(
Wlc_Obj_t
*
p
)
{
return
Wlc_ObjHasArray
(
p
)
?
p
->
pFanins
[
0
]
:
p
->
Fanins
;
}
...
...
@@ -291,7 +292,7 @@ extern int Wlc_NtkPdrAbs( Wlc_Ntk_t * p, Wlc_Par_t * pPars );
/*=== wlcAbs2.c ========================================================*/
extern
int
Wlc_NtkAbsCore2
(
Wlc_Ntk_t
*
p
,
Wlc_Par_t
*
pPars
);
/*=== wlcBlast.c ========================================================*/
extern
Gia_Man_t
*
Wlc_NtkBitBlast
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vBoxIds
,
int
iOutput
,
int
nRange
,
int
fGiaSimple
,
int
fAddOutputs
,
int
fBooth
);
extern
Gia_Man_t
*
Wlc_NtkBitBlast
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vBoxIds
,
int
iOutput
,
int
nRange
,
int
fGiaSimple
,
int
fAddOutputs
,
int
fBooth
,
int
fNoCleanup
);
/*=== wlcCom.c ========================================================*/
extern
void
Wlc_SetNtk
(
Abc_Frame_t
*
pAbc
,
Wlc_Ntk_t
*
pNtk
);
/*=== wlcNtk.c ========================================================*/
...
...
src/base/wlc/wlcAbs.c
View file @
3974ff75
...
...
@@ -320,7 +320,7 @@ static Vec_Int_t * Wlc_NtkGetCoreSels( Gia_Man_t * pFrames, int nFrames, int num
static
Gia_Man_t
*
Wlc_NtkUnrollWithCex
(
Wlc_Ntk_t
*
pChoice
,
Abc_Cex_t
*
pCex
,
int
nbits_old_pis
,
int
num_sel_pis
,
int
*
p_num_ppis
,
int
sel_pi_first
,
int
fUsePPI
)
{
Gia_Man_t
*
pGiaChoice
=
Wlc_NtkBitBlast
(
pChoice
,
NULL
,
-
1
,
0
,
0
,
0
,
0
);
Gia_Man_t
*
pGiaChoice
=
Wlc_NtkBitBlast
(
pChoice
,
NULL
,
-
1
,
0
,
0
,
0
,
0
,
0
);
int
nbits_new_pis
=
Wlc_NtkNumPiBits
(
pChoice
);
int
num_ppis
=
nbits_new_pis
-
nbits_old_pis
-
num_sel_pis
;
int
num_undc_pis
=
Gia_ManPiNum
(
pGiaChoice
)
-
nbits_new_pis
;
...
...
@@ -485,7 +485,7 @@ Wlc_Ntk_t * Wlc_NtkIntroduceChoices( Wlc_Ntk_t * pNtk, Vec_Int_t * vBlacks )
static
int
Wlc_NtkCexIsReal
(
Wlc_Ntk_t
*
pOrig
,
Abc_Cex_t
*
pCex
)
{
Gia_Man_t
*
pGiaOrig
=
Wlc_NtkBitBlast
(
pOrig
,
NULL
,
-
1
,
0
,
0
,
0
,
0
);
Gia_Man_t
*
pGiaOrig
=
Wlc_NtkBitBlast
(
pOrig
,
NULL
,
-
1
,
0
,
0
,
0
,
0
,
0
);
int
f
,
i
;
Gia_Obj_t
*
pObj
,
*
pObjRi
;
...
...
@@ -1224,7 +1224,7 @@ Aig_Man_t * Wla_ManBitBlast( Wla_Man_t * pWla )
int
nDcFlops
;
Gia_Man_t
*
pTemp
;
pWla
->
pGia
=
Wlc_NtkBitBlast
(
pWla
->
pAbs
,
NULL
,
-
1
,
0
,
0
,
0
,
0
);
pWla
->
pGia
=
Wlc_NtkBitBlast
(
pWla
->
pAbs
,
NULL
,
-
1
,
0
,
0
,
0
,
0
,
0
);
// if the abstraction has flops with DC-init state,
// new PIs were introduced by bit-blasting at the end of the PI list
...
...
@@ -1567,7 +1567,7 @@ int Wlc_NtkPdrAbs2( Wlc_Ntk_t * p, Wlc_Par_t * pPars )
pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, &vFfNew, pPars->fVerbose );
}
pGia = Wlc_NtkBitBlast( pAbs, NULL, -1, 0, 0, 0, 0 );
pGia = Wlc_NtkBitBlast( pAbs, NULL, -1, 0, 0, 0, 0
, 0
);
// map old flops into new flops
if ( vFfOld )
...
...
@@ -1869,7 +1869,7 @@ int Wlc_NtkAbsCore( Wlc_Ntk_t * p, Wlc_Par_t * pPars )
pAbs
=
Wlc_NtkAbs
(
p
,
pPars
,
vUnmark
,
&
vPisNew
,
NULL
,
pPars
->
fVerbose
);
}
pGia
=
Wlc_NtkBitBlast
(
pAbs
,
NULL
,
-
1
,
0
,
0
,
0
,
0
);
pGia
=
Wlc_NtkBitBlast
(
pAbs
,
NULL
,
-
1
,
0
,
0
,
0
,
0
,
0
);
// if the abstraction has flops with DC-init state,
// new PIs were introduced by bit-blasting at the end of the PI list
...
...
src/base/wlc/wlcAbs2.c
View file @
3974ff75
...
...
@@ -328,7 +328,7 @@ int Wlc_NtkAbsCore2( Wlc_Ntk_t * p, Wlc_Par_t * pPars )
// get abstracted GIA and the set of pseudo-PIs (vPisNew)
pAbs
=
Wlc_NtkAbs
(
p
,
pPars
,
vUnmark
,
&
vPisNew
,
pPars
->
fVerbose
);
pGia
=
Wlc_NtkBitBlast
(
pAbs
,
NULL
,
-
1
,
0
,
0
,
0
,
0
);
pGia
=
Wlc_NtkBitBlast
(
pAbs
,
NULL
,
-
1
,
0
,
0
,
0
,
0
,
0
);
// if the abstraction has flops with DC-init state,
// new PIs were introduced by bit-blasting at the end of the PI list
...
...
src/base/wlc/wlcBlast.c
View file @
3974ff75
...
...
@@ -868,7 +868,7 @@ void Wlc_BlastBooth( Gia_Man_t * pNew, int * pArgA, int * pArgB, int nArgA, int
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Wlc_NtkBitBlast
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vBoxIds
,
int
iOutput
,
int
nOutputRange
,
int
fGiaSimple
,
int
fAddOutputs
,
int
fBooth
)
Gia_Man_t
*
Wlc_NtkBitBlast
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vBoxIds
,
int
iOutput
,
int
nOutputRange
,
int
fGiaSimple
,
int
fAddOutputs
,
int
fBooth
,
int
fNoCleanup
)
{
int
fVerbose
=
0
;
int
fUseOldMultiplierBlasting
=
0
;
...
...
@@ -1401,7 +1401,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, in
assert
(
nFFins
==
nFFouts
);
Gia_ManSetRegNum
(
pNew
,
nFFins
);
// finalize AIG
if
(
!
fGiaSimple
)
if
(
!
fGiaSimple
&&
!
fNoCleanup
)
{
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManDupRemapLiterals
(
vBits
,
pTemp
);
...
...
src/base/wlc/wlcCom.c
View file @
3974ff75
...
...
@@ -36,6 +36,7 @@ static int Abc_CommandAbs ( Abc_Frame_t * pAbc, int argc, char ** argv )
static
int
Abc_CommandPdrAbs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbs2
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandBlast
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandGraft
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandProfile
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandShortNames
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandShow
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -79,6 +80,7 @@ void Wlc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%pdra"
,
Abc_CommandPdrAbs
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%abs2"
,
Abc_CommandAbs2
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%blast"
,
Abc_CommandBlast
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%graft"
,
Abc_CommandGraft
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%profile"
,
Abc_CommandProfile
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%short_names"
,
Abc_CommandShortNames
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%show"
,
Abc_CommandShow
,
0
);
...
...
@@ -933,7 +935,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
}
// transform
pNew
=
Wlc_NtkBitBlast
(
pNtk
,
vBoxIds
,
iOutput
,
nOutputRange
,
fGiaSimple
,
fAddOutputs
,
fBooth
);
pNew
=
Wlc_NtkBitBlast
(
pNtk
,
vBoxIds
,
iOutput
,
nOutputRange
,
fGiaSimple
,
fAddOutputs
,
fBooth
,
0
);
Vec_IntFreeP
(
&
vBoxIds
);
if
(
pNew
==
NULL
)
{
...
...
@@ -967,6 +969,52 @@ usage:
SeeAlso []
******************************************************************************/
int
Abc_CommandGraft
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
Wlc_Ntk_t
*
Wlc_NtkGraftMulti
(
Wlc_Ntk_t
*
p
,
int
fVerbose
);
Wlc_Ntk_t
*
pNtk
=
Wlc_AbcGetNtk
(
pAbc
);
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"vh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pNtk
==
NULL
)
{
Abc_Print
(
1
,
"Abc_CommandGraft(): There is no current design.
\n
"
);
return
0
;
}
pNtk
=
Wlc_NtkGraftMulti
(
pNtk
,
fVerbose
);
Wlc_AbcUpdateNtk
(
pAbc
,
pNtk
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: %%graft [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
detects multipliers in LHS of the miter and moves them to RHS
\n
"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function********************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
******************************************************************************/
int
Abc_CommandProfile
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Wlc_Ntk_t
*
pNtk
=
Wlc_AbcGetNtk
(
pAbc
);
...
...
src/base/wlc/wlcGraft.c
0 → 100644
View file @
3974ff75
/**CFile****************************************************************
FileName [wlcGraft.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Verilog parser.]
Synopsis [Parses several flavors of word-level Verilog.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - August 22, 2014.]
Revision [$Id: wlcGraft.c,v 1.00 2014/09/12 00:00:00 alanmi Exp $]
***********************************************************************/
#include "wlc.h"
#include "sat/bsat/satStore.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Internal simulation APIs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
word
*
Wlc_ObjSim
(
Gia_Man_t
*
p
,
int
iObj
)
{
return
Vec_WrdEntryP
(
p
->
vSims
,
p
->
nSimWords
*
iObj
);
}
static
inline
void
Wlc_ObjSimPi
(
Gia_Man_t
*
p
,
int
iObj
)
{
int
w
;
word
*
pSim
=
Wlc_ObjSim
(
p
,
iObj
);
for
(
w
=
0
;
w
<
p
->
nSimWords
;
w
++
)
pSim
[
w
]
=
Gia_ManRandomW
(
0
);
pSim
[
0
]
<<=
1
;
}
static
inline
void
Wlc_ObjSimRo
(
Gia_Man_t
*
p
,
int
iObj
)
{
int
w
;
word
*
pSimRo
=
Wlc_ObjSim
(
p
,
iObj
);
word
*
pSimRi
=
Wlc_ObjSim
(
p
,
Gia_ObjRoToRiId
(
p
,
iObj
)
);
for
(
w
=
0
;
w
<
p
->
nSimWords
;
w
++
)
pSimRo
[
w
]
=
pSimRi
[
w
];
}
static
inline
void
Wlc_ObjSimCo
(
Gia_Man_t
*
p
,
int
iObj
)
{
int
w
;
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
word
*
pSimCo
=
Wlc_ObjSim
(
p
,
iObj
);
word
*
pSimDri
=
Wlc_ObjSim
(
p
,
Gia_ObjFaninId0
(
pObj
,
iObj
)
);
if
(
Gia_ObjFaninC0
(
pObj
)
)
for
(
w
=
0
;
w
<
p
->
nSimWords
;
w
++
)
pSimCo
[
w
]
=
~
pSimDri
[
w
];
else
for
(
w
=
0
;
w
<
p
->
nSimWords
;
w
++
)
pSimCo
[
w
]
=
pSimDri
[
w
];
}
static
inline
void
Wlc_ObjSimAnd
(
Gia_Man_t
*
p
,
int
iObj
)
{
int
w
;
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
word
*
pSim
=
Wlc_ObjSim
(
p
,
iObj
);
word
*
pSim0
=
Wlc_ObjSim
(
p
,
Gia_ObjFaninId0
(
pObj
,
iObj
)
);
word
*
pSim1
=
Wlc_ObjSim
(
p
,
Gia_ObjFaninId1
(
pObj
,
iObj
)
);
if
(
Gia_ObjFaninC0
(
pObj
)
&&
Gia_ObjFaninC1
(
pObj
)
)
for
(
w
=
0
;
w
<
p
->
nSimWords
;
w
++
)
pSim
[
w
]
=
~
pSim0
[
w
]
&
~
pSim1
[
w
];
else
if
(
Gia_ObjFaninC0
(
pObj
)
&&
!
Gia_ObjFaninC1
(
pObj
)
)
for
(
w
=
0
;
w
<
p
->
nSimWords
;
w
++
)
pSim
[
w
]
=
~
pSim0
[
w
]
&
pSim1
[
w
];
else
if
(
!
Gia_ObjFaninC0
(
pObj
)
&&
Gia_ObjFaninC1
(
pObj
)
)
for
(
w
=
0
;
w
<
p
->
nSimWords
;
w
++
)
pSim
[
w
]
=
pSim0
[
w
]
&
~
pSim1
[
w
];
else
for
(
w
=
0
;
w
<
p
->
nSimWords
;
w
++
)
pSim
[
w
]
=
pSim0
[
w
]
&
pSim1
[
w
];
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Wlc_NtkCollectObjs_rec
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
Vec_Int_t
*
vObjs
)
{
int
i
,
iFanin
,
Count
=
0
;
if
(
Wlc_ObjIsCi
(
pObj
)
)
return
0
;
if
(
pObj
->
Mark
)
return
0
;
pObj
->
Mark
=
1
;
Wlc_ObjForEachFanin
(
pObj
,
iFanin
,
i
)
Count
+=
Wlc_NtkCollectObjs_rec
(
p
,
Wlc_NtkObj
(
p
,
iFanin
),
vObjs
);
Vec_IntPush
(
vObjs
,
Wlc_ObjId
(
p
,
pObj
)
);
return
Count
+
(
int
)(
pObj
->
Type
==
WLC_OBJ_ARI_MULTI
);
}
Vec_Int_t
*
Wlc_NtkCollectObjs
(
Wlc_Ntk_t
*
p
,
int
fEven
,
int
*
pCount
)
{
Vec_Int_t
*
vObjs
=
Vec_IntAlloc
(
100
);
Wlc_Obj_t
*
pObj
;
int
i
,
Count
=
0
;
Wlc_NtkCleanMarks
(
p
);
Wlc_NtkForEachCo
(
p
,
pObj
,
i
)
if
(
(
i
&
1
)
==
fEven
)
Count
+=
Wlc_NtkCollectObjs_rec
(
p
,
pObj
,
vObjs
);
Wlc_NtkCleanMarks
(
p
);
if
(
pCount
)
*
pCount
=
Count
;
return
vObjs
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Wlc_NtkSaveOneNode
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pWlcObj
,
Gia_Man_t
*
pGia
,
Vec_Mem_t
*
vTtMem
)
{
int
k
,
Entry
;
int
nWords
=
Vec_MemEntrySize
(
vTtMem
);
int
nBits
=
Wlc_ObjRange
(
pWlcObj
);
int
iFirst
=
Vec_IntEntry
(
&
p
->
vCopies
,
Wlc_ObjId
(
p
,
pWlcObj
)
);
for
(
k
=
0
;
k
<
nBits
;
k
++
)
{
int
iLit
=
Vec_IntEntry
(
&
p
->
vBits
,
iFirst
+
k
);
word
*
pInfoObj
=
Wlc_ObjSim
(
pGia
,
Abc_Lit2Var
(
iLit
)
);
int
fCompl
=
pInfoObj
[
0
]
&
1
;
if
(
fCompl
)
Abc_TtNot
(
pInfoObj
,
nWords
);
Entry
=
Vec_MemHashInsert
(
vTtMem
,
pInfoObj
);
if
(
fCompl
)
Abc_TtNot
(
pInfoObj
,
nWords
);
printf
(
"%2d(%d) "
,
Entry
,
fCompl
^
Abc_LitIsCompl
(
iLit
)
);
Extra_PrintHex
(
stdout
,
(
unsigned
*
)
pInfoObj
,
8
);
printf
(
"
\n
"
);
}
printf
(
"
\n
"
);
}
void
Wlc_NtkFindOneNode
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pWlcObj
,
Gia_Man_t
*
pGia
,
Vec_Mem_t
*
vTtMem
)
{
int
k
,
Entry
;
int
nWords
=
Vec_MemEntrySize
(
vTtMem
);
int
nBits
=
Wlc_ObjRange
(
pWlcObj
);
int
iFirst
=
Vec_IntEntry
(
&
p
->
vCopies
,
Wlc_ObjId
(
p
,
pWlcObj
)
);
for
(
k
=
0
;
k
<
nBits
;
k
++
)
{
int
iLit
=
Vec_IntEntry
(
&
p
->
vBits
,
iFirst
+
k
);
word
*
pInfoObj
=
Wlc_ObjSim
(
pGia
,
Abc_Lit2Var
(
iLit
)
);
int
fCompl
=
pInfoObj
[
0
]
&
1
;
if
(
fCompl
)
Abc_TtNot
(
pInfoObj
,
nWords
);
Entry
=
*
Vec_MemHashLookup
(
vTtMem
,
pInfoObj
);
if
(
Entry
>
0
)
printf
(
"Obj %4d. Range = %2d. Bit %2d. Entry %d(%d). %s
\n
"
,
Wlc_ObjId
(
p
,
pWlcObj
),
Wlc_ObjRange
(
pWlcObj
),
k
,
Entry
,
fCompl
^
Abc_LitIsCompl
(
iLit
),
Wlc_ObjName
(
p
,
Wlc_ObjId
(
p
,
pWlcObj
))
);
if
(
fCompl
)
Abc_TtNot
(
pInfoObj
,
nWords
);
//printf( "%2d ", Entry );
//Extra_PrintHex( stdout, (unsigned*)pInfoObj, 8 );
//printf( "\n" );
}
//printf( "\n" );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Wlc_Ntk_t
*
Wlc_NtkGraftMulti
(
Wlc_Ntk_t
*
p
,
int
fVerbose
)
{
int
nWords
=
4
;
int
i
,
nMultiLHS
,
nMultiRHS
;
word
*
pInfoObj
;
Wlc_Ntk_t
*
pNew
=
NULL
;
Wlc_Obj_t
*
pWlcObj
;
Gia_Obj_t
*
pObj
;
Vec_Int_t
*
vObjsLHS
=
Wlc_NtkCollectObjs
(
p
,
0
,
&
nMultiLHS
);
Vec_Int_t
*
vObjsRHS
=
Wlc_NtkCollectObjs
(
p
,
1
,
&
nMultiRHS
);
Gia_Man_t
*
pGia
=
Wlc_NtkBitBlast
(
p
,
NULL
,
-
1
,
0
,
0
,
0
,
0
,
1
);
Vec_Mem_t
*
vTtMem
=
Vec_MemAlloc
(
nWords
,
10
);
Vec_MemHashAlloc
(
vTtMem
,
10000
);
// check if there are multipliers
if
(
nMultiLHS
==
0
&&
nMultiRHS
==
0
)
{
printf
(
"No multipliers are present.
\n
"
);
return
NULL
;
}
// compare multipliers
if
(
nMultiLHS
>
0
&&
nMultiRHS
>
0
)
{
printf
(
"Multipliers are present in both sides of the miter.
\n
"
);
return
NULL
;
}
// swap if wrong side
if
(
nMultiRHS
>
0
)
{
ABC_SWAP
(
Vec_Int_t
*
,
vObjsLHS
,
vObjsRHS
);
ABC_SWAP
(
int
,
nMultiLHS
,
nMultiRHS
);
}
assert
(
nMultiLHS
>
0
);
assert
(
nMultiRHS
==
0
);
// allocate simulation info for one timeframe
Vec_WrdFreeP
(
&
pGia
->
vSims
);
pGia
->
vSims
=
Vec_WrdStart
(
Gia_ManObjNum
(
pGia
)
*
nWords
);
pGia
->
nSimWords
=
nWords
;
// perform simulation
Gia_ManRandomW
(
1
);
Gia_ManForEachObj1
(
pGia
,
pObj
,
i
)
{
if
(
Gia_ObjIsAnd
(
pObj
)
)
Wlc_ObjSimAnd
(
pGia
,
i
);
else
if
(
Gia_ObjIsCo
(
pObj
)
)
Wlc_ObjSimCo
(
pGia
,
i
);
else
if
(
Gia_ObjIsCi
(
pObj
)
)
Wlc_ObjSimPi
(
pGia
,
i
);
else
assert
(
0
);
}
// hash constant 0
pInfoObj
=
Wlc_ObjSim
(
pGia
,
0
);
Vec_MemHashInsert
(
vTtMem
,
pInfoObj
);
// hash sim info on the multiplier boundary
Wlc_NtkForEachObjVec
(
vObjsLHS
,
p
,
pWlcObj
,
i
)
if
(
Wlc_ObjType
(
pWlcObj
)
==
WLC_OBJ_ARI_MULTI
)
{
Wlc_NtkSaveOneNode
(
p
,
Wlc_ObjFanin0
(
p
,
pWlcObj
),
pGia
,
vTtMem
);
Wlc_NtkSaveOneNode
(
p
,
Wlc_ObjFanin1
(
p
,
pWlcObj
),
pGia
,
vTtMem
);
Wlc_NtkSaveOneNode
(
p
,
pWlcObj
,
pGia
,
vTtMem
);
}
// check if there are similar signals in LHS
Wlc_NtkForEachObjVec
(
vObjsRHS
,
p
,
pWlcObj
,
i
)
Wlc_NtkFindOneNode
(
p
,
pWlcObj
,
pGia
,
vTtMem
);
// perform grafting
Vec_MemHashFree
(
vTtMem
);
Vec_MemFreeP
(
&
vTtMem
);
// cleanup
Vec_WrdFreeP
(
&
pGia
->
vSims
);
pGia
->
nSimWords
=
0
;
Vec_IntFree
(
vObjsLHS
);
Vec_IntFree
(
vObjsRHS
);
Gia_ManStop
(
pGia
);
return
pNew
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
src/base/wlc/wlcReadVer.c
View file @
3974ff75
...
...
@@ -1292,7 +1292,7 @@ void Io_ReadWordTest( char * pFileName )
return
;
Wlc_WriteVer
(
pNtk
,
"test.v"
,
0
,
0
);
pNew
=
Wlc_NtkBitBlast
(
pNtk
,
NULL
,
-
1
,
0
,
0
,
0
,
0
);
pNew
=
Wlc_NtkBitBlast
(
pNtk
,
NULL
,
-
1
,
0
,
0
,
0
,
0
,
0
);
Gia_AigerWrite
(
pNew
,
"test.aig"
,
0
,
0
);
Gia_ManStop
(
pNew
);
...
...
src/base/wlc/wlcSim.c
View file @
3974ff75
...
...
@@ -129,7 +129,7 @@ Vec_Ptr_t * Wlc_NtkSimulate( Wlc_Ntk_t * p, Vec_Int_t * vNodes, int nWords, int
{
Gia_Obj_t
*
pObj
;
Vec_Ptr_t
*
vOne
,
*
vRes
;
Gia_Man_t
*
pGia
=
Wlc_NtkBitBlast
(
p
,
NULL
,
-
1
,
0
,
0
,
0
,
0
);
Gia_Man_t
*
pGia
=
Wlc_NtkBitBlast
(
p
,
NULL
,
-
1
,
0
,
0
,
0
,
0
,
0
);
Wlc_Obj_t
*
pWlcObj
;
int
f
,
i
,
k
,
w
,
nBits
,
Counter
=
0
;
// allocate simulation info for one timeframe
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment