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
4394bc86
Commit
4394bc86
authored
Mar 20, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add special handling of script-level assertions.
parent
f0efc6e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
2 deletions
+98
-2
src/base/cmd/cmdApi.c
+98
-2
No files found.
src/base/cmd/cmdApi.c
View file @
4394bc86
...
@@ -96,6 +96,100 @@ void Cmd_CommandAdd( Abc_Frame_t * pAbc, const char * sGroup, const char * sName
...
@@ -96,6 +96,100 @@ void Cmd_CommandAdd( Abc_Frame_t * pAbc, const char * sGroup, const char * sName
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Cmd_CommandHandleSpecial
(
Abc_Frame_t
*
pAbc
,
const
char
*
sCommand
)
{
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
int
piCountNew
=
pNtk
?
Abc_NtkCiNum
(
pNtk
)
:
0
,
piCount
=
0
;
int
poCountNew
=
pNtk
?
Abc_NtkCoNum
(
pNtk
)
:
0
,
poCount
=
0
;
int
ndCountNew
=
pNtk
?
Abc_NtkNodeNum
(
pNtk
)
:
0
,
ndCount
=
0
;
double
AreaNew
=
pNtk
?
Abc_NtkGetMappedArea
(
pNtk
)
:
0
,
Area
=
0
;
int
DepthNew
=
pNtk
?
Abc_NtkLevel
(
pNtk
)
:
0
,
Depth
=
0
;
if
(
strstr
(
sCommand
,
"#PS"
)
)
{
printf
(
"pi=%d "
,
piCountNew
);
printf
(
"po=%d "
,
poCountNew
);
printf
(
"fn=%d "
,
ndCountNew
);
printf
(
"ma=%.1f "
,
AreaNew
);
printf
(
"de=%d "
,
DepthNew
);
printf
(
"
\n
"
);
return
1
;
}
if
(
strstr
(
sCommand
,
"#CEC"
)
)
{
//int proofStatus = Abc_NtkVerifyUsingCec(pNtk);
int
proofStatus
=
1
;
// -1 (undecided), 0 (different), 1 (equivalent)
printf
(
"proofStatus=%d
\n
"
,
proofStatus
);
return
1
;
}
if
(
strstr
(
sCommand
,
"#ASSERT"
)
)
{
int
Status
=
0
;
char
*
pNumb
=
strrchr
(
sCommand
,
'='
);
if
(
strstr
(
sCommand
,
"_PI_"
)
)
{
piCount
=
pNumb
?
atoi
(
pNumb
+
1
)
:
0
;
if
(
strstr
(
sCommand
,
"=="
)
)
Status
=
piCountNew
==
piCount
;
else
if
(
strstr
(
sCommand
,
"<="
)
)
Status
=
piCountNew
<=
piCount
;
else
return
0
;
}
else
if
(
strstr
(
sCommand
,
"_PO_"
)
)
{
poCount
=
pNumb
?
atoi
(
pNumb
+
1
)
:
0
;
if
(
strstr
(
sCommand
,
"=="
)
)
Status
=
poCountNew
==
poCount
;
else
if
(
strstr
(
sCommand
,
"<="
)
)
Status
=
poCountNew
<=
poCount
;
else
return
0
;
}
else
if
(
strstr
(
sCommand
,
"_NODE_"
)
)
{
ndCount
=
pNumb
?
atoi
(
pNumb
+
1
)
:
0
;
if
(
strstr
(
sCommand
,
"=="
)
)
Status
=
ndCountNew
==
ndCount
;
else
if
(
strstr
(
sCommand
,
"<="
)
)
Status
=
ndCountNew
<=
ndCount
;
else
return
0
;
}
else
if
(
strstr
(
sCommand
,
"_AREA_"
)
)
{
double
Eplison
=
1
.
0
;
Area
=
pNumb
?
atof
(
pNumb
+
1
)
:
0
;
if
(
strstr
(
sCommand
,
"=="
)
)
Status
=
AreaNew
>=
Area
-
Eplison
&&
AreaNew
<=
Area
+
Eplison
;
else
if
(
strstr
(
sCommand
,
"<="
)
)
Status
=
AreaNew
<=
Area
+
Eplison
;
else
return
0
;
}
else
if
(
strstr
(
sCommand
,
"_DEPTH_"
)
)
{
Depth
=
pNumb
?
atoi
(
pNumb
+
1
)
:
0
;
if
(
strstr
(
sCommand
,
"=="
)
)
Status
=
DepthNew
==
Depth
;
else
if
(
strstr
(
sCommand
,
"<="
)
)
Status
=
DepthNew
<=
Depth
;
else
return
0
;
}
else
return
0
;
printf
(
"%s
\n
"
,
Status
?
"succeeded"
:
"failed"
);
return
1
;
}
return
0
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Cmd_CommandExecute
(
Abc_Frame_t
*
pAbc
,
const
char
*
sCommand
)
int
Cmd_CommandExecute
(
Abc_Frame_t
*
pAbc
,
const
char
*
sCommand
)
{
{
int
fStatus
=
0
,
argc
,
loop
;
int
fStatus
=
0
,
argc
,
loop
;
...
@@ -107,12 +201,14 @@ int Cmd_CommandExecute( Abc_Frame_t * pAbc, const char * sCommand )
...
@@ -107,12 +201,14 @@ int Cmd_CommandExecute( Abc_Frame_t * pAbc, const char * sCommand )
sCommandNext
=
sCommand
;
sCommandNext
=
sCommand
;
do
do
{
{
sCommandNext
=
CmdSplitLine
(
pAbc
,
sCommandNext
,
&
argc
,
&
argv
);
if
(
sCommandNext
[
0
]
==
'#'
&&
Cmd_CommandHandleSpecial
(
pAbc
,
sCommandNext
)
)
break
;
sCommandNext
=
CmdSplitLine
(
pAbc
,
sCommandNext
,
&
argc
,
&
argv
);
loop
=
0
;
loop
=
0
;
fStatus
=
CmdApplyAlias
(
pAbc
,
&
argc
,
&
argv
,
&
loop
);
fStatus
=
CmdApplyAlias
(
pAbc
,
&
argc
,
&
argv
,
&
loop
);
if
(
fStatus
==
0
)
if
(
fStatus
==
0
)
fStatus
=
CmdCommandDispatch
(
pAbc
,
&
argc
,
&
argv
);
fStatus
=
CmdCommandDispatch
(
pAbc
,
&
argc
,
&
argv
);
CmdFreeArgv
(
argc
,
argv
);
CmdFreeArgv
(
argc
,
argv
);
}
}
while
(
fStatus
==
0
&&
*
sCommandNext
!=
'\0'
);
while
(
fStatus
==
0
&&
*
sCommandNext
!=
'\0'
);
return
fStatus
;
return
fStatus
;
...
...
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