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
6095b151
Commit
6095b151
authored
Apr 26, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dumping original object names into a file.
parent
6e465e57
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
159 additions
and
3 deletions
+159
-3
src/base/abc/abc.h
+4
-1
src/base/abc/abcNames.c
+134
-0
src/base/abc/abcNtk.c
+1
-0
src/base/abci/abcStrash.c
+8
-0
src/base/io/io.c
+12
-2
No files found.
src/base/abc/abc.h
View file @
6095b151
...
...
@@ -210,8 +210,8 @@ struct Abc_Ntk_t_
Vec_Ptr_t
*
vOnehots
;
// names of one-hot-encoded registers
Vec_Int_t
*
vObjPerm
;
// permutation saved
Vec_Int_t
*
vTopo
;
// node attributes
Vec_Ptr_t
*
vAttrs
;
// managers of various node attributes (node functionality, global BDDs, etc)
Vec_Int_t
*
vNameIds
;
// name IDs
};
struct
Abc_Des_t_
...
...
@@ -717,6 +717,9 @@ extern ABC_DLL void Abc_NtkAddDummyPiNames( Abc_Ntk_t * pNtk );
extern
ABC_DLL
void
Abc_NtkAddDummyPoNames
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
void
Abc_NtkAddDummyBoxNames
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
void
Abc_NtkShortNames
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
void
Abc_NtkStartNameIds
(
Abc_Ntk_t
*
p
);
extern
ABC_DLL
void
Abc_NtkTransferNameIds
(
Abc_Ntk_t
*
p
,
Abc_Ntk_t
*
pNew
);
extern
ABC_DLL
void
Abc_NtkUpdateNameIds
(
Abc_Ntk_t
*
p
);
/*=== abcNetlist.c ==========================================================*/
extern
ABC_DLL
Abc_Ntk_t
*
Abc_NtkToLogic
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
Abc_Ntk_t
*
Abc_NtkToNetlist
(
Abc_Ntk_t
*
pNtk
);
...
...
src/base/abc/abcNames.c
View file @
6095b151
...
...
@@ -496,6 +496,140 @@ void Abc_NtkShortNames( Abc_Ntk_t * pNtk )
Abc_NtkAddDummyBoxNames
(
pNtk
);
}
/**Function*************************************************************
Synopsis [Saves name IDs into a file.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_NtkStartNameIds
(
Abc_Ntk_t
*
p
)
{
char
pFileName
[
1000
];
FILE
*
pFile
;
Abc_Obj_t
*
pObj
,
*
pFanin
;
Vec_Ptr_t
*
vNodes
;
int
i
,
Counter
=
1
;
assert
(
Abc_NtkIsNetlist
(
p
)
);
assert
(
p
->
vNameIds
==
NULL
);
assert
(
strlen
(
p
->
pSpec
)
<
1000
);
sprintf
(
pFileName
,
"%s_%s_names.txt"
,
Extra_FileNameGenericAppend
(
p
->
pSpec
,
""
),
Extra_FileNameExtension
(
p
->
pSpec
)
);
pFile
=
fopen
(
pFileName
,
"wb"
);
p
->
vNameIds
=
Vec_IntStart
(
Abc_NtkObjNumMax
(
p
)
);
// add inputs
Abc_NtkForEachCi
(
p
,
pObj
,
i
)
fprintf
(
pFile
,
"%s
\n
"
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
))
),
Vec_IntWriteEntry
(
p
->
vNameIds
,
Abc_ObjId
(
pObj
),
2
*
Counter
++
);
// add outputs
Abc_NtkForEachCo
(
p
,
pObj
,
i
)
{
pFanin
=
Abc_ObjFanin0
(
Abc_ObjFanin0
(
pObj
));
if
(
!
Vec_IntEntry
(
p
->
vNameIds
,
Abc_ObjId
(
pFanin
))
)
fprintf
(
pFile
,
"%s
\n
"
,
Abc_ObjName
(
Abc_ObjFanout0
(
pFanin
))
),
Vec_IntWriteEntry
(
p
->
vNameIds
,
Abc_ObjId
(
pFanin
),
2
*
Counter
++
);
}
// add nodes in a topo order
vNodes
=
Abc_NtkDfs
(
p
,
1
);
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
if
(
!
Vec_IntEntry
(
p
->
vNameIds
,
Abc_ObjId
(
pObj
))
)
fprintf
(
pFile
,
"%s
\n
"
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
))
),
Vec_IntWriteEntry
(
p
->
vNameIds
,
Abc_ObjId
(
pObj
),
2
*
Counter
++
);
Vec_PtrFree
(
vNodes
);
fclose
(
pFile
);
// transfer driver node names to COs
Abc_NtkForEachCo
(
p
,
pObj
,
i
)
{
pFanin
=
Abc_ObjFanin0
(
Abc_ObjFanin0
(
pObj
));
Vec_IntWriteEntry
(
p
->
vNameIds
,
Abc_ObjId
(
pObj
),
Vec_IntEntry
(
p
->
vNameIds
,
Abc_ObjId
(
pFanin
))
);
Vec_IntWriteEntry
(
p
->
vNameIds
,
Abc_ObjId
(
pFanin
),
0
);
}
}
/**Function*************************************************************
Synopsis [Remaps the AIG from the old manager into the new manager.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_NtkTransferNameIds
(
Abc_Ntk_t
*
p
,
Abc_Ntk_t
*
pNew
)
{
Abc_Obj_t
*
pObj
,
*
pObjNew
;
int
i
;
assert
(
p
->
vNameIds
!=
NULL
);
assert
(
pNew
->
vNameIds
==
NULL
);
pNew
->
vNameIds
=
Vec_IntStart
(
Abc_NtkObjNumMax
(
pNew
)
);
// Abc_NtkForEachCi( p, pObj, i )
// printf( "%d ", Vec_IntEntry(p->vNameIds, Abc_ObjId(pObj)) );
// printf( "\n" );
Abc_NtkForEachObj
(
p
,
pObj
,
i
)
if
(
pObj
->
pCopy
&&
Vec_IntEntry
(
p
->
vNameIds
,
i
)
)
{
pObjNew
=
Abc_ObjRegular
(
pObj
->
pCopy
);
assert
(
Abc_ObjNtk
(
pObjNew
)
==
pNew
);
if
(
Abc_ObjIsCi
(
pObjNew
)
&&
!
Abc_ObjIsCi
(
pObj
)
)
// do not overwrite CI name by internal node name
continue
;
Vec_IntWriteEntry
(
pNew
->
vNameIds
,
Abc_ObjId
(
pObjNew
),
Vec_IntEntry
(
p
->
vNameIds
,
i
)
^
Abc_ObjIsComplement
(
pObj
->
pCopy
)
);
}
}
/**Function*************************************************************
Synopsis [Updates file with name IDs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_NtkUpdateNameIds
(
Abc_Ntk_t
*
p
)
{
char
pFileName
[
1000
];
Vec_Int_t
*
vStarts
;
Abc_Obj_t
*
pObj
;
FILE
*
pFile
;
int
i
,
c
,
iVar
,
fCompl
,
fSeenSpace
,
Counter
=
0
;
assert
(
!
Abc_NtkIsNetlist
(
p
)
);
assert
(
strlen
(
p
->
pSpec
)
<
1000
);
assert
(
p
->
vNameIds
!=
NULL
);
sprintf
(
pFileName
,
"%s_%s_names.txt"
,
Extra_FileNameGenericAppend
(
p
->
pSpec
,
""
),
Extra_FileNameExtension
(
p
->
pSpec
)
);
pFile
=
fopen
(
pFileName
,
"r+"
);
// collect info about lines
fSeenSpace
=
0
;
vStarts
=
Vec_IntAlloc
(
1000
);
Vec_IntPush
(
vStarts
,
-
1
);
while
(
(
c
=
fgetc
(
pFile
))
!=
EOF
&&
++
Counter
)
if
(
c
==
' '
&&
!
fSeenSpace
)
Vec_IntPush
(
vStarts
,
Counter
),
fSeenSpace
=
1
;
else
if
(
c
==
'\n'
)
fSeenSpace
=
0
;
// add info about names
Abc_NtkForEachObj
(
p
,
pObj
,
i
)
{
if
(
!
Vec_IntEntry
(
p
->
vNameIds
,
i
)
)
continue
;
iVar
=
Abc_Lit2Var
(
Vec_IntEntry
(
p
->
vNameIds
,
i
)
);
fCompl
=
Abc_LitIsCompl
(
Vec_IntEntry
(
p
->
vNameIds
,
i
)
);
assert
(
iVar
<
Vec_IntSize
(
vStarts
)
);
fseek
(
pFile
,
Vec_IntEntry
(
vStarts
,
iVar
),
SEEK_SET
);
fprintf
(
pFile
,
"%s%d"
,
fCompl
?
"-"
:
""
,
i
);
}
printf
(
"Saved %d names into file
\"
%s
\"
.
\n
"
,
Vec_IntSize
(
vStarts
)
-
1
,
pFileName
);
fclose
(
pFile
);
Vec_IntFree
(
vStarts
);
Vec_IntFreeP
(
&
p
->
vNameIds
);
// Abc_NtkForEachObj( p, pObj, i )
// Abc_ObjPrint( stdout, pObj );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/base/abc/abcNtk.c
View file @
6095b151
...
...
@@ -1331,6 +1331,7 @@ void Abc_NtkDelete( Abc_Ntk_t * pNtk )
assert
(
pNtk
->
pSCLib
==
NULL
);
Vec_IntFreeP
(
&
pNtk
->
vGates
);
Vec_PtrFree
(
pNtk
->
vAttrs
);
Vec_IntFreeP
(
&
pNtk
->
vNameIds
);
ABC_FREE
(
pNtk
->
pWLoadUsed
);
ABC_FREE
(
pNtk
->
pName
);
ABC_FREE
(
pNtk
->
pSpec
);
...
...
src/base/abci/abcStrash.c
View file @
6095b151
...
...
@@ -232,6 +232,11 @@ Abc_Ntk_t * Abc_NtkRestrashZero( Abc_Ntk_t * pNtk, int fCleanup )
// duplicate EXDC
if
(
pNtk
->
pExdc
)
pNtkAig
->
pExdc
=
Abc_NtkDup
(
pNtk
->
pExdc
);
// transfer name IDs
if
(
pNtk
->
vNameIds
)
Abc_NtkTransferNameIds
(
pNtk
,
pNtkAig
);
if
(
pNtk
->
vNameIds
)
Abc_NtkUpdateNameIds
(
pNtkAig
);
// make sure everything is okay
if
(
!
Abc_NtkCheck
(
pNtkAig
)
)
{
...
...
@@ -276,6 +281,9 @@ Abc_Ntk_t * Abc_NtkStrash( Abc_Ntk_t * pNtk, int fAllNodes, int fCleanup, int fR
pNtkAig
=
Abc_NtkStartFrom
(
pNtk
,
ABC_NTK_STRASH
,
ABC_FUNC_AIG
);
Abc_NtkStrashPerform
(
pNtk
,
pNtkAig
,
fAllNodes
,
fRecord
);
Abc_NtkFinalize
(
pNtk
,
pNtkAig
);
// transfer name IDs
if
(
pNtk
->
vNameIds
)
Abc_NtkTransferNameIds
(
pNtk
,
pNtkAig
);
// print warning about self-feed latches
// if ( Abc_NtkCountSelfFeedLatches(pNtkAig) )
// printf( "Warning: The network has %d self-feeding latches.\n", Abc_NtkCountSelfFeedLatches(pNtkAig) );
...
...
src/base/io/io.c
View file @
6095b151
...
...
@@ -440,20 +440,25 @@ int IoCommandReadBlif( Abc_Frame_t * pAbc, int argc, char ** argv )
int
fReadAsAig
;
int
fCheck
;
int
fUseNewParser
;
int
fSaveNames
;
int
c
;
extern
Abc_Ntk_t
*
Io_ReadBlifAsAig
(
char
*
pFileName
,
int
fCheck
);
fCheck
=
1
;
fReadAsAig
=
0
;
fUseNewParser
=
1
;
fSaveNames
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"nach"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"n
m
ach"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'n'
:
fUseNewParser
^=
1
;
break
;
case
'm'
:
fSaveNames
^=
1
;
break
;
case
'a'
:
fReadAsAig
^=
1
;
break
;
...
...
@@ -481,7 +486,11 @@ int IoCommandReadBlif( Abc_Frame_t * pAbc, int argc, char ** argv )
pNtk
=
Io_ReadBlif
(
pFileName
,
fCheck
);
if
(
pNtk
==
NULL
)
return
1
;
if
(
fSaveNames
)
Abc_NtkStartNameIds
(
pNtk
);
pNtk
=
Abc_NtkToLogic
(
pTemp
=
pNtk
);
if
(
fSaveNames
)
Abc_NtkTransferNameIds
(
pTemp
,
pNtk
);
Abc_NtkDelete
(
pTemp
);
}
...
...
@@ -493,10 +502,11 @@ int IoCommandReadBlif( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: read_blif [-nach] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"usage: read_blif [-n
m
ach] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
reads the network in binary BLIF format
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
(if this command does not work, try
\"
read
\"
)
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-n : toggle using old BLIF parser without hierarchy support [default = %s]
\n
"
,
!
fUseNewParser
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-m : toggle saving original circuit names into a file [default = %s]
\n
"
,
fSaveNames
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-a : toggle creating AIG while reading the file [default = %s]
\n
"
,
fReadAsAig
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-c : toggle network check after reading [default = %s]
\n
"
,
fCheck
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : prints the command summary
\n
"
);
...
...
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