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
d4ce4cc9
Commit
d4ce4cc9
authored
Jan 21, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undoing some recent changes for improved CEX writing.
parent
f421d2a1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
170 deletions
+11
-170
src/base/io/io.c
+8
-65
src/base/main/main.h
+0
-2
src/base/main/mainFrame.c
+0
-4
src/base/main/mainInt.h
+0
-1
src/base/wlc/wlcBlast.c
+3
-30
src/base/wlc/wlcCom.c
+0
-68
No files found.
src/base/io/io.c
View file @
d4ce4cc9
...
...
@@ -2292,35 +2292,6 @@ ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
IoCommandPrintLatchName
(
FILE
*
pFile
,
Abc_Ntk_t
*
pNtk
,
Abc_Obj_t
*
pObj
,
char
*
pObjName
,
Abc_Cex_t
*
pCex
,
Abc_Cex_t
*
pCare
)
{
int
ii
,
NameLen
=
strlen
(
pObjName
);
// check if there is a PI with a matching name
Abc_Obj_t
*
pObjPi
;
Abc_NtkForEachPi
(
pNtk
,
pObjPi
,
ii
)
if
(
!
strncmp
(
Abc_ObjName
(
pObjPi
),
pObjName
,
NameLen
)
&&
!
strncmp
(
Abc_ObjName
(
pObjPi
)
+
NameLen
,
"_init"
,
5
)
)
{
if
(
!
pCare
||
Abc_InfoHasBit
(
pCare
->
pData
,
pCare
->
nRegs
+
ii
)
)
fprintf
(
pFile
,
"%s@%d=%c
\n
"
,
pObjName
,
0
,
'0'
+
Abc_InfoHasBit
(
pCex
->
pData
,
pCare
->
nRegs
+
ii
)
);
break
;
}
if
(
ii
!=
Abc_NtkPiNum
(
pNtk
)
)
return
;
if
(
!
strncmp
(
pObjName
,
"abc_reset_flop"
,
14
)
)
return
;
fprintf
(
pFile
,
"%s@0=%c
\n
"
,
pObjName
,
'0'
+
(
pObj
?
!
Abc_LatchIsInit0
(
pObj
)
:
0
)
);
}
/**Function*************************************************************
...
...
@@ -2336,7 +2307,6 @@ void IoCommandPrintLatchName( FILE * pFile, Abc_Ntk_t * pNtk, Abc_Obj_t * pObj,
int
IoCommandWriteCex
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Abc_Ntk_t
*
pNtk
;
Vec_Ptr_t
*
vNamesIn
=
NULL
;
char
*
pFileName
;
int
c
,
fNames
=
0
;
int
fMinimize
=
0
;
...
...
@@ -2447,7 +2417,6 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
else
if
(
fNames
)
{
Abc_Cex_t
*
pCare
=
NULL
;
char
*
pObjName
=
NULL
;
if
(
fMinimize
)
{
extern
Aig_Man_t
*
Abc_NtkToDar
(
Abc_Ntk_t
*
pNtk
,
int
fExors
,
int
fRegisters
);
...
...
@@ -2475,40 +2444,14 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
}
fprintf
(
pFile
,
"
\n
"
);
fprintf
(
pFile
,
"# COUNTEREXAMPLE LENGTH: %u
\n
"
,
pCex
->
iFrame
+
1
);
if
(
(
vNamesIn
=
Abc_FrameReadCexCiNames
(
pAbc
))
!=
NULL
)
{
// output flop values (unaffected by the minimization)
Vec_PtrForEachEntryStart
(
char
*
,
vNamesIn
,
pObjName
,
i
,
Abc_NtkPiNum
(
pNtk
)
)
IoCommandPrintLatchName
(
pFile
,
pNtk
,
NULL
,
pObjName
,
pCex
,
pCare
);
// output PI values (while skipping the minimized ones)
for
(
f
=
0
;
f
<=
pCex
->
iFrame
;
f
++
)
Vec_PtrForEachEntryStop
(
char
*
,
vNamesIn
,
pObjName
,
i
,
Abc_NtkPiNum
(
pNtk
)
)
{
// skip names with "_init" in the end
int
NameLen
=
strlen
(
pObjName
);
if
(
NameLen
>
5
&&
!
strncmp
(
pObjName
+
NameLen
-
5
,
"_init"
,
5
)
)
continue
;
if
(
!
pCare
||
Abc_InfoHasBit
(
pCare
->
pData
,
pCare
->
nRegs
+
pCare
->
nPis
*
f
+
i
)
)
fprintf
(
pFile
,
"%s@%d=%c
\n
"
,
pObjName
,
f
,
'0'
+
Abc_InfoHasBit
(
pCex
->
pData
,
pCex
->
nRegs
+
pCex
->
nPis
*
f
+
i
)
);
}
}
else
{
// output flop values (unaffected by the minimization)
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
IoCommandPrintLatchName
(
pFile
,
pNtk
,
pObj
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
)),
pCex
,
pCare
);
// output PI values (while skipping the minimized ones)
for
(
f
=
0
;
f
<=
pCex
->
iFrame
;
f
++
)
Abc_NtkForEachPi
(
pNtk
,
pObj
,
i
)
{
// skip names with "_init" in the end
int
NameLen
=
strlen
(
Abc_ObjName
(
pObj
));
if
(
NameLen
>
5
&&
!
strncmp
(
Abc_ObjName
(
pObj
)
+
NameLen
-
5
,
"_init"
,
5
)
)
continue
;
if
(
!
pCare
||
Abc_InfoHasBit
(
pCare
->
pData
,
pCare
->
nRegs
+
pCare
->
nPis
*
f
+
i
)
)
fprintf
(
pFile
,
"%s@%d=%c
\n
"
,
Abc_ObjName
(
pObj
),
f
,
'0'
+
Abc_InfoHasBit
(
pCex
->
pData
,
pCex
->
nRegs
+
pCex
->
nPis
*
f
+
i
)
);
}
}
// output flop values (unaffected by the minimization)
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
fprintf
(
pFile
,
"%s@0=%c
\n
"
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
)),
'0'
+!
Abc_LatchIsInit0
(
pObj
)
);
// output PI values (while skipping the minimized ones)
for
(
f
=
0
;
f
<=
pCex
->
iFrame
;
f
++
)
Abc_NtkForEachPi
(
pNtk
,
pObj
,
i
)
if
(
!
pCare
||
Abc_InfoHasBit
(
pCare
->
pData
,
pCare
->
nRegs
+
pCare
->
nPis
*
f
+
i
)
)
fprintf
(
pFile
,
"%s@%d=%c
\n
"
,
Abc_ObjName
(
pObj
),
f
,
'0'
+
Abc_InfoHasBit
(
pCex
->
pData
,
pCex
->
nRegs
+
pCex
->
nPis
*
f
+
i
)
);
Abc_CexFreeP
(
&
pCare
);
}
else
...
...
src/base/main/main.h
View file @
d4ce4cc9
...
...
@@ -127,8 +127,6 @@ extern ABC_DLL int Abc_FrameReadCexPiNum( Abc_Frame_t * p );
extern
ABC_DLL
int
Abc_FrameReadCexRegNum
(
Abc_Frame_t
*
p
);
extern
ABC_DLL
int
Abc_FrameReadCexPo
(
Abc_Frame_t
*
p
);
extern
ABC_DLL
int
Abc_FrameReadCexFrame
(
Abc_Frame_t
*
p
);
extern
ABC_DLL
Vec_Ptr_t
*
Abc_FrameReadCexCiNames
(
Abc_Frame_t
*
p
);
extern
ABC_DLL
void
Abc_FrameSetCexCiNames
(
Vec_Ptr_t
*
vNames
);
extern
ABC_DLL
void
Abc_FrameSetNtkStore
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
void
Abc_FrameSetNtkStoreSize
(
int
nStored
);
...
...
src/base/main/mainFrame.c
View file @
d4ce4cc9
...
...
@@ -83,9 +83,6 @@ int Abc_FrameReadCexPiNum( Abc_Frame_t * p ) { return s_GlobalFr
int
Abc_FrameReadCexRegNum
(
Abc_Frame_t
*
p
)
{
return
s_GlobalFrame
->
pCex
->
nRegs
;
}
int
Abc_FrameReadCexPo
(
Abc_Frame_t
*
p
)
{
return
s_GlobalFrame
->
pCex
->
iPo
;
}
int
Abc_FrameReadCexFrame
(
Abc_Frame_t
*
p
)
{
return
s_GlobalFrame
->
pCex
->
iFrame
;
}
Vec_Ptr_t
*
Abc_FrameReadCexCiNames
(
Abc_Frame_t
*
p
)
{
return
s_GlobalFrame
->
vCiNamesStore
;
}
void
Abc_FrameSetCexCiNames
(
Vec_Ptr_t
*
vNames
)
{
if
(
s_GlobalFrame
->
vCiNamesStore
)
Vec_PtrFreeFree
(
s_GlobalFrame
->
vCiNamesStore
);
s_GlobalFrame
->
vCiNamesStore
=
vNames
;
}
void
Abc_FrameInputNdr
(
Abc_Frame_t
*
pAbc
,
void
*
pData
)
{
Ndr_Delete
(
s_GlobalFrame
->
pNdr
);
s_GlobalFrame
->
pNdr
=
pData
;
}
void
*
Abc_FrameOutputNdr
(
Abc_Frame_t
*
pAbc
)
{
void
*
pData
=
s_GlobalFrame
->
pNdr
;
s_GlobalFrame
->
pNdr
=
NULL
;
return
pData
;
}
...
...
@@ -243,7 +240,6 @@ void Abc_FrameDeallocate( Abc_Frame_t * p )
Vec_WecFreeP
(
&
s_GlobalFrame
->
vJsonObjs
);
Ndr_Delete
(
s_GlobalFrame
->
pNdr
);
ABC_FREE
(
s_GlobalFrame
->
pNdrArray
);
Vec_PtrFreeFree
(
s_GlobalFrame
->
vCiNamesStore
);
Gia_ManStopP
(
&
p
->
pGiaMiniAig
);
Gia_ManStopP
(
&
p
->
pGiaMiniLut
);
...
...
src/base/main/mainInt.h
View file @
d4ce4cc9
...
...
@@ -152,7 +152,6 @@ struct Abc_Frame_t_
int
*
pBoxes
;
void
*
pNdr
;
int
*
pNdrArray
;
Vec_Ptr_t
*
vCiNamesStore
;
// storage for CI names
Abc_Frame_Callback_BmcFrameDone_Func
pFuncOnFrameDone
;
};
...
...
src/base/wlc/wlcBlast.c
View file @
d4ce4cc9
...
...
@@ -1150,8 +1150,6 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
int
i
,
k
,
b
,
iFanin
,
iLit
,
nAndPrev
,
*
pFans0
,
*
pFans1
,
*
pFans2
,
*
pFans3
;
int
nFFins
=
0
,
nFFouts
=
0
,
curPi
=
0
,
curPo
=
0
,
nFf2Regs
=
0
;
int
nBitCis
=
0
,
nBitCos
=
0
,
fAdded
=
0
;
int
iFirstAddPi
=
-
1
;
// remembers the first additional PI that stands for DC-flop output
int
iFirstFlop
=
-
1
;
// remembers the first flop of the design
Wlc_BstPar_t
Par
,
*
pPar
=
&
Par
;
Wlc_BstParDefault
(
pPar
);
pPar
=
pParIn
?
pParIn
:
pPar
;
...
...
@@ -2119,21 +2117,14 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
if
(
p
->
pInits
)
{
int
Length
=
strlen
(
p
->
pInits
);
// remember the place in the array where the first PI begins
iFirstAddPi
=
Vec_PtrSize
(
pNew
->
vNamesIn
);
for
(
i
=
0
;
i
<
Length
;
i
++
)
if
(
p
->
pInits
[
i
]
==
'x'
||
p
->
pInits
[
i
]
==
'X'
)
{
//char Buffer[100];
//sprintf( Buffer, "%s%d", "init", i );
//Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
// save NULL at this time - to be overwritten later
//printf( "Adding NULL in position %d\n", Vec_PtrSize(pNew->vNamesIn) );
Vec_PtrPush
(
pNew
->
vNamesIn
,
NULL
);
char
Buffer
[
100
];
sprintf
(
Buffer
,
"%s%d"
,
"init"
,
i
);
Vec_PtrPush
(
pNew
->
vNamesIn
,
Abc_UtilStrsav
(
Buffer
)
);
fAdded
=
1
;
}
// remember the place in the array where the first real flop is
iFirstFlop
=
Vec_PtrSize
(
pNew
->
vNamesIn
);
}
Wlc_NtkForEachCi
(
p
,
pObj
,
i
)
if
(
!
Wlc_ObjIsPi
(
pObj
)
)
...
...
@@ -2150,7 +2141,6 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
Vec_PtrPush
(
pNew
->
vNamesIn
,
Abc_UtilStrsav
(
Buffer
)
);
}
}
/*
Wlc_NtkForEachFf2
(
p
,
pObj
,
i
)
{
char
*
pName
=
Wlc_ObjName
(
p
,
Wlc_ObjId
(
p
,
pObj
));
...
...
@@ -2169,7 +2159,6 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
Vec_PtrPush
(
pNew
->
vNamesIn
,
Abc_UtilStrsav
(
Buffer
)
);
}
}
*/
Wlc_NtkForEachFf2
(
p
,
pObj
,
i
)
{
char
*
pName
=
Wlc_ObjName
(
p
,
Wlc_ObjId
(
p
,
pObj
));
...
...
@@ -2202,22 +2191,6 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
}
}
assert
(
Vec_PtrSize
(
pNew
->
vNamesIn
)
==
Gia_ManCiNum
(
pNew
)
);
// finish creating names of additional primary inputs
if
(
p
->
pInits
)
{
int
k
=
iFirstAddPi
,
Length
=
strlen
(
p
->
pInits
);
assert
(
iFirstAddPi
>=
0
&&
iFirstFlop
>=
0
);
for
(
i
=
0
;
i
<
Length
;
i
++
)
if
(
p
->
pInits
[
i
]
==
'x'
||
p
->
pInits
[
i
]
==
'X'
)
{
char
Buffer
[
1000
];
sprintf
(
Buffer
,
"%s_init"
,
(
char
*
)
Vec_PtrEntry
(
pNew
->
vNamesIn
,
iFirstFlop
+
i
)
);
assert
(
Vec_PtrEntry
(
pNew
->
vNamesIn
,
k
)
==
NULL
);
Vec_PtrWriteEntry
(
pNew
->
vNamesIn
,
k
++
,
Abc_UtilStrsav
(
Buffer
)
);
//printf( "Replacing NULL in position %d\n", iFirstAddPi-Length+i );
}
assert
(
k
==
iFirstFlop
);
}
// create output names
pNew
->
vNamesOut
=
Vec_PtrAlloc
(
Gia_ManCoNum
(
pNew
)
);
Wlc_NtkForEachFf2
(
p
,
pObj
,
i
)
...
...
src/base/wlc/wlcCom.c
View file @
d4ce4cc9
...
...
@@ -51,7 +51,6 @@ static int Abc_CommandInvCheck ( Abc_Frame_t * pAbc, int argc, char ** argv )
static
int
Abc_CommandInvGet
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandInvPut
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandInvMin
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCexFix
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
inline
Wlc_Ntk_t
*
Wlc_AbcGetNtk
(
Abc_Frame_t
*
pAbc
)
{
return
(
Wlc_Ntk_t
*
)
pAbc
->
pAbcWlc
;
}
...
...
@@ -100,7 +99,6 @@ void Wlc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"inv_get"
,
Abc_CommandInvGet
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"inv_put"
,
Abc_CommandInvPut
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"inv_min"
,
Abc_CommandInvMin
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"cexfix"
,
Abc_CommandCexFix
,
0
);
}
/**Function********************************************************************
...
...
@@ -1124,7 +1122,6 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
1
,
"Finished dumping file
\"
pio_name_map.txt
\"
containing PI/PO name mapping.
\n
"
);
}
}
Abc_FrameSetCexCiNames
(
Vec_PtrDupStr
(
pNew
->
vNamesIn
)
);
Abc_FrameUpdateGia
(
pAbc
,
pNew
);
return
0
;
usage:
...
...
@@ -1796,71 +1793,6 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandCexFix
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Wlc_Ntk_t
*
pNtk
=
NULL
;
Abc_Cex_t
*
pCexNew
;
char
*
pFileName
;
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:
Abc_Print
(
-
2
,
"Unknown switch.
\n
"
);
goto
usage
;
}
}
if
(
pAbc
->
pCex
==
NULL
)
{
fprintf
(
pAbc
->
Out
,
"Counter-example is not available.
\n
"
);
goto
usage
;
}
if
(
argc
!=
globalUtilOptind
+
1
)
{
fprintf
(
pAbc
->
Out
,
"File name with the original design is missing on the command line.
\n
"
);
goto
usage
;
}
pFileName
=
argv
[
globalUtilOptind
];
pNtk
=
Wlc_ReadVer
(
pFileName
,
NULL
);
if
(
pNtk
==
NULL
)
{
fprintf
(
pAbc
->
Out
,
"Cannot parse the incoming design in Verilog.
\n
"
);
goto
usage
;
}
pCexNew
=
Abc_CexTransformUndc
(
pAbc
->
pCex
,
pNtk
->
pInits
);
Wlc_NtkFree
(
pNtk
);
Abc_FrameReplaceCex
(
pAbc
,
&
pCexNew
);
printf
(
"Replaced the current CEX by a new one generated using the original design.
\n
"
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: cexfix [-vh] <file>
\n
"
);
Abc_Print
(
-
2
,
"
\t
updates CEX after to match the original design
\n
"
);
Abc_Print
(
-
2
,
"
\t
<file> : the file with the original 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
"
);
return
1
;
}
/**Function********************************************************************
Synopsis []
...
...
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