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
07002bc9
Commit
07002bc9
authored
Jan 20, 2020
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with simulation patterns.
parent
0e05d148
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
228 additions
and
1 deletions
+228
-1
src/aig/gia/giaSim.c
+0
-0
src/base/abci/abc.c
+228
-1
No files found.
src/aig/gia/giaSim.c
View file @
07002bc9
This diff is collapsed.
Click to expand it.
src/base/abci/abc.c
View file @
07002bc9
...
...
@@ -411,6 +411,9 @@ static int Abc_CommandAbc9Trim ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandAbc9Dfs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Sim
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Sim3
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9ReadSim
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9WriteSim
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9SimPat
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Resim
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9SpecI
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Equiv
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -1120,6 +1123,9 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&dfs"
,
Abc_CommandAbc9Dfs
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&sim"
,
Abc_CommandAbc9Sim
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&sim3"
,
Abc_CommandAbc9Sim3
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&read_sim"
,
Abc_CommandAbc9ReadSim
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&write_sim"
,
Abc_CommandAbc9WriteSim
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&simpat"
,
Abc_CommandAbc9SimPat
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&resim"
,
Abc_CommandAbc9Resim
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&speci"
,
Abc_CommandAbc9SpecI
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&equiv"
,
Abc_CommandAbc9Equiv
,
0
);
...
...
@@ -22653,7 +22659,6 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
...
...
@@ -31307,6 +31312,7 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
...
...
@@ -32474,6 +32480,227 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9ReadSim
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
Vec_Wrd_t
*
Gia_ManSimPatGenRandom
(
int
nWords
);
extern
Vec_Wrd_t
*
Gia_ManSimPatRead
(
char
*
pFileName
);
int
c
,
nWords
=
4
,
fVerbose
=
0
;
char
**
pArgvNew
;
int
nArgcNew
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Wvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'W'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-W
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nWords
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nWords
<
0
)
goto
usage
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pAbc
->
pGia
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9ReadSim(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManRegNum
(
pAbc
->
pGia
)
>
0
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9ReadSim(): This command works only for combinational AIGs.
\n
"
);
return
0
;
}
Vec_WrdFreeP
(
&
pAbc
->
pGia
->
vSimsPi
);
pArgvNew
=
argv
+
globalUtilOptind
;
nArgcNew
=
argc
-
globalUtilOptind
;
if
(
nArgcNew
==
0
)
{
Gia_ManRandom
(
1
);
pAbc
->
pGia
->
vSimsPi
=
Gia_ManSimPatGenRandom
(
Gia_ManCiNum
(
pAbc
->
pGia
)
*
nWords
);
printf
(
"Generated %d random patterns (%d 64-bit words) for each input of the AIG.
\n
"
,
64
*
nWords
,
nWords
);
return
0
;
}
if
(
nArgcNew
!=
1
)
{
Abc_Print
(
-
1
,
"File name is not given on the command line.
\n
"
);
return
1
;
}
pAbc
->
pGia
->
vSimsPi
=
Gia_ManSimPatRead
(
pArgvNew
[
0
]
);
if
(
Vec_WrdSize
(
pAbc
->
pGia
->
vSimsPi
)
%
Gia_ManCiNum
(
pAbc
->
pGia
)
!=
0
)
{
Vec_WrdFreeP
(
&
pAbc
->
pGia
->
vSimsPi
);
Abc_Print
(
-
1
,
"File size (%d words) does not match the number of AIG inputs (%d %% %d = %d).
\n
"
,
Vec_WrdSize
(
pAbc
->
pGia
->
vSimsPi
),
Vec_WrdSize
(
pAbc
->
pGia
->
vSimsPi
),
Gia_ManCiNum
(
pAbc
->
pGia
),
Vec_WrdSize
(
pAbc
->
pGia
->
vSimsPi
)
%
Gia_ManCiNum
(
pAbc
->
pGia
)
);
return
1
;
}
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &read_sim [-W num] [-vh] <file>
\n
"
);
Abc_Print
(
-
2
,
"
\t
reads simulation patterns from file
\n
"
);
Abc_Print
(
-
2
,
"
\t
-W num : the number of frames to simulate [default = %d]
\n
"
,
nWords
);
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
"
);
Abc_Print
(
-
2
,
"
\t
<file> : file to store the simulation info
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9WriteSim
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Gia_ManSimPatWrite
(
char
*
pFileName
,
Vec_Wrd_t
*
vSimsIn
,
int
nWords
);
int
c
,
fVerbose
=
0
;
char
**
pArgvNew
;
int
nArgcNew
;
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
(
pAbc
->
pGia
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9WriteSim(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManRegNum
(
pAbc
->
pGia
)
>
0
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9WriteSim(): This command works only for combinational AIGs.
\n
"
);
return
0
;
}
if
(
pAbc
->
pGia
->
vSimsPi
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9WriteSim(): Does not have simulation information available.
\n
"
);
return
0
;
}
pArgvNew
=
argv
+
globalUtilOptind
;
nArgcNew
=
argc
-
globalUtilOptind
;
if
(
nArgcNew
!=
1
)
{
Abc_Print
(
-
1
,
"File name is not given on the command line.
\n
"
);
return
1
;
}
assert
(
Vec_WrdSize
(
pAbc
->
pGia
->
vSimsPi
)
%
Gia_ManCiNum
(
pAbc
->
pGia
)
==
0
);
Gia_ManSimPatWrite
(
pArgvNew
[
0
],
pAbc
->
pGia
->
vSimsPi
,
Vec_WrdSize
(
pAbc
->
pGia
->
vSimsPi
)
/
Gia_ManCiNum
(
pAbc
->
pGia
)
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &write_sim [-vh] <file>
\n
"
);
Abc_Print
(
-
2
,
"
\t
writes simulation patterns into a file
\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
"
);
Abc_Print
(
-
2
,
"
\t
<file> : file to store the simulation info
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9SimPat
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Gia_ManSimPat
(
Gia_Man_t
*
pGia
,
int
nWords
,
int
fVerbose
);
int
c
,
nWords
=
4
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Wvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'W'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-W
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nWords
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nWords
<
0
)
goto
usage
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pAbc
->
pGia
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9SimPat(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManRegNum
(
pAbc
->
pGia
)
>
0
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9SimPat(): This command works only for combinational AIGs.
\n
"
);
return
0
;
}
if
(
pAbc
->
pGia
->
vSimsPi
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9WriteSim(): Does not have simulation information available.
\n
"
);
return
0
;
}
Gia_ManSimPat
(
pAbc
->
pGia
,
nWords
,
fVerbose
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &simpat [-W num] [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs simulation of the AIG
\n
"
);
Abc_Print
(
-
2
,
"
\t
-W num : the number of frames to simulate [default = %d]
\n
"
,
nWords
);
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*************************************************************
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