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
cc6c8b2f
Commit
cc6c8b2f
authored
Mar 09, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with stuck-at fault testing.
parent
e5d55213
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
128 additions
and
20 deletions
+128
-20
src/base/abci/abc.c
+15
-7
src/map/if/ifTune.c
+62
-6
src/sat/bmc/bmcFault.c
+51
-7
No files found.
src/base/abci/abc.c
View file @
cc6c8b2f
...
...
@@ -32620,10 +32620,10 @@ usage:
***********************************************************************/
int
Abc_CommandAbc9FunFaTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Gia_ManFaultTest
(
Gia_Man_t
*
p
,
int
nTimeOut
,
int
fDump
,
int
fVerbose
);
int
c
,
nTimeOut
=
0
,
fDump
=
0
,
fVerbose
=
0
;
extern
void
Gia_ManFaultTest
(
Gia_Man_t
*
p
,
int
fStuckAt
,
int
fComplVars
,
int
nTimeOut
,
int
fDump
,
int
fVerbose
);
int
c
,
fStuckAt
=
0
,
fComplVars
=
0
,
nTimeOut
=
0
,
fDump
=
0
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Tdvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"T
sc
dvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -32638,6 +32638,12 @@ int Abc_CommandAbc9FunFaTest( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
nTimeOut
<
0
)
goto
usage
;
break
;
case
's'
:
fStuckAt
^=
1
;
break
;
case
'c'
:
fComplVars
^=
1
;
break
;
case
'd'
:
fDump
^=
1
;
break
;
...
...
@@ -32660,15 +32666,17 @@ int Abc_CommandAbc9FunFaTest( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9FunFaTest(): AIG is combinational.
\n
"
);
return
0
;
}
Gia_ManFaultTest
(
pAbc
->
pGia
,
nTimeOut
,
fDump
,
fVerbose
);
Gia_ManFaultTest
(
pAbc
->
pGia
,
fStuckAt
,
fComplVars
,
nTimeOut
,
fDump
,
fVerbose
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &funfatest [-T num] [-dvh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &funfatest [-T num] [-
sc
dvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs functional fault test generation
\n
"
);
Abc_Print
(
-
2
,
"
\t
-T num : approximate global runtime limit in seconds [default = %d]
\n
"
,
nTimeOut
);
Abc_Print
(
-
2
,
"
\t
-d : toggles dumping test patterns into file
\"
tests.txt
\"
[default = %s]
\n
"
,
fDump
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggles printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-s : toggles generating tests for stuck-at faults [default = %s]
\n
"
,
fStuckAt
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-c : toggles complementing control variables [default = %s]
\n
"
,
fComplVars
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-d : toggles dumping test patterns into file
\"
tests.txt
\"
[default = %s]
\n
"
,
fDump
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggles printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
src/map/if/ifTune.c
View file @
cc6c8b2f
...
...
@@ -27,6 +27,17 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
// network types
typedef
enum
{
IF_DSD_NONE
=
0
,
// 0: unknown
IF_DSD_CONST0
,
// 1: constant
IF_DSD_VAR
,
// 2: variable
IF_DSD_AND
,
// 3: AND
IF_DSD_XOR
,
// 4: XOR
IF_DSD_MUX
,
// 5: MUX
IF_DSD_PRIME
// 6: PRIME
}
If_DsdType_t
;
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -42,9 +53,9 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
int
If_ManStrCheck
(
char
*
pStr
)
int
If_ManStrCheck
(
char
*
pStr
,
int
*
pnVars
,
int
*
pnObjs
)
{
int
i
,
Marks
[
32
]
=
{
0
},
MaxVar
=
0
,
MaxDef
=
0
;
int
i
,
Marks
[
32
]
=
{
0
},
MaxVar
=
0
,
MaxDef
=
0
,
RetValue
=
1
;
for
(
i
=
0
;
pStr
[
i
];
i
++
)
{
if
(
pStr
[
i
]
==
'='
||
pStr
[
i
]
==
';'
||
...
...
@@ -62,16 +73,54 @@ int If_ManStrCheck( char * pStr )
continue
;
}
printf
(
"String
\"
%s
\"
contains unrecognized symbol (%c).
\n
"
,
pStr
,
pStr
[
i
]
);
RetValue
=
0
;
}
for
(
i
=
0
;
i
<
MaxDef
;
i
++
)
if
(
Marks
[
i
]
==
0
)
printf
(
"String
\"
%s
\"
has no symbol (%c).
\n
"
,
pStr
,
'a'
+
Marks
[
i
]
);
printf
(
"String
\"
%s
\"
has no symbol (%c).
\n
"
,
pStr
,
'a'
+
Marks
[
i
]
)
,
RetValue
=
0
;
for
(
i
=
0
;
i
<
MaxVar
;
i
++
)
if
(
Marks
[
i
]
==
2
)
printf
(
"String
\"
%s
\"
defined input symbol (%c).
\n
"
,
pStr
,
'a'
+
Marks
[
i
]
)
;
printf
(
"String
\"
%s
\"
has definition of input variable (%c).
\n
"
,
pStr
,
'a'
+
Marks
[
i
]
),
RetValue
=
0
;
for
(
i
=
MaxVar
;
i
<
MaxDef
;
i
++
)
if
(
Marks
[
i
]
==
1
)
printf
(
"String
\"
%s
\"
has no definition for symbol (%c).
\n
"
,
pStr
,
'a'
+
Marks
[
i
]
);
printf
(
"String
\"
%s
\"
has no definition for internal variable (%c).
\n
"
,
pStr
,
'a'
+
Marks
[
i
]
),
RetValue
=
0
;
*
pnVars
=
RetValue
?
MaxVar
:
0
;
*
pnObjs
=
RetValue
?
MaxDef
:
0
;
return
RetValue
;
}
int
If_ManStrParse
(
char
*
pStr
,
int
nVars
,
int
nObjs
,
int
*
pTypes
,
int
*
pnFans
,
int
ppFans
[][
6
]
)
{
int
i
,
k
,
n
,
f
;
char
Next
=
0
;
assert
(
nVars
<
nObjs
);
for
(
i
=
nVars
;
i
<
nObjs
;
i
++
)
{
for
(
k
=
0
;
pStr
[
k
];
k
++
)
if
(
pStr
[
k
]
==
'a'
+
i
&&
pStr
[
k
+
1
]
==
'='
)
break
;
assert
(
pStr
[
k
]
);
if
(
pStr
[
k
+
2
]
==
'('
)
pTypes
[
i
]
=
IF_DSD_AND
,
Next
=
')'
;
else
if
(
pStr
[
k
+
2
]
==
'['
)
pTypes
[
i
]
=
IF_DSD_XOR
,
Next
=
']'
;
else
if
(
pStr
[
k
+
2
]
==
'<'
)
pTypes
[
i
]
=
IF_DSD_MUX
,
Next
=
'>'
;
else
if
(
pStr
[
k
+
2
]
==
'{'
)
pTypes
[
i
]
=
IF_DSD_PRIME
,
Next
=
'}'
;
else
assert
(
0
);
for
(
n
=
k
+
3
;
pStr
[
n
];
n
++
)
if
(
pStr
[
n
]
==
Next
)
break
;
assert
(
pStr
[
k
]
);
pnFans
[
i
]
=
n
-
k
-
3
;
assert
(
pnFans
[
i
]
>
0
&&
pnFans
[
i
]
<=
6
);
for
(
f
=
0
;
f
<
pnFans
[
i
];
f
++
)
{
ppFans
[
i
][
f
]
=
pStr
[
k
+
3
+
f
]
-
'a'
;
if
(
ppFans
[
i
][
f
]
<
0
||
ppFans
[
i
][
f
]
>=
nObjs
)
printf
(
"Error!
\n
"
);
}
}
return
1
;
}
...
...
@@ -88,8 +137,15 @@ int If_ManStrCheck( char * pStr )
***********************************************************************/
sat_solver
*
If_ManSatBuild
(
char
*
pStr
)
{
int
nVars
,
nObjs
;
int
pTypes
[
32
]
=
{
0
};
int
pnFans
[
32
]
=
{
0
};
int
ppFans
[
32
][
6
]
=
{{
0
}};
sat_solver
*
pSat
=
NULL
;
if
(
!
If_ManStrCheck
(
pStr
,
&
nVars
,
&
nObjs
)
)
return
NULL
;
if
(
!
If_ManStrParse
(
pStr
,
nVars
,
nObjs
,
pTypes
,
pnFans
,
ppFans
)
)
return
NULL
;
return
pSat
;
}
...
...
src/sat/bmc/bmcFault.c
View file @
cc6c8b2f
...
...
@@ -88,7 +88,7 @@ static inline void Cnf_DataLiftGia( Cnf_Dat_t * p, Gia_Man_t * pGia, int nVarsPl
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManFaultUnfold
(
Gia_Man_t
*
p
,
int
fUseMuxes
)
Gia_Man_t
*
Gia_ManFaultUnfold
(
Gia_Man_t
*
p
,
int
fUseMuxes
,
int
fComplVars
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
;
...
...
@@ -113,7 +113,7 @@ Gia_Man_t * Gia_ManFaultUnfold( Gia_Man_t * p, int fUseMuxes )
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
{
iCtrl
=
Gia_ManAppendCi
(
pNew
);
iCtrl
=
Abc_LitNotCond
(
Gia_ManAppendCi
(
pNew
),
fComplVars
);
iThis
=
Gia_ManHashAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
if
(
fUseMuxes
)
pObj
->
Value
=
Gia_ManHashMux
(
pNew
,
iCtrl
,
iThis
,
pObj
->
Value
);
...
...
@@ -139,6 +139,47 @@ Gia_Man_t * Gia_ManFaultUnfold( Gia_Man_t * p, int fUseMuxes )
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManStuckAtUnfold
(
Gia_Man_t
*
p
,
int
fUseFaults
,
int
fComplVars
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
;
int
i
,
iCtrl0
,
iCtrl1
;
pNew
=
Gia_ManStart
(
3
*
Gia_ManObjNum
(
p
)
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
Gia_ManHashAlloc
(
pNew
);
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachCi
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
{
pObj
->
Value
=
Gia_ManHashAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
iCtrl0
=
Abc_LitNotCond
(
Gia_ManAppendCi
(
pNew
),
fComplVars
);
iCtrl1
=
Abc_LitNotCond
(
Gia_ManAppendCi
(
pNew
),
fComplVars
);
if
(
fUseFaults
)
{
pObj
->
Value
=
Gia_ManHashAnd
(
pNew
,
iCtrl0
,
pObj
->
Value
);
pObj
->
Value
=
Gia_ManHashOr
(
pNew
,
Abc_LitNot
(
iCtrl1
),
pObj
->
Value
);
}
}
Gia_ManForEachCo
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
assert
(
Gia_ManPiNum
(
pNew
)
==
Gia_ManCiNum
(
p
)
+
2
*
Gia_ManAndNum
(
p
)
);
return
pNew
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManFaultCofactor
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vValues
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
...
...
@@ -229,18 +270,19 @@ void Gia_ManPrintResults( Gia_Man_t * p, sat_solver * pSat, int nIter, abctime c
SeeAlso []
***********************************************************************/
void
Gia_ManFaultTest
(
Gia_Man_t
*
p
,
int
nTimeOut
,
int
fDump
,
int
fVerbose
)
void
Gia_ManFaultTest
(
Gia_Man_t
*
p
,
int
fStuckAt
,
int
fComplVars
,
int
nTimeOut
,
int
fDump
,
int
fVerbose
)
{
int
nIterMax
=
1000000
;
int
i
,
Iter
,
status
;
abctime
clkTotal
=
Abc_Clock
();
abctime
clkSat
=
0
;
int
nFuncVars
=
fStuckAt
?
Gia_ManCiNum
(
p
)
:
Gia_ManRegNum
(
p
)
+
2
*
Gia_ManPiNum
(
p
);
Vec_Int_t
*
vLits
,
*
vTests
;
sat_solver
*
pSat
;
Gia_Obj_t
*
pObj
;
Gia_Man_t
*
pC
;
Gia_Man_t
*
p0
=
Gia_ManFaultUnfold
(
p
,
0
);
Gia_Man_t
*
p1
=
Gia_ManFaultUnfold
(
p
,
1
);
Gia_Man_t
*
p0
=
fStuckAt
?
Gia_ManStuckAtUnfold
(
p
,
0
,
fComplVars
)
:
Gia_ManFaultUnfold
(
p
,
0
,
fComplVars
);
Gia_Man_t
*
p1
=
fStuckAt
?
Gia_ManStuckAtUnfold
(
p
,
1
,
fComplVars
)
:
Gia_ManFaultUnfold
(
p
,
1
,
fComplVars
);
Gia_Man_t
*
pM
=
Gia_ManMiter
(
p0
,
p1
,
0
,
0
,
0
,
0
,
0
);
Cnf_Dat_t
*
pCnf
=
Cnf_DeriveGiaRemapped
(
pM
),
*
pCnf2
;
Gia_ManStop
(
p0
);
...
...
@@ -296,7 +338,7 @@ void Gia_ManFaultTest( Gia_Man_t * p, int nTimeOut, int fDump, int fVerbose )
// collect SAT assignment
Vec_IntClear
(
vLits
);
Gia_ManForEachPi
(
pM
,
pObj
,
i
)
if
(
i
<
Gia_ManRegNum
(
p
)
+
2
*
Gia_ManPiNum
(
p
)
)
if
(
i
<
nFuncVars
)
Vec_IntPush
(
vLits
,
sat_solver_var_value
(
pSat
,
pCnf
->
pVarNums
[
Gia_ObjId
(
pM
,
pObj
)])
);
Vec_IntAppend
(
vTests
,
vLits
);
// derive the cofactor
...
...
@@ -317,7 +359,7 @@ void Gia_ManFaultTest( Gia_Man_t * p, int nTimeOut, int fDump, int fVerbose )
}
// add connection clauses
Gia_ManForEachPi
(
pM
,
pObj
,
i
)
if
(
i
>=
Gia_ManRegNum
(
p
)
+
2
*
Gia_ManPiNum
(
p
)
)
if
(
i
>=
nFuncVars
)
sat_solver_add_buffer
(
pSat
,
pCnf
->
pVarNums
[
Gia_ObjId
(
pM
,
pObj
)],
pCnf2
->
pVarNums
[
Gia_ObjId
(
pC
,
Gia_ManPi
(
pC
,
i
))],
0
);
Cnf_DataFree
(
pCnf2
);
Gia_ManStop
(
pC
);
...
...
@@ -337,6 +379,8 @@ void Gia_ManFaultTest( Gia_Man_t * p, int nTimeOut, int fDump, int fVerbose )
Vec_IntFree
(
vTests
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
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