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
e7527a47
Commit
e7527a47
authored
Sep 25, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up interfaces of genlib/liberty/supergate reading/writing.
parent
1c099166
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
669 additions
and
269 deletions
+669
-269
src/map/mapper/mapper.c
+2
-2
src/map/mapper/mapperInt.h
+3
-1
src/map/mapper/mapperLib.c
+59
-7
src/map/mapper/mapperSuper.c
+3
-3
src/map/mapper/mapperTree.c
+347
-95
src/map/mio/mio.c
+5
-5
src/map/mio/mio.h
+1
-0
src/map/mio/mioRead.c
+8
-7
src/map/super/super.c
+4
-3
src/map/super/super.h
+5
-7
src/map/super/superGate.c
+232
-133
src/map/super/superInt.h
+0
-6
No files found.
src/map/mapper/mapper.c
View file @
e7527a47
...
@@ -143,11 +143,11 @@ int Map_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -143,11 +143,11 @@ int Map_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
fclose
(
pFile
);
fclose
(
pFile
);
// set the new network
// set the new network
pLib
=
Map_SuperLibCreate
(
FileName
,
ExcludeFile
,
fAlgorithm
,
fVerbose
);
pLib
=
Map_SuperLibCreate
(
NULL
,
FileName
,
ExcludeFile
,
fAlgorithm
,
fVerbose
);
if
(
pLib
==
NULL
)
if
(
pLib
==
NULL
)
{
{
fprintf
(
pErr
,
"Reading supergate library has failed.
\n
"
);
fprintf
(
pErr
,
"Reading supergate library has failed.
\n
"
);
goto
usage
;
return
1
;
}
}
// replace the current library
// replace the current library
// Map_SuperLibFree( s_pSuperLib );
// Map_SuperLibFree( s_pSuperLib );
...
...
src/map/mapper/mapperInt.h
View file @
e7527a47
...
@@ -378,7 +378,7 @@ extern void Map_NodeAddFaninFanout( Map_Node_t * pFanin, Map_Node_t
...
@@ -378,7 +378,7 @@ extern void Map_NodeAddFaninFanout( Map_Node_t * pFanin, Map_Node_t
extern
void
Map_NodeRemoveFaninFanout
(
Map_Node_t
*
pFanin
,
Map_Node_t
*
pFanoutToRemove
);
extern
void
Map_NodeRemoveFaninFanout
(
Map_Node_t
*
pFanin
,
Map_Node_t
*
pFanoutToRemove
);
extern
int
Map_NodeGetFanoutNum
(
Map_Node_t
*
pNode
);
extern
int
Map_NodeGetFanoutNum
(
Map_Node_t
*
pNode
);
/*=== mapperLib.c ============================================================*/
/*=== mapperLib.c ============================================================*/
extern
Map_SuperLib_t
*
Map_SuperLibCreate
(
char
*
pFileName
,
char
*
pExcludeFile
,
int
fAlgorithm
,
int
fVerbose
);
extern
Map_SuperLib_t
*
Map_SuperLibCreate
(
Vec_Str_t
*
vStr
,
char
*
pFileName
,
char
*
pExcludeFile
,
int
fAlgorithm
,
int
fVerbose
);
extern
void
Map_SuperLibFree
(
Map_SuperLib_t
*
p
);
extern
void
Map_SuperLibFree
(
Map_SuperLib_t
*
p
);
/*=== mapperMatch.c ===============================================================*/
/*=== mapperMatch.c ===============================================================*/
extern
int
Map_MappingMatches
(
Map_Man_t
*
p
);
extern
int
Map_MappingMatches
(
Map_Man_t
*
p
);
...
@@ -405,6 +405,8 @@ extern float Map_MappingGetArea( Map_Man_t * pMan, Map_NodeVec_t * v
...
@@ -405,6 +405,8 @@ extern float Map_MappingGetArea( Map_Man_t * pMan, Map_NodeVec_t * v
/*=== mapperShow.c =============================================================*/
/*=== mapperShow.c =============================================================*/
extern
void
Map_MappingShow
(
Map_Man_t
*
pMan
,
char
*
pFileName
);
extern
void
Map_MappingShow
(
Map_Man_t
*
pMan
,
char
*
pFileName
);
/*=== mapperTree.c ===============================================================*/
/*=== mapperTree.c ===============================================================*/
extern
int
Map_LibraryDeriveGateInfo
(
Map_SuperLib_t
*
pLib
,
st_table
*
tExcludeGate
);
extern
int
Map_LibraryReadFileTreeStr
(
Map_SuperLib_t
*
pLib
,
Vec_Str_t
*
vStr
,
char
*
pFileName
);
extern
int
Map_LibraryReadTree
(
Map_SuperLib_t
*
pLib
,
char
*
pFileName
,
char
*
pExcludeFile
);
extern
int
Map_LibraryReadTree
(
Map_SuperLib_t
*
pLib
,
char
*
pFileName
,
char
*
pExcludeFile
);
extern
void
Map_LibraryPrintTree
(
Map_SuperLib_t
*
pLib
);
extern
void
Map_LibraryPrintTree
(
Map_SuperLib_t
*
pLib
);
/*=== mapperSuper.c ===============================================================*/
/*=== mapperSuper.c ===============================================================*/
...
...
src/map/mapper/mapperLib.c
View file @
e7527a47
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#endif
#endif
#include "mapperInt.h"
#include "mapperInt.h"
#include "map/super/super.h"
#include "map/mapper/mapperInt.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -53,7 +55,7 @@ ABC_NAMESPACE_IMPL_START
...
@@ -53,7 +55,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Map_SuperLib_t
*
Map_SuperLibCreate
(
char
*
pFileName
,
char
*
pExcludeFile
,
int
fAlgorithm
,
int
fVerbose
)
Map_SuperLib_t
*
Map_SuperLibCreate
(
Vec_Str_t
*
vStr
,
char
*
pFileName
,
char
*
pExcludeFile
,
int
fAlgorithm
,
int
fVerbose
)
{
{
Map_SuperLib_t
*
p
;
Map_SuperLib_t
*
p
;
clock_t
clk
;
clock_t
clk
;
...
@@ -61,7 +63,7 @@ Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, int
...
@@ -61,7 +63,7 @@ Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, int
// start the supergate library
// start the supergate library
p
=
ABC_ALLOC
(
Map_SuperLib_t
,
1
);
p
=
ABC_ALLOC
(
Map_SuperLib_t
,
1
);
memset
(
p
,
0
,
sizeof
(
Map_SuperLib_t
)
);
memset
(
p
,
0
,
sizeof
(
Map_SuperLib_t
)
);
p
->
pName
=
pFileName
;
p
->
pName
=
Abc_UtilStrsav
(
pFileName
)
;
p
->
fVerbose
=
fVerbose
;
p
->
fVerbose
=
fVerbose
;
p
->
mmSupers
=
Extra_MmFixedStart
(
sizeof
(
Map_Super_t
)
);
p
->
mmSupers
=
Extra_MmFixedStart
(
sizeof
(
Map_Super_t
)
);
p
->
mmEntries
=
Extra_MmFixedStart
(
sizeof
(
Map_HashEntry_t
)
);
p
->
mmEntries
=
Extra_MmFixedStart
(
sizeof
(
Map_HashEntry_t
)
);
...
@@ -74,7 +76,25 @@ Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, int
...
@@ -74,7 +76,25 @@ Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, int
// read the supergate library from file
// read the supergate library from file
clk
=
clock
();
clk
=
clock
();
if
(
fAlgorithm
)
if
(
vStr
!=
NULL
)
{
// read the supergate library from file
int
Status
=
Map_LibraryReadFileTreeStr
(
p
,
vStr
,
pFileName
);
if
(
Status
==
0
)
{
Map_SuperLibFree
(
p
);
return
NULL
;
}
// prepare the info about the library
Status
=
Map_LibraryDeriveGateInfo
(
p
,
NULL
);
if
(
Status
==
0
)
{
Map_SuperLibFree
(
p
);
return
NULL
;
}
assert
(
p
->
nVarsMax
>
0
);
}
else
if
(
fAlgorithm
)
{
{
if
(
!
Map_LibraryReadTree
(
p
,
pFileName
,
pExcludeFile
)
)
if
(
!
Map_LibraryReadTree
(
p
,
pFileName
,
pExcludeFile
)
)
{
{
...
@@ -162,6 +182,7 @@ void Map_SuperLibFree( Map_SuperLib_t * p )
...
@@ -162,6 +182,7 @@ void Map_SuperLibFree( Map_SuperLib_t * p )
Extra_MmFixedStop
(
p
->
mmEntries
);
Extra_MmFixedStop
(
p
->
mmEntries
);
Extra_MmFlexStop
(
p
->
mmForms
);
Extra_MmFlexStop
(
p
->
mmForms
);
ABC_FREE
(
p
->
ppSupers
);
ABC_FREE
(
p
->
ppSupers
);
ABC_FREE
(
p
->
pName
);
ABC_FREE
(
p
);
ABC_FREE
(
p
);
}
}
...
@@ -178,15 +199,47 @@ void Map_SuperLibFree( Map_SuperLib_t * p )
...
@@ -178,15 +199,47 @@ void Map_SuperLibFree( Map_SuperLib_t * p )
***********************************************************************/
***********************************************************************/
int
Map_SuperLibDeriveFromGenlib
(
Mio_Library_t
*
pLib
,
int
fVerbose
)
int
Map_SuperLibDeriveFromGenlib
(
Mio_Library_t
*
pLib
,
int
fVerbose
)
{
{
extern
void
Super_Precompute
(
Mio_Library_t
*
pLibGen
,
int
nInputs
,
int
nLevels
,
int
nGatesMax
,
float
tDelayMax
,
float
tAreaMax
,
int
TimeLimit
,
int
fSkipInv
,
int
fWriteOldFormat
,
int
fVerbose
);
Map_SuperLib_t
*
pLibSuper
;
Abc_Frame_t
*
pAbc
=
Abc_FrameGetGlobalFrame
();
Vec_Str_t
*
vStr
;
char
*
pFileName
;
if
(
pLib
==
NULL
)
return
0
;
// compute supergates
vStr
=
Super_PrecomputeStr
(
pLib
,
5
,
1
,
100000000
,
10000000
,
10000000
,
100
,
1
,
0
);
if
(
vStr
==
NULL
)
return
0
;
// create supergate library
pFileName
=
Extra_FileNameGenericAppend
(
Mio_LibraryReadName
(
pLib
),
".super"
);
pLibSuper
=
Map_SuperLibCreate
(
vStr
,
pFileName
,
NULL
,
1
,
0
);
Vec_StrFree
(
vStr
);
// replace the library
Map_SuperLibFree
(
(
Map_SuperLib_t
*
)
Abc_FrameReadLibSuper
()
);
Abc_FrameSetLibSuper
(
pLibSuper
);
return
1
;
}
/**Function*************************************************************
Synopsis [Derives the library from the genlib library.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Map_SuperLibDeriveFromGenlib2
(
Mio_Library_t
*
pLib
,
int
fVerbose
)
{
Abc_Frame_t
*
pAbc
=
Abc_FrameGetGlobalFrame
();
Abc_Frame_t
*
pAbc
=
Abc_FrameGetGlobalFrame
();
char
*
pFileName
;
char
*
pFileName
;
if
(
pLib
==
NULL
)
if
(
pLib
==
NULL
)
return
0
;
return
0
;
// compute supergates
// compute supergates
Super_Precompute
(
pLib
,
5
,
1
,
100000000
,
10000000
,
10000000
,
100
,
1
,
0
,
0
);
// assuming that it terminated successfully
pFileName
=
Extra_FileNameGenericAppend
(
Mio_LibraryReadName
(
pLib
),
".super"
);
pFileName
=
Extra_FileNameGenericAppend
(
Mio_LibraryReadName
(
pLib
),
".super"
);
Super_Precompute
(
pLib
,
5
,
1
,
100000000
,
10000000
,
10000000
,
100
,
1
,
0
,
pFileName
);
// assuming that it terminated successfully
if
(
Cmd_CommandExecute
(
pAbc
,
pFileName
)
)
if
(
Cmd_CommandExecute
(
pAbc
,
pFileName
)
)
{
{
fprintf
(
stdout
,
"Cannot execute command
\"
read_super %s
\"
.
\n
"
,
pFileName
);
fprintf
(
stdout
,
"Cannot execute command
\"
read_super %s
\"
.
\n
"
,
pFileName
);
...
@@ -195,7 +248,6 @@ int Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib, int fVerbose )
...
@@ -195,7 +248,6 @@ int Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib, int fVerbose )
return
1
;
return
1
;
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
src/map/mapper/mapperSuper.c
View file @
e7527a47
...
@@ -103,13 +103,13 @@ int Map_LibraryReadFile( Map_SuperLib_t * pLib, FILE * pFile )
...
@@ -103,13 +103,13 @@ int Map_LibraryReadFile( Map_SuperLib_t * pLib, FILE * pFile )
pLibName
=
strtok
(
pTemp
,
"
\t\r\n
"
);
pLibName
=
strtok
(
pTemp
,
"
\t\r\n
"
);
if
(
strcmp
(
pLibName
,
"GATE"
)
==
0
)
if
(
strcmp
(
pLibName
,
"GATE"
)
==
0
)
{
{
printf
(
"The input file
\"
%s
\"
looks like a
GENLIB
file and not a supergate library file.
\n
"
,
pLib
->
pName
);
printf
(
"The input file
\"
%s
\"
looks like a
genlib
file and not a supergate library file.
\n
"
,
pLib
->
pName
);
return
0
;
return
0
;
}
}
pFileGen
=
fopen
(
pLibName
,
"r"
);
pFileGen
=
fopen
(
pLibName
,
"r"
);
if
(
pFileGen
==
NULL
)
if
(
pFileGen
==
NULL
)
{
{
printf
(
"Cannot open the
GENLIB
file
\"
%s
\"
.
\n
"
,
pLibName
);
printf
(
"Cannot open the
genlib
file
\"
%s
\"
.
\n
"
,
pLibName
);
return
0
;
return
0
;
}
}
fclose
(
pFileGen
);
fclose
(
pFileGen
);
...
@@ -118,7 +118,7 @@ int Map_LibraryReadFile( Map_SuperLib_t * pLib, FILE * pFile )
...
@@ -118,7 +118,7 @@ int Map_LibraryReadFile( Map_SuperLib_t * pLib, FILE * pFile )
pLib
->
pGenlib
=
Mio_LibraryRead
(
pLibName
,
NULL
,
0
,
0
);
pLib
->
pGenlib
=
Mio_LibraryRead
(
pLibName
,
NULL
,
0
,
0
);
if
(
pLib
->
pGenlib
==
NULL
)
if
(
pLib
->
pGenlib
==
NULL
)
{
{
printf
(
"Cannot read
GENLIB
file
\"
%s
\"
.
\n
"
,
pLibName
);
printf
(
"Cannot read
genlib
file
\"
%s
\"
.
\n
"
,
pLibName
);
return
0
;
return
0
;
}
}
...
...
src/map/mapper/mapperTree.c
View file @
e7527a47
...
@@ -29,12 +29,9 @@ ABC_NAMESPACE_IMPL_START
...
@@ -29,12 +29,9 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
static
int
Map_LibraryReadFileTree
(
Map_SuperLib_t
*
pLib
,
FILE
*
pFile
,
char
*
pFileName
);
static
void
Map_LibraryAddFaninDelays
(
Map_SuperLib_t
*
pLib
,
Map_Super_t
*
pGate
,
Map_Super_t
*
pFanin
,
Mio_Pin_t
*
pPin
);
static
Map_Super_t
*
Map_LibraryReadGateTree
(
Map_SuperLib_t
*
pLib
,
char
*
pBuffer
,
int
Number
,
int
nVars
);
static
int
Map_LibraryGetMaxSuperPi_rec
(
Map_Super_t
*
pGate
);
static
int
Map_LibraryDeriveGateInfo
(
Map_SuperLib_t
*
pLib
,
st_table
*
tExcludeGate
);
static
unsigned
Map_LibraryGetGateSupp_rec
(
Map_Super_t
*
pGate
);
static
void
Map_LibraryAddFaninDelays
(
Map_SuperLib_t
*
pLib
,
Map_Super_t
*
pGate
,
Map_Super_t
*
pFanin
,
Mio_Pin_t
*
pPin
);
static
int
Map_LibraryGetMaxSuperPi_rec
(
Map_Super_t
*
pGate
);
static
unsigned
Map_LibraryGetGateSupp_rec
(
Map_Super_t
*
pGate
);
// fanout limits
// fanout limits
static
const
int
s_MapFanoutLimits
[
10
]
=
{
1
/*0*/
,
10
/*1*/
,
5
/*2*/
,
2
/*3*/
,
1
/*4*/
,
1
/*5*/
,
1
/*6*/
};
static
const
int
s_MapFanoutLimits
[
10
]
=
{
1
/*0*/
,
10
/*1*/
,
5
/*2*/
,
2
/*3*/
,
1
/*4*/
,
1
/*5*/
,
1
/*6*/
};
...
@@ -45,7 +42,7 @@ static const int s_MapFanoutLimits[10] = { 1/*0*/, 10/*1*/, 5/*2*/, 2/*3*/, 1/*4
...
@@ -45,7 +42,7 @@ static const int s_MapFanoutLimits[10] = { 1/*0*/, 10/*1*/, 5/*2*/, 2/*3*/, 1/*4
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Reads
the supergate library from fil
e.]
Synopsis [Reads
one gat
e.]
Description []
Description []
...
@@ -54,50 +51,89 @@ static const int s_MapFanoutLimits[10] = { 1/*0*/, 10/*1*/, 5/*2*/, 2/*3*/, 1/*4
...
@@ -54,50 +51,89 @@ static const int s_MapFanoutLimits[10] = { 1/*0*/, 10/*1*/, 5/*2*/, 2/*3*/, 1/*4
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Map_LibraryReadTree
(
Map_SuperLib_t
*
pLib
,
char
*
pFileName
,
char
*
pExcludeFile
)
Map_Super_t
*
Map_LibraryReadGateTree
(
Map_SuperLib_t
*
pLib
,
char
*
pBuffer
,
int
Number
,
int
nVarsMax
)
{
{
FILE
*
pFile
;
Map_Super_t
*
pGate
;
int
Status
,
num
;
char
*
pTemp
;
Abc_Frame_t
*
pAbc
;
int
i
,
Num
;
st_table
*
tExcludeGate
=
0
;
// read the beginning of the file
// start and clean the gate
assert
(
pLib
->
pGenlib
==
NULL
);
pGate
=
(
Map_Super_t
*
)
Extra_MmFixedEntryFetch
(
pLib
->
mmSupers
);
pFile
=
Io_FileOpen
(
pFileName
,
"open_path"
,
"r"
,
1
);
memset
(
pGate
,
0
,
sizeof
(
Map_Super_t
)
);
// pFile = fopen( pFileName, "r" );
if
(
pFile
==
NULL
)
// set the gate number
pGate
->
Num
=
Number
;
// read the mark
pTemp
=
strtok
(
pBuffer
,
" "
);
if
(
pTemp
[
0
]
==
'*'
)
{
{
p
rintf
(
"Cannot open input file
\"
%s
\"
.
\n
"
,
pFileName
)
;
p
Gate
->
fSuper
=
1
;
return
0
;
pTemp
=
strtok
(
NULL
,
" "
)
;
}
}
if
(
pExcludeFile
)
// read the root gate
pGate
->
pRoot
=
Mio_LibraryReadGateByName
(
pLib
->
pGenlib
,
pTemp
,
NULL
);
if
(
pGate
->
pRoot
==
NULL
)
{
{
pAbc
=
Abc_FrameGetGlobalFrame
();
printf
(
"Cannot read the root gate names %s.
\n
"
,
pTemp
);
return
NULL
;
tExcludeGate
=
st_init_table
(
strcmp
,
st_strhash
);
}
if
(
(
num
=
Mio_LibraryReadExclude
(
pExcludeFile
,
tExcludeGate
))
==
-
1
)
// set the max number of fanouts
pGate
->
nFanLimit
=
s_MapFanoutLimits
[
Mio_GateReadPinNum
(
pGate
->
pRoot
)
];
// read the pin-to-pin delay
for
(
i
=
0
;
(
pTemp
=
strtok
(
NULL
,
"
\n\0
"
)
);
i
++
)
{
if
(
pTemp
[
0
]
==
'#'
)
break
;
if
(
i
==
nVarsMax
)
{
{
st_free_table
(
tExcludeGate
);
printf
(
"There are too many entries on the line.
\n
"
);
tExcludeGate
=
0
;
return
NULL
;
return
0
;
}
}
Num
=
atoi
(
pTemp
);
if
(
Num
<
0
)
{
printf
(
"The number of a child supergate is negative.
\n
"
);
return
NULL
;
}
if
(
Num
>
pLib
->
nLines
)
{
printf
(
"The number of a child supergate (%d) exceeded the number of lines (%d).
\n
"
,
Num
,
pLib
->
nLines
);
return
NULL
;
}
pGate
->
pFanins
[
i
]
=
pLib
->
ppSupers
[
Num
];
}
pGate
->
nFanins
=
i
;
if
(
pGate
->
nFanins
!=
(
unsigned
)
Mio_GateReadPinNum
(
pGate
->
pRoot
)
)
{
printf
(
"The number of fanins of a root gate is wrong.
\n
"
);
return
NULL
;
}
fprintf
(
Abc_FrameReadOut
(
pAbc
),
"Read %d gates from exclude file
\n
"
,
num
);
// save the gate name, just in case
if
(
pTemp
&&
pTemp
[
0
]
==
'#'
)
{
if
(
pTemp
[
1
]
==
0
)
pTemp
=
strtok
(
NULL
,
"
\n\0
"
);
else
// skip spaces
for
(
pTemp
++
;
*
pTemp
==
' '
;
pTemp
++
);
// save the formula
pGate
->
pFormula
=
Extra_MmFlexEntryFetch
(
pLib
->
mmForms
,
strlen
(
pTemp
)
+
1
);
strcpy
(
pGate
->
pFormula
,
pTemp
);
}
}
// check the rest of the string
Status
=
Map_LibraryReadFileTree
(
pLib
,
pFile
,
pFileName
);
pTemp
=
strtok
(
NULL
,
"
\n\0
"
);
fclose
(
pFile
);
if
(
pTemp
!=
NULL
)
if
(
Status
==
0
)
printf
(
"The following trailing symbols found
\"
%s
\"
.
\n
"
,
pTemp
);
return
0
;
return
pGate
;
// prepare the info about the library
return
Map_LibraryDeriveGateInfo
(
pLib
,
tExcludeGate
);
}
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Reads the
library
file.]
Synopsis [Reads the
supergate library from
file.]
Description []
Description []
...
@@ -129,7 +165,7 @@ int Map_LibraryReadFileTree( Map_SuperLib_t * pLib, FILE * pFile, char *pFileNam
...
@@ -129,7 +165,7 @@ int Map_LibraryReadFileTree( Map_SuperLib_t * pLib, FILE * pFile, char *pFileNam
pLib
->
pGenlib
=
Abc_FrameReadLibGen
();
pLib
->
pGenlib
=
Abc_FrameReadLibGen
();
if
(
pLib
->
pGenlib
==
NULL
||
strcmp
(
Mio_LibraryReadName
(
pLib
->
pGenlib
),
pLibName
)
)
if
(
pLib
->
pGenlib
==
NULL
||
strcmp
(
Mio_LibraryReadName
(
pLib
->
pGenlib
),
pLibName
)
)
{
{
printf
(
"Supergate library
\"
%s
\"
requires the use of
G
enlib library
\"
%s
\"
.
\n
"
,
pFileName
,
pLibName
);
printf
(
"Supergate library
\"
%s
\"
requires the use of
g
enlib library
\"
%s
\"
.
\n
"
,
pFileName
,
pLibName
);
return
0
;
return
0
;
}
}
...
@@ -224,10 +260,49 @@ int Map_LibraryReadFileTree( Map_SuperLib_t * pLib, FILE * pFile, char *pFileNam
...
@@ -224,10 +260,49 @@ int Map_LibraryReadFileTree( Map_SuperLib_t * pLib, FILE * pFile, char *pFileNam
pLib
->
nSupersReal
=
nCounter
;
pLib
->
nSupersReal
=
nCounter
;
return
1
;
return
1
;
}
}
int
Map_LibraryReadTree2
(
Map_SuperLib_t
*
pLib
,
char
*
pFileName
,
char
*
pExcludeFile
)
{
FILE
*
pFile
;
int
Status
,
num
;
Abc_Frame_t
*
pAbc
;
st_table
*
tExcludeGate
=
0
;
// read the beginning of the file
assert
(
pLib
->
pGenlib
==
NULL
);
pFile
=
Io_FileOpen
(
pFileName
,
"open_path"
,
"r"
,
1
);
// pFile = fopen( pFileName, "r" );
if
(
pFile
==
NULL
)
{
printf
(
"Cannot open input file
\"
%s
\"
.
\n
"
,
pFileName
);
return
0
;
}
if
(
pExcludeFile
)
{
pAbc
=
Abc_FrameGetGlobalFrame
();
tExcludeGate
=
st_init_table
(
strcmp
,
st_strhash
);
if
(
(
num
=
Mio_LibraryReadExclude
(
pExcludeFile
,
tExcludeGate
))
==
-
1
)
{
st_free_table
(
tExcludeGate
);
tExcludeGate
=
0
;
return
0
;
}
fprintf
(
Abc_FrameReadOut
(
pAbc
),
"Read %d gates from exclude file
\n
"
,
num
);
}
Status
=
Map_LibraryReadFileTree
(
pLib
,
pFile
,
pFileName
);
fclose
(
pFile
);
if
(
Status
==
0
)
return
0
;
// prepare the info about the library
return
Map_LibraryDeriveGateInfo
(
pLib
,
tExcludeGate
);
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [
Reads one gate
.]
Synopsis [
Similar to fgets
.]
Description []
Description []
...
@@ -236,87 +311,264 @@ int Map_LibraryReadFileTree( Map_SuperLib_t * pLib, FILE * pFile, char *pFileNam
...
@@ -236,87 +311,264 @@ int Map_LibraryReadFileTree( Map_SuperLib_t * pLib, FILE * pFile, char *pFileNam
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Map_Super_t
*
Map_LibraryReadGateTree
(
Map_SuperLib_t
*
pLib
,
char
*
pBuffer
,
int
Number
,
int
nVarsMax
)
int
Vec_StrGets
(
char
*
pBuffer
,
int
nBufferSize
,
Vec_Str_t
*
vStr
,
int
*
pPos
)
{
{
char
*
pCur
;
char
*
pBeg
=
Vec_StrArray
(
vStr
)
+
*
pPos
;
char
*
pEnd
=
Vec_StrArray
(
vStr
)
+
Vec_StrSize
(
vStr
);
assert
(
nBufferSize
>
1
);
if
(
pBeg
==
pEnd
)
{
*
pBuffer
=
0
;
return
0
;
}
assert
(
pBeg
<
pEnd
);
for
(
pCur
=
pBeg
;
pCur
<
pEnd
;
pCur
++
)
{
*
pBuffer
++
=
*
pCur
;
if
(
*
pCur
==
0
)
{
*
pPos
+=
pCur
-
pBeg
;
return
0
;
}
if
(
*
pCur
==
'\n'
)
{
*
pPos
+=
pCur
-
pBeg
+
1
;
*
pBuffer
=
0
;
return
1
;
}
if
(
pCur
-
pBeg
==
nBufferSize
-
1
)
{
*
pPos
+=
pCur
-
pBeg
+
1
;
*
pBuffer
=
0
;
return
1
;
}
}
return
0
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Map_LibraryCompareLibNames
(
char
*
pName1
,
char
*
pName2
)
{
char
*
p1
=
Abc_UtilStrsav
(
pName1
);
char
*
p2
=
Abc_UtilStrsav
(
pName2
);
int
i
,
RetValue
;
for
(
i
=
0
;
p1
[
i
];
i
++
)
if
(
p1
[
i
]
==
'>'
||
p1
[
i
]
==
'\\'
||
p1
[
i
]
==
'/'
)
p1
[
i
]
=
'/'
;
for
(
i
=
0
;
p2
[
i
];
i
++
)
if
(
p2
[
i
]
==
'>'
||
p2
[
i
]
==
'\\'
||
p2
[
i
]
==
'/'
)
p2
[
i
]
=
'/'
;
RetValue
=
strcmp
(
p1
,
p2
);
ABC_FREE
(
p1
);
ABC_FREE
(
p2
);
return
RetValue
;
}
/**Function*************************************************************
Synopsis [Reads the supergate library from file.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Map_LibraryReadFileTreeStr
(
Map_SuperLib_t
*
pLib
,
Vec_Str_t
*
vStr
,
char
*
pFileName
)
{
ProgressBar
*
pProgress
;
char
pBuffer
[
5000
];
Map_Super_t
*
pGate
;
Map_Super_t
*
pGate
;
char
*
pTemp
;
char
*
pTemp
=
0
,
*
pLibName
;
int
i
,
Num
;
int
nCounter
,
k
,
i
;
int
RetValue
,
nPos
=
0
;
// start and clean the gate
// skip empty and comment lines
pGate
=
(
Map_Super_t
*
)
Extra_MmFixedEntryFetch
(
pLib
->
mmSupers
);
// while ( fgets( pBuffer, 5000, pFile ) != NULL )
memset
(
pGate
,
0
,
sizeof
(
Map_Super_t
)
);
while
(
1
)
{
RetValue
=
Vec_StrGets
(
pBuffer
,
5000
,
vStr
,
&
nPos
);
if
(
RetValue
==
0
)
return
0
;
// skip leading spaces
for
(
pTemp
=
pBuffer
;
*
pTemp
==
' '
||
*
pTemp
==
'\r'
||
*
pTemp
==
'\n'
;
pTemp
++
);
// skip comment lines and empty lines
if
(
*
pTemp
!=
0
&&
*
pTemp
!=
'#'
)
break
;
}
// set the gate number
pLibName
=
strtok
(
pTemp
,
"
\t\r\n
"
);
pGate
->
Num
=
Number
;
pLib
->
pGenlib
=
Abc_FrameReadLibGen
();
// if ( pLib->pGenlib == NULL || strcmp( , pLibName ) )
if
(
pLib
->
pGenlib
==
NULL
||
Map_LibraryCompareLibNames
(
Mio_LibraryReadName
(
pLib
->
pGenlib
),
pLibName
)
)
{
printf
(
"Supergate library
\"
%s
\"
requires the use of genlib library
\"
%s
\"
.
\n
"
,
pFileName
,
pLibName
);
return
0
;
}
// read the mark
// read the number of variables
pTemp
=
strtok
(
pBuffer
,
" "
);
RetValue
=
Vec_StrGets
(
pBuffer
,
5000
,
vStr
,
&
nPos
);
if
(
pTemp
[
0
]
==
'*'
)
if
(
RetValue
==
0
)
return
0
;
RetValue
=
sscanf
(
pBuffer
,
"%d
\n
"
,
&
pLib
->
nVarsMax
);
if
(
pLib
->
nVarsMax
<
2
||
pLib
->
nVarsMax
>
10
)
{
{
p
Gate
->
fSuper
=
1
;
p
rintf
(
"Suspicious number of variables (%d).
\n
"
,
pLib
->
nVarsMax
)
;
pTemp
=
strtok
(
NULL
,
" "
)
;
return
0
;
}
}
// read the root gate
// read the number of gates
pGate
->
pRoot
=
Mio_LibraryReadGateByName
(
pLib
->
pGenlib
,
pTemp
,
NULL
);
RetValue
=
Vec_StrGets
(
pBuffer
,
5000
,
vStr
,
&
nPos
);
if
(
pGate
->
pRoot
==
NULL
)
if
(
RetValue
==
0
)
return
0
;
RetValue
=
sscanf
(
pBuffer
,
"%d
\n
"
,
&
pLib
->
nSupersReal
);
if
(
pLib
->
nSupersReal
<
1
||
pLib
->
nSupersReal
>
10000000
)
{
{
printf
(
"
Cannot read the root gate names %s.
\n
"
,
pTemp
);
printf
(
"
Suspicious number of gates (%d).
\n
"
,
pLib
->
nSupersReal
);
return
NULL
;
return
0
;
}
}
// set the max number of fanouts
pGate
->
nFanLimit
=
s_MapFanoutLimits
[
Mio_GateReadPinNum
(
pGate
->
pRoot
)
];
// read the pin-to-pin delay
// read the number of lines
for
(
i
=
0
;
(
pTemp
=
strtok
(
NULL
,
"
\n\0
"
)
);
i
++
)
RetValue
=
Vec_StrGets
(
pBuffer
,
5000
,
vStr
,
&
nPos
);
if
(
RetValue
==
0
)
return
0
;
RetValue
=
sscanf
(
pBuffer
,
"%d
\n
"
,
&
pLib
->
nLines
);
if
(
pLib
->
nLines
<
1
||
pLib
->
nLines
>
10000000
)
{
{
if
(
pTemp
[
0
]
==
'#'
)
printf
(
"Suspicious number of lines (%d).
\n
"
,
pLib
->
nLines
);
break
;
return
0
;
if
(
i
==
nVarsMax
)
}
{
printf
(
"There are too many entries on the line.
\n
"
);
// allocate room for supergate pointers
return
NULL
;
pLib
->
ppSupers
=
ABC_ALLOC
(
Map_Super_t
*
,
pLib
->
nLines
+
10000
);
}
Num
=
atoi
(
pTemp
);
// create the elementary supergates
if
(
Num
<
0
)
for
(
i
=
0
;
i
<
pLib
->
nVarsMax
;
i
++
)
{
// get a new gate
pGate
=
(
Map_Super_t
*
)
Extra_MmFixedEntryFetch
(
pLib
->
mmSupers
);
memset
(
pGate
,
0
,
sizeof
(
Map_Super_t
)
);
// assign the elementary variable, the truth table, and the delays
pGate
->
Num
=
i
;
// set the truth table
pGate
->
uTruth
[
0
]
=
pLib
->
uTruths
[
i
][
0
];
pGate
->
uTruth
[
1
]
=
pLib
->
uTruths
[
i
][
1
];
// set the arrival times of all input to non-existent delay
for
(
k
=
0
;
k
<
pLib
->
nVarsMax
;
k
++
)
{
{
p
rintf
(
"The number of a child supergate is negative.
\n
"
)
;
p
Gate
->
tDelaysR
[
k
].
Rise
=
pGate
->
tDelaysR
[
k
].
Fall
=
MAP_NO_VAR
;
return
NULL
;
pGate
->
tDelaysF
[
k
].
Rise
=
pGate
->
tDelaysF
[
k
].
Fall
=
MAP_NO_VAR
;
}
}
if
(
Num
>
pLib
->
nLines
)
// set an existent arrival time for rise and fall
pGate
->
tDelaysR
[
i
].
Rise
=
0
.
0
;
pGate
->
tDelaysF
[
i
].
Fall
=
0
.
0
;
// set the gate
pLib
->
ppSupers
[
i
]
=
pGate
;
}
// read the lines
nCounter
=
pLib
->
nVarsMax
;
pProgress
=
Extra_ProgressBarStart
(
stdout
,
pLib
->
nLines
);
// while ( fgets( pBuffer, 5000, pFile ) != NULL )
while
(
Vec_StrGets
(
pBuffer
,
5000
,
vStr
,
&
nPos
)
)
{
for
(
pTemp
=
pBuffer
;
*
pTemp
==
' '
||
*
pTemp
==
'\r'
||
*
pTemp
==
'\n'
;
pTemp
++
);
if
(
pTemp
[
0
]
==
'\0'
)
continue
;
// if ( pTemp[0] == 'a' || pTemp[2] == 'a' )
// {
// pLib->nLines--;
// continue;
// }
// get the gate
pGate
=
Map_LibraryReadGateTree
(
pLib
,
pTemp
,
nCounter
,
pLib
->
nVarsMax
);
if
(
pGate
==
NULL
)
{
{
printf
(
"The number of a child supergate (%d) exceeded the number of lines (%d).
\n
"
,
Extra_ProgressBarStop
(
pProgress
);
Num
,
pLib
->
nLines
);
return
0
;
return
NULL
;
}
}
pGate
->
pFanins
[
i
]
=
pLib
->
ppSupers
[
Num
];
pLib
->
ppSupers
[
nCounter
++
]
=
pGate
;
// later we will derive: truth table, delays, area, number of component gates, etc
// update the progress bar
Extra_ProgressBarUpdate
(
pProgress
,
nCounter
,
NULL
);
}
}
pGate
->
nFanins
=
i
;
Extra_ProgressBarStop
(
pProgress
);
if
(
pGate
->
nFanins
!=
(
unsigned
)
Mio_GateReadPinNum
(
pGate
->
pRoot
)
)
if
(
nCounter
!=
pLib
->
nLines
)
printf
(
"The number of lines read (%d) is different from what the file says (%d).
\n
"
,
nCounter
,
pLib
->
nLines
);
pLib
->
nSupersAll
=
nCounter
;
// count the number of real supergates
nCounter
=
0
;
for
(
k
=
0
;
k
<
pLib
->
nLines
;
k
++
)
nCounter
+=
pLib
->
ppSupers
[
k
]
->
fSuper
;
if
(
nCounter
!=
pLib
->
nSupersReal
)
printf
(
"The number of gates read (%d) is different what the file says (%d).
\n
"
,
nCounter
,
pLib
->
nSupersReal
);
pLib
->
nSupersReal
=
nCounter
;
return
1
;
}
int
Map_LibraryReadTree
(
Map_SuperLib_t
*
pLib
,
char
*
pFileName
,
char
*
pExcludeFile
)
{
char
*
pBuffer
;
Vec_Str_t
*
vStr
;
int
Status
,
num
;
Abc_Frame_t
*
pAbc
;
st_table
*
tExcludeGate
=
0
;
// read the beginning of the file
assert
(
pLib
->
pGenlib
==
NULL
);
// pFile = Io_FileOpen( pFileName, "open_path", "r", 1 );
pBuffer
=
Mio_ReadFile
(
pFileName
,
0
);
if
(
pBuffer
==
NULL
)
{
{
printf
(
"
The number of fanins of a root gate is wrong.
\n
"
);
printf
(
"
Cannot open input file
\"
%s
\"
.
\n
"
,
pFileName
);
return
NULL
;
return
0
;
}
}
vStr
=
Vec_StrAllocArray
(
pBuffer
,
strlen
(
pBuffer
)
);
// save the gate name, just in case
if
(
pExcludeFile
)
if
(
pTemp
&&
pTemp
[
0
]
==
'#'
)
{
{
if
(
pTemp
[
1
]
==
0
)
pAbc
=
Abc_FrameGetGlobalFrame
();
pTemp
=
strtok
(
NULL
,
"
\n\0
"
);
else
// skip spaces
tExcludeGate
=
st_init_table
(
strcmp
,
st_strhash
);
for
(
pTemp
++
;
*
pTemp
==
' '
;
pTemp
++
);
if
(
(
num
=
Mio_LibraryReadExclude
(
pExcludeFile
,
tExcludeGate
))
==
-
1
)
// save the formula
{
pGate
->
pFormula
=
Extra_MmFlexEntryFetch
(
pLib
->
mmForms
,
strlen
(
pTemp
)
+
1
);
st_free_table
(
tExcludeGate
);
strcpy
(
pGate
->
pFormula
,
pTemp
);
tExcludeGate
=
0
;
Vec_StrFree
(
vStr
);
return
0
;
}
fprintf
(
Abc_FrameReadOut
(
pAbc
),
"Read %d gates from exclude file
\n
"
,
num
);
}
}
// check the rest of the string
pTemp
=
strtok
(
NULL
,
"
\n\0
"
);
Status
=
Map_LibraryReadFileTreeStr
(
pLib
,
vStr
,
pFileName
);
if
(
pTemp
!=
NULL
)
Vec_StrFree
(
vStr
);
printf
(
"The following trailing symbols found
\"
%s
\"
.
\n
"
,
pTemp
);
if
(
Status
==
0
)
return
pGate
;
return
0
;
// prepare the info about the library
return
Map_LibraryDeriveGateInfo
(
pLib
,
tExcludeGate
);
}
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Derives information about the library.]
Synopsis [Derives information about the library.]
...
...
src/map/mio/mio.c
View file @
e7527a47
...
@@ -40,7 +40,7 @@ static int Mio_CommandWriteGenlib( Abc_Frame_t * pAbc, int argc, char **argv );
...
@@ -40,7 +40,7 @@ static int Mio_CommandWriteGenlib( Abc_Frame_t * pAbc, int argc, char **argv );
static
int
Mio_CommandPrintGenlib
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Mio_CommandPrintGenlib
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
/*
/*
// internal version of
GENLIB
library
// internal version of
genlib
library
static char * pMcncGenlib[25] = {
static char * pMcncGenlib[25] = {
"GATE inv1 1 O=!a; PIN * INV 1 999 0.9 0.0 0.9 0.0\n",
"GATE inv1 1 O=!a; PIN * INV 1 999 0.9 0.0 0.9 0.0\n",
"GATE inv2 2 O=!a; PIN * INV 2 999 1.0 0.0 1.0 0.0\n",
"GATE inv2 2 O=!a; PIN * INV 2 999 1.0 0.0 1.0 0.0\n",
...
@@ -320,7 +320,7 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -320,7 +320,7 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
pLib
=
Mio_LibraryRead
(
pFileName
,
NULL
,
pExcludeFile
,
fVerbose
);
pLib
=
Mio_LibraryRead
(
pFileName
,
NULL
,
pExcludeFile
,
fVerbose
);
if
(
pLib
==
NULL
)
if
(
pLib
==
NULL
)
{
{
fprintf
(
pErr
,
"Reading
GENLIB
library has failed.
\n
"
);
fprintf
(
pErr
,
"Reading
genlib
library has failed.
\n
"
);
return
1
;
return
1
;
}
}
// add the fixed number (wire delay) to all delays in the library
// add the fixed number (wire delay) to all delays in the library
...
@@ -342,14 +342,14 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -342,14 +342,14 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
pLib
=
(
Mio_Library_t
*
)
Amap_LibReadAndPrepare
(
pFileName
,
NULL
,
0
,
0
);
pLib
=
(
Mio_Library_t
*
)
Amap_LibReadAndPrepare
(
pFileName
,
NULL
,
0
,
0
);
if
(
pLib
==
NULL
)
if
(
pLib
==
NULL
)
{
{
fprintf
(
pErr
,
"Reading
GENLIB
library has failed.
\n
"
);
fprintf
(
pErr
,
"Reading
genlib
library has failed.
\n
"
);
return
1
;
return
1
;
}
}
// replace the current library
// replace the current library
Amap_LibFree
(
(
Amap_Lib_t
*
)
Abc_FrameReadLibGen2
()
);
Amap_LibFree
(
(
Amap_Lib_t
*
)
Abc_FrameReadLibGen2
()
);
Abc_FrameSetLibGen2
(
pLib
);
Abc_FrameSetLibGen2
(
pLib
);
if
(
fVerbose
)
if
(
fVerbose
)
printf
(
"Entered
GENLIB
library with %d gates from file
\"
%s
\"
.
\n
"
,
Mio_LibraryReadGateNum
(
pLib
),
pFileName
);
printf
(
"Entered
genlib
library with %d gates from file
\"
%s
\"
.
\n
"
,
Mio_LibraryReadGateNum
(
pLib
),
pFileName
);
return
0
;
return
0
;
usage:
usage:
...
@@ -425,7 +425,7 @@ int Mio_CommandWriteGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -425,7 +425,7 @@ int Mio_CommandWriteGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
}
}
Mio_WriteLibrary
(
pFile
,
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
(),
0
);
Mio_WriteLibrary
(
pFile
,
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
(),
0
);
fclose
(
pFile
);
fclose
(
pFile
);
printf
(
"The current
GENLIB
library is written into file
\"
%s
\"
.
\n
"
,
pFileName
);
printf
(
"The current
genlib
library is written into file
\"
%s
\"
.
\n
"
,
pFileName
);
return
0
;
return
0
;
usage:
usage:
...
...
src/map/mio/mio.h
View file @
e7527a47
...
@@ -129,6 +129,7 @@ extern double Mio_PinReadDelayFanoutFall( Mio_Pin_t * pPin );
...
@@ -129,6 +129,7 @@ extern double Mio_PinReadDelayFanoutFall( Mio_Pin_t * pPin );
extern
double
Mio_PinReadDelayBlockMax
(
Mio_Pin_t
*
pPin
);
extern
double
Mio_PinReadDelayBlockMax
(
Mio_Pin_t
*
pPin
);
extern
Mio_Pin_t
*
Mio_PinReadNext
(
Mio_Pin_t
*
pPin
);
extern
Mio_Pin_t
*
Mio_PinReadNext
(
Mio_Pin_t
*
pPin
);
/*=== mioRead.c =============================================================*/
/*=== mioRead.c =============================================================*/
extern
char
*
Mio_ReadFile
(
char
*
FileName
,
int
fAddEnd
);
extern
Mio_Library_t
*
Mio_LibraryRead
(
char
*
FileName
,
char
*
pBuffer
,
char
*
ExcludeFile
,
int
fVerbose
);
extern
Mio_Library_t
*
Mio_LibraryRead
(
char
*
FileName
,
char
*
pBuffer
,
char
*
ExcludeFile
,
int
fVerbose
);
extern
int
Mio_LibraryReadExclude
(
char
*
ExcludeFile
,
st_table
*
tExcludeGate
);
extern
int
Mio_LibraryReadExclude
(
char
*
ExcludeFile
,
st_table
*
tExcludeGate
);
/*=== mioFunc.c =============================================================*/
/*=== mioFunc.c =============================================================*/
...
...
src/map/mio/mioRead.c
View file @
e7527a47
...
@@ -89,7 +89,7 @@ Mio_Library_t * Mio_LibraryRead( char * FileName, char * pBuffer, char * Exclude
...
@@ -89,7 +89,7 @@ Mio_Library_t * Mio_LibraryRead( char * FileName, char * pBuffer, char * Exclude
pLib
->
pName
=
Abc_UtilStrsav
(
Extra_FileNameGenericAppend
(
FileName
,
".genlib"
)
);
pLib
->
pName
=
Abc_UtilStrsav
(
Extra_FileNameGenericAppend
(
FileName
,
".genlib"
)
);
}
}
if
(
pLib
!=
NULL
)
if
(
pLib
!=
NULL
)
printf
(
"Warning: Read extended
GENLIB
format but ignoring extensions
\n
"
);
printf
(
"Warning: Read extended
genlib
format but ignoring extensions
\n
"
);
}
}
if
(
tExcludeGate
)
if
(
tExcludeGate
)
st_free_table
(
tExcludeGate
);
st_free_table
(
tExcludeGate
);
...
@@ -108,7 +108,7 @@ Mio_Library_t * Mio_LibraryRead( char * FileName, char * pBuffer, char * Exclude
...
@@ -108,7 +108,7 @@ Mio_Library_t * Mio_LibraryRead( char * FileName, char * pBuffer, char * Exclude
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
char
*
Mio_ReadFile
(
char
*
FileName
)
char
*
Mio_ReadFile
(
char
*
FileName
,
int
fAddEnd
)
{
{
char
*
pBuffer
;
char
*
pBuffer
;
FILE
*
pFile
;
FILE
*
pFile
;
...
@@ -131,7 +131,8 @@ char * Mio_ReadFile( char * FileName )
...
@@ -131,7 +131,8 @@ char * Mio_ReadFile( char * FileName )
RetValue
=
fread
(
pBuffer
,
nFileSize
,
1
,
pFile
);
RetValue
=
fread
(
pBuffer
,
nFileSize
,
1
,
pFile
);
// terminate the string with '\0'
// terminate the string with '\0'
pBuffer
[
nFileSize
]
=
'\0'
;
pBuffer
[
nFileSize
]
=
'\0'
;
strcat
(
pBuffer
,
"
\n
.end
\n
"
);
if
(
fAddEnd
)
strcat
(
pBuffer
,
"
\n
.end
\n
"
);
// close file
// close file
fclose
(
pFile
);
fclose
(
pFile
);
return
pBuffer
;
return
pBuffer
;
...
@@ -201,7 +202,7 @@ Mio_Library_t * Mio_LibraryReadOne( char * FileName, int fExtendedFormat, st_tab
...
@@ -201,7 +202,7 @@ Mio_Library_t * Mio_LibraryReadOne( char * FileName, int fExtendedFormat, st_tab
// pBuffer = Io_ReadFileFileContents( FileName, NULL );
// pBuffer = Io_ReadFileFileContents( FileName, NULL );
// we don't use above function but actually do the same thing explicitly
// we don't use above function but actually do the same thing explicitly
// to handle open_path expansion correctly
// to handle open_path expansion correctly
pBuffer
=
Mio_ReadFile
(
FileName
);
pBuffer
=
Mio_ReadFile
(
FileName
,
1
);
if
(
pBuffer
==
NULL
)
if
(
pBuffer
==
NULL
)
return
NULL
;
return
NULL
;
pLib
=
Mio_LibraryReadBuffer
(
pBuffer
,
fExtendedFormat
,
tExcludeGate
,
fVerbose
);
pLib
=
Mio_LibraryReadBuffer
(
pBuffer
,
fExtendedFormat
,
tExcludeGate
,
fVerbose
);
...
@@ -617,7 +618,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib )
...
@@ -617,7 +618,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib )
pLib
->
pGateBuf
=
Mio_GateCompare
(
pLib
->
pGateBuf
,
pGate
,
uFuncBuf
);
pLib
->
pGateBuf
=
Mio_GateCompare
(
pLib
->
pGateBuf
,
pGate
,
uFuncBuf
);
if
(
pLib
->
pGateBuf
==
NULL
)
if
(
pLib
->
pGateBuf
==
NULL
)
{
{
printf
(
"Warnings:
GENLIB
library reader cannot detect the buffer gate.
\n
"
);
printf
(
"Warnings:
genlib
library reader cannot detect the buffer gate.
\n
"
);
printf
(
"Some parts of the supergate-based technology mapper may not work correctly.
\n
"
);
printf
(
"Some parts of the supergate-based technology mapper may not work correctly.
\n
"
);
}
}
...
@@ -626,7 +627,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib )
...
@@ -626,7 +627,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib )
pLib
->
pGateInv
=
Mio_GateCompare
(
pLib
->
pGateInv
,
pGate
,
uFuncInv
);
pLib
->
pGateInv
=
Mio_GateCompare
(
pLib
->
pGateInv
,
pGate
,
uFuncInv
);
if
(
pLib
->
pGateInv
==
NULL
)
if
(
pLib
->
pGateInv
==
NULL
)
{
{
printf
(
"Warnings:
GENLIB
library reader cannot detect the invertor gate.
\n
"
);
printf
(
"Warnings:
genlib
library reader cannot detect the invertor gate.
\n
"
);
printf
(
"Some parts of the supergate-based technology mapper may not work correctly.
\n
"
);
printf
(
"Some parts of the supergate-based technology mapper may not work correctly.
\n
"
);
}
}
...
@@ -637,7 +638,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib )
...
@@ -637,7 +638,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib )
pLib
->
pGateAnd2
=
Mio_GateCompare
(
pLib
->
pGateAnd2
,
pGate
,
uFuncAnd2
);
pLib
->
pGateAnd2
=
Mio_GateCompare
(
pLib
->
pGateAnd2
,
pGate
,
uFuncAnd2
);
if
(
pLib
->
pGateAnd2
==
NULL
&&
pLib
->
pGateNand2
==
NULL
)
if
(
pLib
->
pGateAnd2
==
NULL
&&
pLib
->
pGateNand2
==
NULL
)
{
{
printf
(
"Warnings:
GENLIB
library reader cannot detect the AND2 or NAND2 gate.
\n
"
);
printf
(
"Warnings:
genlib
library reader cannot detect the AND2 or NAND2 gate.
\n
"
);
printf
(
"Some parts of the supergate-based technology mapper may not work correctly.
\n
"
);
printf
(
"Some parts of the supergate-based technology mapper may not work correctly.
\n
"
);
}
}
}
}
...
...
src/map/super/super.c
View file @
e7527a47
...
@@ -243,7 +243,7 @@ int Super_CommandSupergates( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -243,7 +243,7 @@ int Super_CommandSupergates( Abc_Frame_t * pAbc, int argc, char **argv )
if
(
argc
!=
globalUtilOptind
+
1
)
if
(
argc
!=
globalUtilOptind
+
1
)
{
{
fprintf
(
pErr
,
"The
GENLIB
library file should be given on the command line.
\n
"
);
fprintf
(
pErr
,
"The
genlib
library file should be given on the command line.
\n
"
);
goto
usage
;
goto
usage
;
}
}
...
@@ -275,7 +275,8 @@ int Super_CommandSupergates( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -275,7 +275,8 @@ int Super_CommandSupergates( Abc_Frame_t * pAbc, int argc, char **argv )
}
}
// compute the gates
// compute the gates
Super_Precompute
(
pLib
,
nVarsMax
,
nLevels
,
nGatesMax
,
DelayLimit
,
AreaLimit
,
TimeLimit
,
fSkipInvs
,
fWriteOldFormat
,
fVerbose
);
FileName
=
Extra_FileNameGenericAppend
(
Mio_LibraryReadName
(
pLib
),
".super"
);
Super_Precompute
(
pLib
,
nVarsMax
,
nLevels
,
nGatesMax
,
DelayLimit
,
AreaLimit
,
TimeLimit
,
fSkipInvs
,
fVerbose
,
FileName
);
// delete the library
// delete the library
Mio_LibraryDelete
(
pLib
);
Mio_LibraryDelete
(
pLib
);
...
@@ -283,7 +284,7 @@ int Super_CommandSupergates( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -283,7 +284,7 @@ int Super_CommandSupergates( Abc_Frame_t * pAbc, int argc, char **argv )
usage:
usage:
fprintf
(
pErr
,
"usage: super [-ILNT num] [-DA float] [-E file] [-sovh] <genlib_file>
\n
"
);
fprintf
(
pErr
,
"usage: super [-ILNT num] [-DA float] [-E file] [-sovh] <genlib_file>
\n
"
);
fprintf
(
pErr
,
"
\t
precomputes the supergates for the given
GENLIB
library
\n
"
);
fprintf
(
pErr
,
"
\t
precomputes the supergates for the given
genlib
library
\n
"
);
fprintf
(
pErr
,
"
\t
-I num : the max number of supergate inputs [default = %d]
\n
"
,
nVarsMax
);
fprintf
(
pErr
,
"
\t
-I num : the max number of supergate inputs [default = %d]
\n
"
,
nVarsMax
);
fprintf
(
pErr
,
"
\t
-L num : the max number of levels of gates [default = %d]
\n
"
,
nLevels
);
fprintf
(
pErr
,
"
\t
-L num : the max number of levels of gates [default = %d]
\n
"
,
nLevels
);
fprintf
(
pErr
,
"
\t
-N num : the limit on the number of considered supergates [default = %d]
\n
"
,
nGatesMax
);
fprintf
(
pErr
,
"
\t
-N num : the limit on the number of considered supergates [default = %d]
\n
"
,
nGatesMax
);
...
...
src/map/super/super.h
View file @
e7527a47
...
@@ -28,11 +28,8 @@
...
@@ -28,11 +28,8 @@
/// PARAMETERS ///
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_START
ABC_NAMESPACE_HEADER_START
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// STRUCTURE DEFINITIONS ///
/// STRUCTURE DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -49,14 +46,15 @@ ABC_NAMESPACE_HEADER_START
...
@@ -49,14 +46,15 @@ ABC_NAMESPACE_HEADER_START
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/*=== superCore.c =============================================================*/
/*=== superAnd.c =============================================================*/
extern
void
Super2_Precompute
(
int
nInputs
,
int
nLevels
,
int
fVerbose
);
/*=== superGate.c =============================================================*/
extern
Vec_Str_t
*
Super_PrecomputeStr
(
Mio_Library_t
*
pLibGen
,
int
nVarsMax
,
int
nLevels
,
int
nGatesMax
,
float
tDelayMax
,
float
tAreaMax
,
int
TimeLimit
,
int
fSkipInv
,
int
fVerbose
);
extern
void
Super_Precompute
(
Mio_Library_t
*
pLibGen
,
int
nVarsMax
,
int
nLevels
,
int
nGatesMax
,
float
tDelayMax
,
float
tAreaMax
,
int
TimeLimit
,
int
fSkipInv
,
int
fVerbose
,
char
*
pFileName
);
ABC_NAMESPACE_HEADER_END
ABC_NAMESPACE_HEADER_END
#endif
#endif
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
src/map/super/superGate.c
View file @
e7527a47
...
@@ -113,17 +113,14 @@ static int Super_AreaCompare( Super_Gate_t ** ppG1, Super_Gate_t ** p
...
@@ -113,17 +113,14 @@ static int Super_AreaCompare( Super_Gate_t ** ppG1, Super_Gate_t ** p
static
void
Super_TranferGatesToArray
(
Super_Man_t
*
pMan
);
static
void
Super_TranferGatesToArray
(
Super_Man_t
*
pMan
);
static
int
Super_CheckTimeout
(
ProgressBar
*
pPro
,
Super_Man_t
*
pMan
);
static
int
Super_CheckTimeout
(
ProgressBar
*
pPro
,
Super_Man_t
*
pMan
);
static
void
Super_Write
(
Super_Man_t
*
pMan
);
static
Vec_Str_t
*
Super_Write
(
Super_Man_t
*
pMan
);
static
int
Super_WriteCompare
(
Super_Gate_t
**
ppG1
,
Super_Gate_t
**
ppG2
);
static
int
Super_WriteCompare
(
Super_Gate_t
**
ppG1
,
Super_Gate_t
**
ppG2
);
static
void
Super_WriteFileHeader
(
Super_Man_t
*
pMan
,
FILE
*
pFile
);
static
void
Super_WriteFileHeader
(
Super_Man_t
*
pMan
,
FILE
*
pFile
);
static
void
Super_WriteLibrary
(
Super_Man_t
*
pMan
);
static
void
Super_WriteLibrary
(
Super_Man_t
*
pMan
);
static
void
Super_WriteLibraryGate
(
FILE
*
pFile
,
Super_Man_t
*
pMan
,
Super_Gate_t
*
pGate
,
int
Num
);
static
char
*
Super_WriteLibraryGateName
(
Super_Gate_t
*
pGate
);
static
void
Super_WriteLibraryGateName_rec
(
Super_Gate_t
*
pGate
,
char
*
pBuffer
);
static
void
Super_WriteLibraryTree
(
Super_Man_t
*
pMan
);
static
void
Super_WriteLibraryTree
File
(
Super_Man_t
*
pMan
);
static
void
Super_WriteLibraryTree_rec
(
FILE
*
pFile
,
Super_Man_t
*
pMan
,
Super_Gate_t
*
pSuper
,
int
*
pCounter
);
static
Vec_Str_t
*
Super_WriteLibraryTreeStr
(
Super_Man_t
*
pMan
);
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
...
@@ -140,8 +137,41 @@ static void Super_WriteLibraryTree_rec( FILE * pFile, Super_Man_t * pM
...
@@ -140,8 +137,41 @@ static void Super_WriteLibraryTree_rec( FILE * pFile, Super_Man_t * pM
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Super_Precompute
(
Mio_Library_t
*
pLibGen
,
int
nVarsMax
,
int
nLevels
,
int
nGatesMax
,
float
tDelayMax
,
float
tAreaMax
,
int
TimeLimit
,
int
fSkipInv
,
int
f
WriteOldFormat
,
int
fVerbos
e
)
void
Super_Precompute
(
Mio_Library_t
*
pLibGen
,
int
nVarsMax
,
int
nLevels
,
int
nGatesMax
,
float
tDelayMax
,
float
tAreaMax
,
int
TimeLimit
,
int
fSkipInv
,
int
f
Verbose
,
char
*
pFileNam
e
)
{
{
Vec_Str_t
*
vStr
;
FILE
*
pFile
=
fopen
(
pFileName
,
"wb"
);
if
(
pFile
==
NULL
)
{
printf
(
"Cannot open output file
\"
%s
\"
.
\n
"
,
pFileName
);
return
;
}
vStr
=
Super_PrecomputeStr
(
pLibGen
,
nVarsMax
,
nLevels
,
nGatesMax
,
tDelayMax
,
tAreaMax
,
TimeLimit
,
fSkipInv
,
fVerbose
);
fwrite
(
Vec_StrArray
(
vStr
),
1
,
Vec_StrSize
(
vStr
),
pFile
);
fclose
(
pFile
);
Vec_StrFree
(
vStr
);
// report the result of writing
if
(
fVerbose
)
{
printf
(
"The supergates are written using new format
\"
%s
\"
"
,
pFileName
);
printf
(
"(%0.3f MB).
\n
"
,
((
double
)
Extra_FileSize
(
pFileName
))
/
(
1
<<
20
)
);
}
}
/**Function*************************************************************
Synopsis [Precomputes the library of supergates.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Str_t
*
Super_PrecomputeStr
(
Mio_Library_t
*
pLibGen
,
int
nVarsMax
,
int
nLevels
,
int
nGatesMax
,
float
tDelayMax
,
float
tAreaMax
,
int
TimeLimit
,
int
fSkipInv
,
int
fVerbose
)
{
Vec_Str_t
*
vStr
;
Super_Man_t
*
pMan
;
Super_Man_t
*
pMan
;
Mio_Gate_t
**
ppGates
;
Mio_Gate_t
**
ppGates
;
int
nGates
,
Level
;
int
nGates
,
Level
;
...
@@ -152,7 +182,7 @@ void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, int n
...
@@ -152,7 +182,7 @@ void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, int n
{
{
fprintf
(
stderr
,
"Erro! The number of supergates requested (%d) in less than the number of variables (%d).
\n
"
,
nGatesMax
,
nVarsMax
);
fprintf
(
stderr
,
"Erro! The number of supergates requested (%d) in less than the number of variables (%d).
\n
"
,
nGatesMax
,
nVarsMax
);
fprintf
(
stderr
,
"The library cannot be computed.
\n
"
);
fprintf
(
stderr
,
"The library cannot be computed.
\n
"
);
return
;
return
NULL
;
}
}
// get the root gates
// get the root gates
...
@@ -173,7 +203,6 @@ void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, int n
...
@@ -173,7 +203,6 @@ void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, int n
pMan
->
TimeLimit
=
TimeLimit
;
// in seconds
pMan
->
TimeLimit
=
TimeLimit
;
// in seconds
pMan
->
TimeStop
=
TimeLimit
*
CLOCKS_PER_SEC
+
clock
();
// in CPU ticks
pMan
->
TimeStop
=
TimeLimit
*
CLOCKS_PER_SEC
+
clock
();
// in CPU ticks
pMan
->
fVerbose
=
fVerbose
;
pMan
->
fVerbose
=
fVerbose
;
pMan
->
fWriteOldFormat
=
fWriteOldFormat
;
if
(
nGates
==
0
)
if
(
nGates
==
0
)
{
{
...
@@ -185,7 +214,7 @@ void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, int n
...
@@ -185,7 +214,7 @@ void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, int n
Super_ManStop
(
pMan
);
Super_ManStop
(
pMan
);
ABC_FREE
(
ppGates
);
ABC_FREE
(
ppGates
);
return
;
return
NULL
;
}
}
// get the starting supergates
// get the starting supergates
...
@@ -224,11 +253,12 @@ printf( "Writing the output file...\n" );
...
@@ -224,11 +253,12 @@ printf( "Writing the output file...\n" );
fflush
(
stdout
);
fflush
(
stdout
);
}
}
// write them into a file
// write them into a file
Super_Write
(
pMan
);
vStr
=
Super_Write
(
pMan
);
// stop the manager
// stop the manager
Super_ManStop
(
pMan
);
Super_ManStop
(
pMan
);
ABC_FREE
(
ppGates
);
ABC_FREE
(
ppGates
);
return
vStr
;
}
}
...
@@ -299,7 +329,7 @@ void Super_First( Super_Man_t * pMan, int nVarsMax )
...
@@ -299,7 +329,7 @@ void Super_First( Super_Man_t * pMan, int nVarsMax )
Synopsis [Precomputes one level of supergates.]
Synopsis [Precomputes one level of supergates.]
Description [This procedure computes the set of supergates that can be
Description [This procedure computes the set of supergates that can be
derived from the given set of root gates (from
GENLIB
library) by composing
derived from the given set of root gates (from
genlib
library) by composing
the root gates with the currently available supergates. This procedure is
the root gates with the currently available supergates. This procedure is
smart in the sense that it tries to avoid useless emuration by imposing
smart in the sense that it tries to avoid useless emuration by imposing
tight bounds by area and delay. Only the supergates and are guaranteed to
tight bounds by area and delay. Only the supergates and are guaranteed to
...
@@ -946,8 +976,9 @@ void Super_ManStop( Super_Man_t * pMan )
...
@@ -946,8 +976,9 @@ void Super_ManStop( Super_Man_t * pMan )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Super_Write
(
Super_Man_t
*
pMan
)
Vec_Str_t
*
Super_Write
(
Super_Man_t
*
pMan
)
{
{
Vec_Str_t
*
vStr
;
Super_Gate_t
*
pGateRoot
,
*
pGate
;
Super_Gate_t
*
pGateRoot
,
*
pGate
;
stmm_generator
*
gen
;
stmm_generator
*
gen
;
int
fZeroFound
,
v
;
int
fZeroFound
,
v
;
...
@@ -957,7 +988,7 @@ void Super_Write( Super_Man_t * pMan )
...
@@ -957,7 +988,7 @@ void Super_Write( Super_Man_t * pMan )
if
(
pMan
->
nGates
<
1
)
if
(
pMan
->
nGates
<
1
)
{
{
printf
(
"The generated library is empty. No output file written.
\n
"
);
printf
(
"The generated library is empty. No output file written.
\n
"
);
return
;
return
NULL
;
}
}
// Filters the supergates by removing those that have fewer inputs than
// Filters the supergates by removing those that have fewer inputs than
...
@@ -1010,11 +1041,12 @@ ABC_PRT( "Writing old format", clock() - clk );
...
@@ -1010,11 +1041,12 @@ ABC_PRT( "Writing old format", clock() - clk );
// write the tree-like structure of supergates
// write the tree-like structure of supergates
clk
=
clock
();
clk
=
clock
();
Super_WriteLibraryTree
(
pMan
);
vStr
=
Super_WriteLibraryTreeStr
(
pMan
);
if
(
pMan
->
fVerbose
)
if
(
pMan
->
fVerbose
)
{
{
ABC_PRT
(
"Writing new format"
,
clock
()
-
clk
);
ABC_PRT
(
"Writing new format"
,
clock
()
-
clk
);
}
}
return
vStr
;
}
}
...
@@ -1054,10 +1086,57 @@ void Super_WriteFileHeader( Super_Man_t * pMan, FILE * pFile )
...
@@ -1054,10 +1086,57 @@ void Super_WriteFileHeader( Super_Man_t * pMan, FILE * pFile )
fprintf
(
pFile
,
"%d
\n
"
,
pMan
->
nVarsMax
);
fprintf
(
pFile
,
"%d
\n
"
,
pMan
->
nVarsMax
);
fprintf
(
pFile
,
"%d
\n
"
,
pMan
->
nGates
);
fprintf
(
pFile
,
"%d
\n
"
,
pMan
->
nGates
);
}
}
void
Super_WriteFileHeaderStr
(
Super_Man_t
*
pMan
,
Vec_Str_t
*
vStr
)
{
char
pBuffer
[
1000
];
sprintf
(
pBuffer
,
"#
\n
"
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# Supergate library derived for
\"
%s
\"
on %s.
\n
"
,
pMan
->
pName
,
Extra_TimeStamp
()
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"#
\n
"
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# Command line:
\"
super -I %d -L %d -N %d -T %d -D %.2f -A %.2f %s %s
\"
.
\n
"
,
pMan
->
nVarsMax
,
pMan
->
nLevels
,
pMan
->
nGatesMax
,
pMan
->
TimeLimit
,
pMan
->
tDelayMax
,
pMan
->
tAreaMax
,
(
pMan
->
fSkipInv
?
""
:
"-s"
),
pMan
->
pName
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"#
\n
"
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The number of inputs = %10d.
\n
"
,
pMan
->
nVarsMax
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The number of levels = %10d.
\n
"
,
pMan
->
nLevels
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The maximum delay = %10.2f.
\n
"
,
pMan
->
tDelayMax
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The maximum area = %10.2f.
\n
"
,
pMan
->
tAreaMax
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The maximum runtime (sec) = %10d.
\n
"
,
pMan
->
TimeLimit
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"#
\n
"
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The number of attempts = %10d.
\n
"
,
pMan
->
nTried
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The number of supergates = %10d.
\n
"
,
pMan
->
nGates
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The number of functions = %10d.
\n
"
,
pMan
->
nUnique
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# The total functions = %.0f (2^%d).
\n
"
,
pow
((
double
)
2
,
pMan
->
nMints
),
pMan
->
nMints
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"#
\n
"
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"# Generation time = %10.2f sec.
\n
"
,
(
float
)(
pMan
->
Time
)
/
(
float
)(
CLOCKS_PER_SEC
)
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"#
\n
"
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"%s
\n
"
,
pMan
->
pName
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"%d
\n
"
,
pMan
->
nVarsMax
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
sprintf
(
pBuffer
,
"%d
\n
"
,
pMan
->
nGates
);
Vec_StrPrintStr
(
vStr
,
pBuffer
);
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Compares t
he truth tables of t
wo gates.]
Synopsis [Compares two gates.]
Description []
Description []
...
@@ -1080,18 +1159,6 @@ int Super_WriteCompare( Super_Gate_t ** ppG1, Super_Gate_t ** ppG2 )
...
@@ -1080,18 +1159,6 @@ int Super_WriteCompare( Super_Gate_t ** ppG1, Super_Gate_t ** ppG2 )
return
1
;
return
1
;
return
0
;
return
0
;
}
}
/**Function*************************************************************
Synopsis [Compares the max delay of two gates.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Super_DelayCompare
(
Super_Gate_t
**
ppG1
,
Super_Gate_t
**
ppG2
)
int
Super_DelayCompare
(
Super_Gate_t
**
ppG1
,
Super_Gate_t
**
ppG2
)
{
{
if
(
(
*
ppG1
)
->
tDelayMax
<
(
*
ppG2
)
->
tDelayMax
)
if
(
(
*
ppG1
)
->
tDelayMax
<
(
*
ppG2
)
->
tDelayMax
)
...
@@ -1100,18 +1167,6 @@ int Super_DelayCompare( Super_Gate_t ** ppG1, Super_Gate_t ** ppG2 )
...
@@ -1100,18 +1167,6 @@ int Super_DelayCompare( Super_Gate_t ** ppG1, Super_Gate_t ** ppG2 )
return
1
;
return
1
;
return
0
;
return
0
;
}
}
/**Function*************************************************************
Synopsis [Compares the area of two gates.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Super_AreaCompare
(
Super_Gate_t
**
ppG1
,
Super_Gate_t
**
ppG2
)
int
Super_AreaCompare
(
Super_Gate_t
**
ppG1
,
Super_Gate_t
**
ppG2
)
{
{
if
(
(
*
ppG1
)
->
Area
<
(
*
ppG2
)
->
Area
)
if
(
(
*
ppG1
)
->
Area
<
(
*
ppG2
)
->
Area
)
...
@@ -1137,6 +1192,48 @@ int Super_AreaCompare( Super_Gate_t ** ppG1, Super_Gate_t ** ppG2 )
...
@@ -1137,6 +1192,48 @@ int Super_AreaCompare( Super_Gate_t ** ppG1, Super_Gate_t ** ppG2 )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Super_WriteLibraryGateName_rec
(
Super_Gate_t
*
pGate
,
char
*
pBuffer
)
{
char
Buffer
[
10
];
int
i
;
if
(
pGate
->
pRoot
==
NULL
)
{
sprintf
(
Buffer
,
"%c"
,
'a'
+
pGate
->
Number
);
strcat
(
pBuffer
,
Buffer
);
return
;
}
strcat
(
pBuffer
,
Mio_GateReadName
(
pGate
->
pRoot
)
);
strcat
(
pBuffer
,
"("
);
for
(
i
=
0
;
i
<
(
int
)
pGate
->
nFanins
;
i
++
)
{
if
(
i
)
strcat
(
pBuffer
,
","
);
Super_WriteLibraryGateName_rec
(
pGate
->
pFanins
[
i
],
pBuffer
);
}
strcat
(
pBuffer
,
")"
);
}
char
*
Super_WriteLibraryGateName
(
Super_Gate_t
*
pGate
)
{
static
char
Buffer
[
2000
];
Buffer
[
0
]
=
0
;
Super_WriteLibraryGateName_rec
(
pGate
,
Buffer
);
return
Buffer
;
}
void
Super_WriteLibraryGate
(
FILE
*
pFile
,
Super_Man_t
*
pMan
,
Super_Gate_t
*
pGate
,
int
Num
)
{
int
i
;
fprintf
(
pFile
,
"%04d "
,
Num
);
// the number
Extra_PrintBinary
(
pFile
,
pGate
->
uTruth
,
pMan
->
nMints
);
// the truth table
fprintf
(
pFile
,
" %5.2f"
,
pGate
->
tDelayMax
);
// the max delay
fprintf
(
pFile
,
" "
);
for
(
i
=
0
;
i
<
pMan
->
nVarsMax
;
i
++
)
// the pin-to-pin delays
fprintf
(
pFile
,
" %5.2f"
,
pGate
->
ptDelays
[
i
]
==
SUPER_NO_VAR
?
0
.
0
:
pGate
->
ptDelays
[
i
]
);
fprintf
(
pFile
,
" %5.2f"
,
pGate
->
Area
);
// the area
fprintf
(
pFile
,
" "
);
fprintf
(
pFile
,
"%s"
,
Super_WriteLibraryGateName
(
pGate
)
);
// the symbolic expression
fprintf
(
pFile
,
"
\n
"
);
}
void
Super_WriteLibrary
(
Super_Man_t
*
pMan
)
void
Super_WriteLibrary
(
Super_Man_t
*
pMan
)
{
{
Super_Gate_t
*
pGate
,
*
pGateNext
;
Super_Gate_t
*
pGate
,
*
pGateNext
;
...
@@ -1183,63 +1280,21 @@ void Super_WriteLibrary( Super_Man_t * pMan )
...
@@ -1183,63 +1280,21 @@ void Super_WriteLibrary( Super_Man_t * pMan )
assert
(
Counter
==
pMan
->
nGates
);
assert
(
Counter
==
pMan
->
nGates
);
fclose
(
pFile
);
fclose
(
pFile
);
if
(
pMan
->
fVerbose
)
if
(
pMan
->
fVerbose
)
{
{
printf
(
"The supergates are written using old format
\"
%s
\"
"
,
FileName
);
printf
(
"The supergates are written using old format
\"
%s
\"
"
,
FileName
);
printf
(
"(%0.3f MB).
\n
"
,
((
double
)
Extra_FileSize
(
FileName
))
/
(
1
<<
20
)
);
printf
(
"(%0.3f MB).
\n
"
,
((
double
)
Extra_FileSize
(
FileName
))
/
(
1
<<
20
)
);
}
}
ABC_FREE
(
FileName
);
ABC_FREE
(
FileName
);
}
}
/**Function*************************************************************
Synopsis [Writes the supergate into the file.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Super_WriteLibraryGate
(
FILE
*
pFile
,
Super_Man_t
*
pMan
,
Super_Gate_t
*
pGate
,
int
Num
)
{
int
i
;
fprintf
(
pFile
,
"%04d "
,
Num
);
// the number
Extra_PrintBinary
(
pFile
,
pGate
->
uTruth
,
pMan
->
nMints
);
// the truth table
fprintf
(
pFile
,
" %5.2f"
,
pGate
->
tDelayMax
);
// the max delay
fprintf
(
pFile
,
" "
);
for
(
i
=
0
;
i
<
pMan
->
nVarsMax
;
i
++
)
// the pin-to-pin delays
fprintf
(
pFile
,
" %5.2f"
,
pGate
->
ptDelays
[
i
]
==
SUPER_NO_VAR
?
0
.
0
:
pGate
->
ptDelays
[
i
]
);
fprintf
(
pFile
,
" %5.2f"
,
pGate
->
Area
);
// the area
fprintf
(
pFile
,
" "
);
fprintf
(
pFile
,
"%s"
,
Super_WriteLibraryGateName
(
pGate
)
);
// the symbolic expression
fprintf
(
pFile
,
"
\n
"
);
}
/**Function*************************************************************
Synopsis [Recursively generates symbolic name of the supergate.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
char
*
Super_WriteLibraryGateName
(
Super_Gate_t
*
pGate
)
{
static
char
Buffer
[
2000
];
Buffer
[
0
]
=
0
;
Super_WriteLibraryGateName_rec
(
pGate
,
Buffer
);
return
Buffer
;
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Recursively
generates symbolic name of the supergate
.]
Synopsis [Recursively
writes the gates
.]
Description []
Description []
...
@@ -1248,44 +1303,30 @@ char * Super_WriteLibraryGateName( Super_Gate_t * pGate )
...
@@ -1248,44 +1303,30 @@ char * Super_WriteLibraryGateName( Super_Gate_t * pGate )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Super_WriteLibrary
GateName_rec
(
Super_Gate_t
*
pGate
,
char
*
pBuff
er
)
void
Super_WriteLibrary
TreeFile_rec
(
FILE
*
pFile
,
Super_Man_t
*
pMan
,
Super_Gate_t
*
pSuper
,
int
*
pCount
er
)
{
{
char
Buffer
[
10
];
int
nFanins
,
i
;
int
i
;
// skip an elementary variable and a gate that was already written
if
(
pSuper
->
fVar
||
pSuper
->
Number
>
0
)
if
(
pGate
->
pRoot
==
NULL
)
{
sprintf
(
Buffer
,
"%c"
,
'a'
+
pGate
->
Number
);
strcat
(
pBuffer
,
Buffer
);
return
;
return
;
}
// write the fanins
strcat
(
pBuffer
,
Mio_GateReadName
(
pGate
->
pRoot
)
);
nFanins
=
Mio_GateReadPinNum
(
pSuper
->
pRoot
);
strcat
(
pBuffer
,
"("
);
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
pGate
->
nFanins
;
i
++
)
Super_WriteLibraryTreeFile_rec
(
pFile
,
pMan
,
pSuper
->
pFanins
[
i
],
pCounter
);
{
// finally write the gate
if
(
i
)
pSuper
->
Number
=
(
*
pCounter
)
++
;
strcat
(
pBuffer
,
","
);
fprintf
(
pFile
,
"%s"
,
pSuper
->
fSuper
?
"* "
:
""
);
Super_WriteLibraryGateName_rec
(
pGate
->
pFanins
[
i
],
pBuffer
);
fprintf
(
pFile
,
"%s"
,
Mio_GateReadName
(
pSuper
->
pRoot
)
);
}
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
strcat
(
pBuffer
,
")"
);
fprintf
(
pFile
,
" %d"
,
pSuper
->
pFanins
[
i
]
->
Number
);
// write the formula
// this step is optional, the resulting library will work in any case
// however, it may be helpful to for debugging to compare the same library
// written in the old format and written in the new format with formulas
// fprintf( pFile, " # %s", Super_WriteLibraryGateName( pSuper ) );
fprintf
(
pFile
,
"
\n
"
);
}
}
void
Super_WriteLibraryTreeFile
(
Super_Man_t
*
pMan
)
/**Function*************************************************************
Synopsis [Recursively writes the gates.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Super_WriteLibraryTree
(
Super_Man_t
*
pMan
)
{
{
Super_Gate_t
*
pSuper
;
Super_Gate_t
*
pSuper
;
FILE
*
pFile
;
FILE
*
pFile
;
...
@@ -1302,7 +1343,7 @@ void Super_WriteLibraryTree( Super_Man_t * pMan )
...
@@ -1302,7 +1343,7 @@ void Super_WriteLibraryTree( Super_Man_t * pMan )
ABC_FREE
(
pNameGeneric
);
ABC_FREE
(
pNameGeneric
);
// write the elementary variables
// write the elementary variables
pFile
=
fopen
(
FileName
,
"w"
);
pFile
=
fopen
(
FileName
,
"w
b
"
);
Super_WriteFileHeader
(
pMan
,
pFile
);
Super_WriteFileHeader
(
pMan
,
pFile
);
// write the place holder for the number of lines
// write the place holder for the number of lines
posStart
=
ftell
(
pFile
);
posStart
=
ftell
(
pFile
);
...
@@ -1313,7 +1354,7 @@ void Super_WriteLibraryTree( Super_Man_t * pMan )
...
@@ -1313,7 +1354,7 @@ void Super_WriteLibraryTree( Super_Man_t * pMan )
// write the supergates
// write the supergates
Counter
=
pMan
->
nVarsMax
;
Counter
=
pMan
->
nVarsMax
;
Super_ManForEachGate
(
pMan
->
pGates
,
pMan
->
nGates
,
i
,
pSuper
)
Super_ManForEachGate
(
pMan
->
pGates
,
pMan
->
nGates
,
i
,
pSuper
)
Super_WriteLibraryTree_rec
(
pFile
,
pMan
,
pSuper
,
&
Counter
);
Super_WriteLibraryTree
File
_rec
(
pFile
,
pMan
,
pSuper
,
&
Counter
);
fclose
(
pFile
);
fclose
(
pFile
);
// write the number of lines
// write the number of lines
pFile
=
fopen
(
FileName
,
"rb+"
);
pFile
=
fopen
(
FileName
,
"rb+"
);
...
@@ -1330,9 +1371,10 @@ if ( pMan->fVerbose )
...
@@ -1330,9 +1371,10 @@ if ( pMan->fVerbose )
ABC_FREE
(
FileName
);
ABC_FREE
(
FileName
);
}
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Recursively writes the gate.]
Synopsis [Recursively writes the gate
s
.]
Description []
Description []
...
@@ -1341,7 +1383,7 @@ if ( pMan->fVerbose )
...
@@ -1341,7 +1383,7 @@ if ( pMan->fVerbose )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Super_WriteLibraryTree
_rec
(
FILE
*
pFile
,
Super_Man_t
*
pMan
,
Super_Gate_t
*
pSuper
,
int
*
pCounter
)
void
Super_WriteLibraryTree
Str_rec
(
Vec_Str_t
*
vStr
,
Super_Man_t
*
pMan
,
Super_Gate_t
*
pSuper
,
int
*
pCounter
)
{
{
int
nFanins
,
i
;
int
nFanins
,
i
;
// skip an elementary variable and a gate that was already written
// skip an elementary variable and a gate that was already written
...
@@ -1350,21 +1392,78 @@ void Super_WriteLibraryTree_rec( FILE * pFile, Super_Man_t * pMan, Super_Gate_t
...
@@ -1350,21 +1392,78 @@ void Super_WriteLibraryTree_rec( FILE * pFile, Super_Man_t * pMan, Super_Gate_t
// write the fanins
// write the fanins
nFanins
=
Mio_GateReadPinNum
(
pSuper
->
pRoot
);
nFanins
=
Mio_GateReadPinNum
(
pSuper
->
pRoot
);
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
Super_WriteLibraryTree
_rec
(
pFile
,
pMan
,
pSuper
->
pFanins
[
i
],
pCounter
);
Super_WriteLibraryTree
Str_rec
(
vStr
,
pMan
,
pSuper
->
pFanins
[
i
],
pCounter
);
// finally write the gate
// finally write the gate
pSuper
->
Number
=
(
*
pCounter
)
++
;
pSuper
->
Number
=
(
*
pCounter
)
++
;
fprintf
(
pFile
,
"%s"
,
pSuper
->
fSuper
?
"* "
:
""
);
// fprintf( pFile, "%s", pSuper->fSuper? "* " : "" );
fprintf
(
pFile
,
"%s"
,
Mio_GateReadName
(
pSuper
->
pRoot
)
);
// fprintf( pFile, "%s", Mio_GateReadName(pSuper->pRoot) );
// for ( i = 0; i < nFanins; i++ )
// fprintf( pFile, " %d", pSuper->pFanins[i]->Number );
Vec_StrPrintStr
(
vStr
,
pSuper
->
fSuper
?
"* "
:
""
);
Vec_StrPrintStr
(
vStr
,
Mio_GateReadName
(
pSuper
->
pRoot
)
);
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
fprintf
(
pFile
,
" %d"
,
pSuper
->
pFanins
[
i
]
->
Number
);
{
Vec_StrPrintStr
(
vStr
,
" "
);
Vec_StrPrintNum
(
vStr
,
pSuper
->
pFanins
[
i
]
->
Number
);
}
// write the formula
// write the formula
// this step is optional, the resulting library will work in any case
// this step is optional, the resulting library will work in any case
// however, it may be helpful to for debugging to compare the same library
// however, it may be helpful to for debugging to compare the same library
// written in the old format and written in the new format with formulas
// written in the old format and written in the new format with formulas
// fprintf( pFile, " # %s", Super_WriteLibraryGateName( pSuper ) );
// fprintf( pFile, " # %s", Super_WriteLibraryGateName( pSuper ) );
fprintf
(
pFile
,
"
\n
"
);
// fprintf( pFile, "\n" );
Vec_StrPrintStr
(
vStr
,
"
\n
"
);
}
Vec_Str_t
*
Super_WriteLibraryTreeStr
(
Super_Man_t
*
pMan
)
{
char
pInsert
[
16
];
Vec_Str_t
*
vStr
;
Super_Gate_t
*
pSuper
;
int
i
,
Counter
;
int
posStart
;
// write the elementary variables
vStr
=
Vec_StrAlloc
(
1000
);
Super_WriteFileHeaderStr
(
pMan
,
vStr
);
// write the place holder for the number of lines
posStart
=
Vec_StrSize
(
vStr
);
for
(
i
=
0
;
i
<
9
;
i
++
)
Vec_StrPush
(
vStr
,
' '
);
Vec_StrPush
(
vStr
,
'\n'
);
// mark the real supergates
Super_ManForEachGate
(
pMan
->
pGates
,
pMan
->
nGates
,
i
,
pSuper
)
pSuper
->
fSuper
=
1
;
// write the supergates
Counter
=
pMan
->
nVarsMax
;
Super_ManForEachGate
(
pMan
->
pGates
,
pMan
->
nGates
,
i
,
pSuper
)
Super_WriteLibraryTreeStr_rec
(
vStr
,
pMan
,
pSuper
,
&
Counter
);
Vec_StrPush
(
vStr
,
0
);
// write the number of lines
sprintf
(
pInsert
,
"%d"
,
Counter
);
for
(
i
=
0
;
i
<
(
int
)
strlen
(
pInsert
);
i
++
)
Vec_StrWriteEntry
(
vStr
,
posStart
+
i
,
pInsert
[
i
]
);
return
vStr
;
}
void
Super_WriteLibraryTree
(
Super_Man_t
*
pMan
)
{
Vec_Str_t
*
vStr
;
char
*
pFileName
=
Extra_FileNameGenericAppend
(
pMan
->
pName
,
".super"
);
FILE
*
pFile
=
fopen
(
pFileName
,
"wb"
);
if
(
pFile
==
NULL
)
{
printf
(
"Cannot open output file
\"
%s
\"
.
\n
"
,
pFileName
);
return
;
}
vStr
=
Super_WriteLibraryTreeStr
(
pMan
);
fwrite
(
Vec_StrArray
(
vStr
),
1
,
Vec_StrSize
(
vStr
),
pFile
);
fclose
(
pFile
);
Vec_StrFree
(
vStr
);
// report the result of writing
if
(
pMan
->
fVerbose
)
{
printf
(
"The supergates are written using new format
\"
%s
\"
"
,
pFileName
);
printf
(
"(%0.3f MB).
\n
"
,
((
double
)
Extra_FileSize
(
pFileName
))
/
(
1
<<
20
)
);
}
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
...
...
src/map/super/superInt.h
View file @
e7527a47
...
@@ -54,12 +54,6 @@ ABC_NAMESPACE_HEADER_START
...
@@ -54,12 +54,6 @@ ABC_NAMESPACE_HEADER_START
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/*=== superAnd.c =============================================================*/
extern
void
Super2_Precompute
(
int
nInputs
,
int
nLevels
,
int
fVerbose
);
/*=== superGate.c =============================================================*/
extern
void
Super_Precompute
(
Mio_Library_t
*
pLibGen
,
int
nInputs
,
int
nLevels
,
int
nGatesMax
,
float
tDelayMax
,
float
tAreaMax
,
int
TimeLimit
,
int
fSkipInv
,
int
fWriteOldFormat
,
int
fVerbose
);
ABC_NAMESPACE_HEADER_END
ABC_NAMESPACE_HEADER_END
...
...
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