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
34ab5957
Commit
34ab5957
authored
Dec 03, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suggested patch of AIG writers.
parent
a3bc77cd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
31 deletions
+113
-31
src/aig/ioa/ioaWriteAig.c
+9
-3
src/base/io/ioWriteAiger.c
+104
-28
No files found.
src/aig/ioa/ioaWriteAig.c
View file @
34ab5957
...
@@ -564,14 +564,20 @@ void Ioa_WriteAiger( Aig_Man_t * pMan, char * pFileName, int fWriteSymbols, int
...
@@ -564,14 +564,20 @@ void Ioa_WriteAiger( Aig_Man_t * pMan, char * pFileName, int fWriteSymbols, int
if ( fWriteSymbols )
if ( fWriteSymbols )
{
{
// write PIs
// write PIs
Aig_ManForEach
Ci
( pMan, pObj, i )
Aig_ManForEach
PiSeq
( pMan, pObj, i )
fprintf( pFile, "i%d %s\n", i, Aig_ObjName(pObj) );
fprintf( pFile, "i%d %s\n", i, Aig_ObjName(pObj) );
// write latches
// write latches
Aig_ManForEachL
atch
( pMan, pObj, i )
Aig_ManForEachL
oSeq
( pMan, pObj, i )
fprintf( pFile, "l%d %s\n", i, Aig_ObjName(Aig_ObjFanout0(pObj)) );
fprintf( pFile, "l%d %s\n", i, Aig_ObjName(Aig_ObjFanout0(pObj)) );
// write POs
// write POs
Aig_ManForEachCo( pMan, pObj, i )
int bads = Aig_ManCoNum(pMan) - Aig_ManRegNum(pMan) - Aig_ManConstrNum(pMan);
Aig_ManForEachPoSeq( pMan, pObj, i )
if ( !Aig_ManConstrNum(pMan) )
fprintf( pFile, "o%d %s\n", i, Aig_ObjName(pObj) );
fprintf( pFile, "o%d %s\n", i, Aig_ObjName(pObj) );
else ( i < bads )
fprintf( pFile, "b%d %s\n", i, Aig_ObjName(pObj) );
else
fprintf( pFile, "c%d %s\n", i - bads, Aig_ObjName(pObj) );
}
}
*/
*/
// write the comment
// write the comment
...
...
src/base/io/ioWriteAiger.c
View file @
34ab5957
...
@@ -270,15 +270,22 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
...
@@ -270,15 +270,22 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
{
{
ProgressBar
*
pProgress
;
ProgressBar
*
pProgress
;
FILE
*
pFile
;
FILE
*
pFile
;
Abc_Obj_t
*
pObj
,
*
pDriver
;
Abc_Obj_t
*
pObj
,
*
pDriver
,
*
pLatch
;
int
i
,
nNodes
,
nBufferSize
,
Pos
;
int
i
,
nNodes
,
nBufferSize
,
Pos
,
fExtended
;
unsigned
char
*
pBuffer
;
unsigned
char
*
pBuffer
;
unsigned
uLit0
,
uLit1
,
uLit
;
unsigned
uLit0
,
uLit1
,
uLit
;
fExtended
=
Abc_NtkConstrNum
(
pNtk
);
assert
(
Abc_NtkIsStrash
(
pNtk
)
);
assert
(
Abc_NtkIsStrash
(
pNtk
)
);
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
if
(
!
Abc_LatchIsInit0
(
pObj
)
)
if
(
!
Abc_LatchIsInit0
(
pObj
)
)
{
{
if
(
!
fCompact
)
{
fExtended
=
1
;
break
;
}
fprintf
(
stdout
,
"Io_WriteAiger(): Cannot write AIGER format with non-0 latch init values. Run
\"
zero
\"
.
\n
"
);
fprintf
(
stdout
,
"Io_WriteAiger(): Cannot write AIGER format with non-0 latch init values. Run
\"
zero
\"
.
\n
"
);
return
;
return
;
}
}
...
@@ -305,10 +312,10 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
...
@@ -305,10 +312,10 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
Abc_NtkPiNum
(
pNtk
)
+
Abc_NtkLatchNum
(
pNtk
)
+
Abc_NtkNodeNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
)
+
Abc_NtkLatchNum
(
pNtk
)
+
Abc_NtkNodeNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
),
Abc_NtkLatchNum
(
pNtk
),
Abc_NtkLatchNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
?
0
:
Abc_NtkPoNum
(
pNtk
),
fExtended
?
0
:
Abc_NtkPoNum
(
pNtk
),
Abc_NtkNodeNum
(
pNtk
)
);
Abc_NtkNodeNum
(
pNtk
)
);
// write the extended header "B C J F"
// write the extended header "B C J F"
if
(
Abc_NtkConstrNum
(
pNtk
)
)
if
(
fExtended
)
fprintf
(
pFile
,
" %u %u"
,
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
);
fprintf
(
pFile
,
" %u %u"
,
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
);
fprintf
(
pFile
,
"
\n
"
);
fprintf
(
pFile
,
"
\n
"
);
...
@@ -320,10 +327,21 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
...
@@ -320,10 +327,21 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
if
(
!
fCompact
)
if
(
!
fCompact
)
{
{
// write latch drivers
// write latch drivers
Abc_NtkForEachLatch
Input
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachLatch
(
pNtk
,
pLatch
,
i
)
{
{
pObj
=
Abc_ObjFanin0
(
pLatch
);
pDriver
=
Abc_ObjFanin0
(
pObj
);
pDriver
=
Abc_ObjFanin0
(
pObj
);
fprintf
(
pFile
,
"%u
\n
"
,
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pDriver
),
Abc_ObjFaninC0
(
pObj
)
^
(
Io_ObjAigerNum
(
pDriver
)
==
0
)
)
);
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pDriver
),
Abc_ObjFaninC0
(
pObj
)
^
(
Io_ObjAigerNum
(
pDriver
)
==
0
)
);
if
(
Abc_LatchIsInit0
(
pLatch
)
)
fprintf
(
pFile
,
"%u
\n
"
,
uLit
);
else
if
(
Abc_LatchIsInit1
(
pLatch
)
)
fprintf
(
pFile
,
"%u 1
\n
"
,
uLit
);
else
{
// Both None and DC are written as 'uninitialized' e.g. a free boolean value
assert
(
Abc_LatchIsInitNone
(
pLatch
)
||
Abc_LatchIsInitDc
(
pLatch
)
);
fprintf
(
pFile
,
"%u %u
\n
"
,
uLit
,
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pLatch
),
0
)
);
}
}
}
// write PO drivers
// write PO drivers
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
...
@@ -353,7 +371,13 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
...
@@ -353,7 +371,13 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pObj
),
0
);
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pObj
),
0
);
uLit0
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin0
(
pObj
)),
Abc_ObjFaninC0
(
pObj
)
);
uLit0
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin0
(
pObj
)),
Abc_ObjFaninC0
(
pObj
)
);
uLit1
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin1
(
pObj
)),
Abc_ObjFaninC1
(
pObj
)
);
uLit1
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin1
(
pObj
)),
Abc_ObjFaninC1
(
pObj
)
);
assert
(
uLit0
<
uLit1
);
if
(
uLit0
>
uLit1
)
{
unsigned
Temp
=
uLit0
;
uLit0
=
uLit1
;
uLit1
=
Temp
;
}
assert
(
uLit1
<
uLit
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
(
unsigned
)(
uLit
-
uLit1
)
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
(
unsigned
)(
uLit
-
uLit1
)
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
(
unsigned
)(
uLit1
-
uLit0
)
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
(
unsigned
)(
uLit1
-
uLit0
)
);
if
(
Pos
>
nBufferSize
-
10
)
if
(
Pos
>
nBufferSize
-
10
)
...
@@ -381,7 +405,12 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
...
@@ -381,7 +405,12 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i
fprintf
(
pFile
,
"l%d %s
\n
"
,
i
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
))
);
fprintf
(
pFile
,
"l%d %s
\n
"
,
i
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
))
);
// write POs
// write POs
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
if
(
!
fExtended
)
fprintf
(
pFile
,
"o%d %s
\n
"
,
i
,
Abc_ObjName
(
pObj
)
);
fprintf
(
pFile
,
"o%d %s
\n
"
,
i
,
Abc_ObjName
(
pObj
)
);
else
if
(
i
<
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
)
)
fprintf
(
pFile
,
"b%d %s
\n
"
,
i
,
Abc_ObjName
(
pObj
)
);
else
fprintf
(
pFile
,
"c%d %s
\n
"
,
i
-
(
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
)),
Abc_ObjName
(
pObj
)
);
}
}
// write the comment
// write the comment
...
@@ -408,8 +437,8 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
...
@@ -408,8 +437,8 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
{
{
ProgressBar
*
pProgress
;
ProgressBar
*
pProgress
;
gzFile
pFile
;
gzFile
pFile
;
Abc_Obj_t
*
pObj
,
*
pDriver
;
Abc_Obj_t
*
pObj
,
*
pDriver
,
*
pLatch
;
int
i
,
nNodes
,
Pos
,
nBufferSize
;
int
i
,
nNodes
,
Pos
,
nBufferSize
,
fExtended
;
unsigned
char
*
pBuffer
;
unsigned
char
*
pBuffer
;
unsigned
uLit0
,
uLit1
,
uLit
;
unsigned
uLit0
,
uLit1
,
uLit
;
...
@@ -421,12 +450,8 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
...
@@ -421,12 +450,8 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
fprintf
(
stdout
,
"Io_WriteAigerGz(): Cannot open the output file
\"
%s
\"
.
\n
"
,
pFileName
);
fprintf
(
stdout
,
"Io_WriteAigerGz(): Cannot open the output file
\"
%s
\"
.
\n
"
,
pFileName
);
return
;
return
;
}
}
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
if
(
!
Abc_LatchIsInit0
(
pObj
)
)
fExtended
=
Abc_NtkConstrNum
(
pNtk
);
{
fprintf
(
stdout
,
"Io_WriteAigerGz(): Cannot write AIGER format with non-0 latch init values. Run
\"
zero
\"
.
\n
"
);
return
;
}
// set the node numbers to be used in the output file
// set the node numbers to be used in the output file
nNodes
=
0
;
nNodes
=
0
;
...
@@ -441,10 +466,10 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
...
@@ -441,10 +466,10 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
Abc_NtkPiNum
(
pNtk
)
+
Abc_NtkLatchNum
(
pNtk
)
+
Abc_NtkNodeNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
)
+
Abc_NtkLatchNum
(
pNtk
)
+
Abc_NtkNodeNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
),
Abc_NtkLatchNum
(
pNtk
),
Abc_NtkLatchNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
?
0
:
Abc_NtkPoNum
(
pNtk
),
fExtended
?
0
:
Abc_NtkPoNum
(
pNtk
),
Abc_NtkNodeNum
(
pNtk
)
);
Abc_NtkNodeNum
(
pNtk
)
);
// write the extended header "B C J F"
// write the extended header "B C J F"
if
(
Abc_NtkConstrNum
(
pNtk
)
)
if
(
fExtended
)
gzprintf
(
pFile
,
" %u %u"
,
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
);
gzprintf
(
pFile
,
" %u %u"
,
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
);
gzprintf
(
pFile
,
"
\n
"
);
gzprintf
(
pFile
,
"
\n
"
);
...
@@ -454,10 +479,21 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
...
@@ -454,10 +479,21 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
// write latch drivers
// write latch drivers
Abc_NtkInvertConstraints
(
pNtk
);
Abc_NtkInvertConstraints
(
pNtk
);
Abc_NtkForEachLatch
Input
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachLatch
(
pNtk
,
pLatch
,
i
)
{
{
pObj
=
Abc_ObjFanin0
(
pLatch
);
pDriver
=
Abc_ObjFanin0
(
pObj
);
pDriver
=
Abc_ObjFanin0
(
pObj
);
gzprintf
(
pFile
,
"%u
\n
"
,
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pDriver
),
Abc_ObjFaninC0
(
pObj
)
^
(
Io_ObjAigerNum
(
pDriver
)
==
0
)
)
);
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pDriver
),
Abc_ObjFaninC0
(
pObj
)
^
(
Io_ObjAigerNum
(
pDriver
)
==
0
)
);
if
(
Abc_LatchIsInit0
(
pLatch
)
)
gzprintf
(
pFile
,
"%u
\n
"
,
uLit
);
else
if
(
Abc_LatchIsInit1
(
pLatch
)
)
gzprintf
(
pFile
,
"%u 1
\n
"
,
uLit
);
else
{
// Both None and DC are written as 'uninitialized' e.g. a free boolean value
assert
(
Abc_LatchIsInitNone
(
pLatch
)
||
Abc_LatchIsInitDc
(
pLatch
)
);
gzprintf
(
pFile
,
"%u %u
\n
"
,
uLit
,
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pLatch
),
0
)
);
}
}
}
// write PO drivers
// write PO drivers
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
...
@@ -478,7 +514,13 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
...
@@ -478,7 +514,13 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pObj
),
0
);
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pObj
),
0
);
uLit0
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin0
(
pObj
)),
Abc_ObjFaninC0
(
pObj
)
);
uLit0
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin0
(
pObj
)),
Abc_ObjFaninC0
(
pObj
)
);
uLit1
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin1
(
pObj
)),
Abc_ObjFaninC1
(
pObj
)
);
uLit1
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin1
(
pObj
)),
Abc_ObjFaninC1
(
pObj
)
);
assert
(
uLit0
<
uLit1
);
if
(
uLit0
>
uLit1
)
{
unsigned
Temp
=
uLit0
;
uLit0
=
uLit1
;
uLit1
=
Temp
;
}
assert
(
uLit1
<
uLit
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
uLit
-
uLit1
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
uLit
-
uLit1
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
uLit1
-
uLit0
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
uLit1
-
uLit0
);
if
(
Pos
>
nBufferSize
-
10
)
if
(
Pos
>
nBufferSize
-
10
)
...
@@ -506,7 +548,12 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
...
@@ -506,7 +548,12 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols )
gzprintf
(
pFile
,
"l%d %s
\n
"
,
i
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
))
);
gzprintf
(
pFile
,
"l%d %s
\n
"
,
i
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
))
);
// write POs
// write POs
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
gzprintf
(
pFile
,
"o%d %s
\n
"
,
i
,
Abc_ObjName
(
pObj
)
);
if
(
!
fExtended
)
gzprintf
(
pFile
,
"o%d %s
\n
"
,
i
,
Aig_ObjName
(
pObj
)
);
else
(
i
<
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
)
)
gzprintf
(
pFile
,
"b%d %s
\n
"
,
i
,
Aig_ObjName
(
pObj
)
);
else
gzprintf
(
pFile
,
"c%d %s
\n
"
,
i
-
(
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
)),
Aig_ObjName
(
pObj
)
);
}
}
// write the comment
// write the comment
...
@@ -589,8 +636,8 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
...
@@ -589,8 +636,8 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
{
{
ProgressBar
*
pProgress
;
ProgressBar
*
pProgress
;
// FILE * pFile;
// FILE * pFile;
Abc_Obj_t
*
pObj
,
*
pDriver
;
Abc_Obj_t
*
pObj
,
*
pDriver
,
*
pLatch
;
int
i
,
nNodes
,
nBufferSize
,
bzError
,
Pos
;
int
i
,
nNodes
,
nBufferSize
,
bzError
,
Pos
,
fExtended
;
unsigned
char
*
pBuffer
;
unsigned
char
*
pBuffer
;
unsigned
uLit0
,
uLit1
,
uLit
;
unsigned
uLit0
,
uLit1
,
uLit
;
bz2file
b
;
bz2file
b
;
...
@@ -602,11 +649,18 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
...
@@ -602,11 +649,18 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
fCompact
=
0
;
fCompact
=
0
;
}
}
fExtended
=
Abc_NtkConstrNum
(
pNtk
);
// check that the network is valid
// check that the network is valid
assert
(
Abc_NtkIsStrash
(
pNtk
)
);
assert
(
Abc_NtkIsStrash
(
pNtk
)
);
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
if
(
!
Abc_LatchIsInit0
(
pObj
)
)
if
(
!
Abc_LatchIsInit0
(
pObj
)
)
{
{
if
(
!
fCompact
)
{
fExtended
=
1
;
break
;
}
fprintf
(
stdout
,
"Io_WriteAiger(): Cannot write AIGER format with non-0 latch init values. Run
\"
zero
\"
.
\n
"
);
fprintf
(
stdout
,
"Io_WriteAiger(): Cannot write AIGER format with non-0 latch init values. Run
\"
zero
\"
.
\n
"
);
return
;
return
;
}
}
...
@@ -655,10 +709,10 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
...
@@ -655,10 +709,10 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
Abc_NtkPiNum
(
pNtk
)
+
Abc_NtkLatchNum
(
pNtk
)
+
Abc_NtkNodeNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
)
+
Abc_NtkLatchNum
(
pNtk
)
+
Abc_NtkNodeNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
),
Abc_NtkPiNum
(
pNtk
),
Abc_NtkLatchNum
(
pNtk
),
Abc_NtkLatchNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
?
0
:
Abc_NtkPoNum
(
pNtk
),
fExtended
?
0
:
Abc_NtkPoNum
(
pNtk
),
Abc_NtkNodeNum
(
pNtk
)
);
Abc_NtkNodeNum
(
pNtk
)
);
// write the extended header "B C J F"
// write the extended header "B C J F"
if
(
Abc_NtkConstrNum
(
pNtk
)
)
if
(
fExtended
)
fprintfBz2Aig
(
&
b
,
" %u %u"
,
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
);
fprintfBz2Aig
(
&
b
,
" %u %u"
,
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
),
Abc_NtkConstrNum
(
pNtk
)
);
fprintfBz2Aig
(
&
b
,
"
\n
"
);
fprintfBz2Aig
(
&
b
,
"
\n
"
);
...
@@ -670,10 +724,21 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
...
@@ -670,10 +724,21 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
if
(
!
fCompact
)
if
(
!
fCompact
)
{
{
// write latch drivers
// write latch drivers
Abc_NtkForEachLatch
Input
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachLatch
(
pNtk
,
pLatch
,
i
)
{
{
pObj
=
Abc_ObjFanin0
(
pLatch
);
pDriver
=
Abc_ObjFanin0
(
pObj
);
pDriver
=
Abc_ObjFanin0
(
pObj
);
fprintfBz2Aig
(
&
b
,
"%u
\n
"
,
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pDriver
),
Abc_ObjFaninC0
(
pObj
)
^
(
Io_ObjAigerNum
(
pDriver
)
==
0
)
)
);
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pDriver
),
Abc_ObjFaninC0
(
pObj
)
^
(
Io_ObjAigerNum
(
pDriver
)
==
0
)
);
if
(
Abc_LatchIsInit0
(
pLatch
)
)
fprintfBz2Aig
(
&
b
,
"%u
\n
"
,
uLit
);
else
if
(
Abc_LatchIsInit1
(
pLatch
)
)
fprintfBz2Aig
(
&
b
,
"%u 1
\n
"
,
uLit
);
else
{
// Both None and DC are written as 'uninitialized' e.g. a free boolean value
assert
(
Abc_LatchIsInitNone
(
pLatch
)
||
Abc_LatchIsInitDc
(
pLatch
)
);
fprintfBz2Aig
(
&
b
,
"%u %u
\n
"
,
uLit
,
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pLatch
),
0
)
);
}
}
}
// write PO drivers
// write PO drivers
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
...
@@ -715,7 +780,13 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
...
@@ -715,7 +780,13 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pObj
),
0
);
uLit
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
pObj
),
0
);
uLit0
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin0
(
pObj
)),
Abc_ObjFaninC0
(
pObj
)
);
uLit0
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin0
(
pObj
)),
Abc_ObjFaninC0
(
pObj
)
);
uLit1
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin1
(
pObj
)),
Abc_ObjFaninC1
(
pObj
)
);
uLit1
=
Io_ObjMakeLit
(
Io_ObjAigerNum
(
Abc_ObjFanin1
(
pObj
)),
Abc_ObjFaninC1
(
pObj
)
);
assert
(
uLit0
<
uLit1
);
if
(
uLit0
>
uLit1
)
{
unsigned
Temp
=
uLit0
;
uLit0
=
uLit1
;
uLit1
=
Temp
;
}
assert
(
uLit1
<
uLit
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
(
unsigned
)(
uLit
-
uLit1
)
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
(
unsigned
)(
uLit
-
uLit1
)
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
(
unsigned
)(
uLit1
-
uLit0
)
);
Pos
=
Io_WriteAigerEncode
(
pBuffer
,
Pos
,
(
unsigned
)(
uLit1
-
uLit0
)
);
if
(
Pos
>
nBufferSize
-
10
)
if
(
Pos
>
nBufferSize
-
10
)
...
@@ -756,7 +827,12 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
...
@@ -756,7 +827,12 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f
fprintfBz2Aig
(
&
b
,
"l%d %s
\n
"
,
i
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
))
);
fprintfBz2Aig
(
&
b
,
"l%d %s
\n
"
,
i
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
))
);
// write POs
// write POs
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachPo
(
pNtk
,
pObj
,
i
)
if
(
!
fExtended
)
fprintfBz2Aig
(
&
b
,
"o%d %s
\n
"
,
i
,
Abc_ObjName
(
pObj
)
);
fprintfBz2Aig
(
&
b
,
"o%d %s
\n
"
,
i
,
Abc_ObjName
(
pObj
)
);
else
if
(
i
<
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
)
)
fprintfBz2Aig
(
&
b
,
"b%d %s
\n
"
,
i
,
Abc_ObjName
(
pObj
)
);
else
fprintfBz2Aig
(
&
b
,
"c%d %s
\n
"
,
i
-
(
Abc_NtkPoNum
(
pNtk
)
-
Abc_NtkConstrNum
(
pNtk
)),
Abc_ObjName
(
pObj
)
);
}
}
// write the comment
// write the comment
...
...
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