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
480ca14c
Commit
480ca14c
authored
Sep 19, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extending Liberty parser to handle multi-output cells.
parent
3af0f719
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
90 additions
and
34 deletions
+90
-34
src/base/abc/abc.h
+2
-0
src/base/abc/abcUtil.c
+6
-6
src/base/abci/abcMap.c
+29
-0
src/base/abci/abcPrint.c
+1
-1
src/base/io/ioWriteBlif.c
+7
-18
src/map/amap/amapInt.h
+1
-0
src/map/amap/amapLib.c
+2
-2
src/map/amap/amapLiberty.c
+25
-5
src/map/amap/amapRead.c
+15
-2
src/map/mio/mioUtils.c
+2
-0
No files found.
src/base/abc/abc.h
View file @
480ca14c
...
...
@@ -661,6 +661,8 @@ extern ABC_DLL int Abc_LibFindTopLevelModels( Abc_Lib_t * pLib );
extern
ABC_DLL
Abc_Ntk_t
*
Abc_LibDeriveRoot
(
Abc_Lib_t
*
pLib
);
/*=== abcLog.c ==========================================================*/
extern
ABC_DLL
void
Abc_NtkWriteLogFile
(
char
*
pFileName
,
Abc_Cex_t
*
pSeqCex
,
int
Status
,
int
nFrames
,
char
*
pCommand
);
/*=== abcMap.c ==========================================================*/
extern
ABC_DLL
Abc_Obj_t
*
Abc_NtkFetchTwinNode
(
Abc_Obj_t
*
pNode
);
/*=== abcMiter.c ==========================================================*/
extern
ABC_DLL
int
Abc_NtkMinimumBase
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
int
Abc_NodeMinimumBase
(
Abc_Obj_t
*
pNode
);
...
...
src/base/abc/abcUtil.c
View file @
480ca14c
...
...
@@ -357,22 +357,22 @@ int Abc_NtkGetClauseNum( Abc_Ntk_t * pNtk )
***********************************************************************/
double
Abc_NtkGetMappedArea
(
Abc_Ntk_t
*
pNtk
)
{
Abc_Obj_t
*
p
Node
;
Abc_Obj_t
*
p
Obj
;
double
TotalArea
;
int
i
;
assert
(
Abc_NtkHasMapping
(
pNtk
)
);
TotalArea
=
0
.
0
;
Abc_NtkForEachNode
(
pNtk
,
p
Node
,
i
)
Abc_NtkForEachNode
(
pNtk
,
p
Obj
,
i
)
{
// assert( p
Node
->pData );
if
(
p
Node
->
pData
==
NULL
)
// assert( p
Obj
->pData );
if
(
p
Obj
->
pData
==
NULL
)
{
printf
(
"Node without mapping is encountered.
\n
"
);
continue
;
}
TotalArea
+=
Mio_GateReadArea
(
(
Mio_Gate_t
*
)
p
Node
->
pData
);
TotalArea
+=
Mio_GateReadArea
(
(
Mio_Gate_t
*
)
p
Obj
->
pData
);
// assuming that twin gates follow each other
if
(
Mio_GateReadTwin
(((
Mio_Gate_t
*
)
pNode
->
pData
))
!=
NULL
)
if
(
Abc_NtkFetchTwinNode
(
pObj
)
)
i
++
;
}
return
TotalArea
;
...
...
src/base/abci/abcMap.c
View file @
480ca14c
...
...
@@ -682,6 +682,35 @@ Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Super_t * p
return
pNodeNew
;
}
/**Function*************************************************************
Synopsis [Returns the twin node if it exists.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Obj_t
*
Abc_NtkFetchTwinNode
(
Abc_Obj_t
*
pNode
)
{
Abc_Obj_t
*
pNode2
;
Mio_Gate_t
*
pGate
=
(
Mio_Gate_t
*
)
pNode
->
pData
;
assert
(
Abc_NtkHasMapping
(
pNode
->
pNtk
)
);
if
(
pGate
==
NULL
||
Mio_GateReadTwin
(
pGate
)
==
NULL
)
return
NULL
;
// assuming the twin node is following next
if
(
(
int
)
Abc_ObjId
(
pNode
)
==
Abc_NtkObjNumMax
(
pNode
->
pNtk
)
-
1
)
return
NULL
;
pNode2
=
Abc_NtkObj
(
pNode
->
pNtk
,
Abc_ObjId
(
pNode
)
+
1
);
if
(
pNode2
==
NULL
||
!
Abc_ObjIsNode
(
pNode2
)
||
Abc_ObjFaninNum
(
pNode
)
!=
Abc_ObjFaninNum
(
pNode2
)
)
return
NULL
;
if
(
Mio_GateReadTwin
(
pGate
)
!=
(
Mio_Gate_t
*
)
pNode2
->
pData
)
return
NULL
;
return
pNode2
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
...
...
src/base/abci/abcPrint.c
View file @
480ca14c
...
...
@@ -1025,7 +1025,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
Mio_GateSetValue
(
(
Mio_Gate_t
*
)
pObj
->
pData
,
1
+
Mio_GateReadValue
((
Mio_Gate_t
*
)
pObj
->
pData
)
);
CounterTotal
++
;
// assuming that twin gates follow each other
if
(
Mio_GateReadTwin
(((
Mio_Gate_t
*
)
pObj
->
pData
))
!=
NULL
)
if
(
Abc_NtkFetchTwinNode
(
pObj
)
)
i
++
;
}
...
...
src/base/io/ioWriteBlif.c
View file @
480ca14c
...
...
@@ -514,6 +514,7 @@ void Io_NtkWriteNodeFanins( FILE * pFile, Abc_Obj_t * pNode )
fprintf
(
pFile
,
" %s"
,
pName
);
}
/**Function*************************************************************
Synopsis [Writes the primary input list.]
...
...
@@ -527,12 +528,11 @@ void Io_NtkWriteNodeFanins( FILE * pFile, Abc_Obj_t * pNode )
***********************************************************************/
int
Io_NtkWriteNodeGate
(
FILE
*
pFile
,
Abc_Obj_t
*
pNode
,
int
Length
)
{
static
int
fReport
=
0
;
Mio_Gate_t
*
pGate
=
(
Mio_Gate_t
*
)
pNode
->
pData
;
Mio_Gate_t
*
pGate2
;
Mio_Pin_t
*
pGatePin
;
Abc_Obj_t
*
pNode2
;
int
i
;
// write the node
fprintf
(
pFile
,
" %-*s "
,
Length
,
Mio_GateReadName
(
pGate
)
);
for
(
pGatePin
=
Mio_GateReadPins
(
pGate
),
i
=
0
;
pGatePin
;
pGatePin
=
Mio_PinReadNext
(
pGatePin
),
i
++
)
fprintf
(
pFile
,
"%s=%s "
,
Mio_PinReadName
(
pGatePin
),
Abc_ObjName
(
Abc_ObjFanin
(
pNode
,
i
)
)
);
...
...
@@ -540,25 +540,14 @@ int Io_NtkWriteNodeGate( FILE * pFile, Abc_Obj_t * pNode, int Length )
fprintf
(
pFile
,
"%s=%s"
,
Mio_GateReadOutName
(
pGate
),
Abc_ObjName
(
Abc_ObjFanout0
(
pNode
)
)
);
if
(
Mio_GateReadTwin
(
pGate
)
==
NULL
)
return
0
;
// assuming the twin node is following next
if
(
(
int
)
Abc_ObjId
(
pNode
)
==
Abc_NtkObjNumMax
(
pNode
->
pNtk
)
-
1
)
{
printf
(
"Warning: Missing second output of gate
\"
%s
\"
.
\n
"
,
Mio_GateReadName
(
pGate
)
);
return
0
;
}
pNode2
=
Abc_NtkObj
(
pNode
->
pNtk
,
Abc_ObjId
(
pNode
)
+
1
);
if
(
!
Abc_ObjIsNode
(
pNode2
)
||
Abc_ObjFaninNum
(
pNode
)
!=
Abc_ObjFaninNum
(
pNode2
)
)
{
printf
(
"Warning: Missing second output of gate
\"
%s
\"
.
\n
"
,
Mio_GateReadName
(
pGate
)
);
return
0
;
}
pGate2
=
(
Mio_Gate_t
*
)
pNode2
->
pData
;
if
(
strcmp
(
Mio_GateReadName
(
pGate
),
Mio_GateReadName
(
pGate2
))
)
pNode2
=
Abc_NtkFetchTwinNode
(
pNode
);
if
(
pNode2
==
NULL
)
{
printf
(
"Warning: Missing second output of gate
\"
%s
\"
.
\n
"
,
Mio_GateReadName
(
pGate
)
);
if
(
!
fReport
)
fReport
=
1
,
printf
(
"Warning: Missing second output of gate(s)
\"
%s
\"
.
\n
"
,
Mio_GateReadName
(
pGate
)
);
return
0
;
}
fprintf
(
pFile
,
" %s=%s"
,
Mio_GateReadOutName
(
pGate2
),
Abc_ObjName
(
Abc_ObjFanout0
(
pNode2
)
)
);
fprintf
(
pFile
,
" %s=%s"
,
Mio_GateReadOutName
(
(
Mio_Gate_t
*
)
pNode2
->
pData
),
Abc_ObjName
(
Abc_ObjFanout0
(
pNode2
)
)
);
return
1
;
}
...
...
src/map/amap/amapInt.h
View file @
480ca14c
...
...
@@ -149,6 +149,7 @@ struct Amap_Pin_t_
struct
Amap_Gat_t_
{
Amap_Lib_t
*
pLib
;
// library
Amap_Gat_t
*
pTwin
;
// twin gate
char
*
pName
;
// the name of the gate
char
*
pOutName
;
// name of the output
double
dArea
;
// the area of the gate
...
...
src/map/amap/amapLib.c
View file @
480ca14c
...
...
@@ -269,11 +269,11 @@ Vec_Ptr_t * Amap_LibSelectGates( Amap_Lib_t * p, int fVerbose )
vSelect
=
Vec_PtrAlloc
(
100
);
Vec_PtrForEachEntry
(
Amap_Gat_t
*
,
p
->
vSorted
,
pGate
,
i
)
{
if
(
pGate
->
pFunc
==
NULL
)
if
(
pGate
->
pFunc
==
NULL
||
pGate
->
pTwin
!=
NULL
)
continue
;
Vec_PtrForEachEntryStop
(
Amap_Gat_t
*
,
p
->
vSorted
,
pGate2
,
k
,
i
)
{
if
(
pGate2
->
pFunc
==
NULL
)
if
(
pGate2
->
pFunc
==
NULL
||
pGate2
->
pTwin
!=
NULL
)
continue
;
if
(
pGate2
->
nPins
!=
pGate
->
nPins
)
continue
;
...
...
src/map/amap/amapLiberty.c
View file @
480ca14c
...
...
@@ -229,7 +229,7 @@ Amap_Item_t * Amap_LibertyPinFunction( Amap_Tree_t * p, Amap_Item_t * pPin )
/**Function*************************************************************
Synopsis [Returns
cell's function
.]
Synopsis [Returns
output pin(s)
.]
Description []
...
...
@@ -250,6 +250,20 @@ Amap_Item_t * Amap_LibertyCellOutput( Amap_Tree_t * p, Amap_Item_t * pCell )
}
return
NULL
;
}
Vec_Ptr_t
*
Amap_LibertyCellOutputs
(
Amap_Tree_t
*
p
,
Amap_Item_t
*
pCell
)
{
Amap_Item_t
*
pPin
;
Vec_Ptr_t
*
vOutPins
;
vOutPins
=
Vec_PtrAlloc
(
2
);
Amap_ItemForEachChild
(
p
,
pCell
,
pPin
)
{
if
(
Amap_LibertyCompare
(
p
,
pPin
->
Key
,
"pin"
)
)
continue
;
if
(
Amap_LibertyPinFunction
(
p
,
pPin
)
)
Vec_PtrPush
(
vOutPins
,
pPin
);
}
return
vOutPins
;
}
/**Function*************************************************************
...
...
@@ -353,9 +367,10 @@ char * Amap_LibertyGetStringFormula( Amap_Tree_t * p, Amap_Pair_t Pair )
int
Amap_LibertyPrintGenlib
(
Amap_Tree_t
*
p
,
char
*
pFileName
,
int
fVerbose
)
{
FILE
*
pFile
;
Vec_Ptr_t
*
vOutputs
;
Amap_Item_t
*
pCell
,
*
pArea
,
*
pFunc
,
*
pPin
,
*
pOutput
;
char
*
pForm
;
int
Counter
;
int
i
,
Counter
;
if
(
pFileName
==
NULL
)
pFile
=
stdout
;
else
...
...
@@ -406,12 +421,14 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName, int fVerbose )
printf
(
"Amap_LibertyPrintGenlib() skipped cell
\"
%s
\"
without logic function.
\n
"
,
Amap_LibertyGetString
(
p
,
pCell
->
Head
)
);
continue
;
}
/*
if ( Counter > 1 )
{
if ( fVerbose )
printf( "Amap_LibertyPrintGenlib() skipped multi-output cell \"%s\".\n", Amap_LibertyGetString(p, pCell->Head) );
continue;
}
*/
pArea
=
Amap_LibertyCellArea
(
p
,
pCell
);
if
(
pArea
==
NULL
)
{
...
...
@@ -419,7 +436,10 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName, int fVerbose )
printf
(
"Amap_LibertyPrintGenlib() skipped cell
\"
%s
\"
with unspecified area.
\n
"
,
Amap_LibertyGetString
(
p
,
pCell
->
Head
)
);
continue
;
}
pOutput
=
Amap_LibertyCellOutput
(
p
,
pCell
);
// pOutput = Amap_LibertyCellOutput( p, pCell );
vOutputs
=
Amap_LibertyCellOutputs
(
p
,
pCell
);
Vec_PtrForEachEntry
(
Amap_Item_t
*
,
vOutputs
,
pOutput
,
i
)
{
pFunc
=
Amap_LibertyPinFunction
(
p
,
pOutput
);
pForm
=
Amap_LibertyGetStringFormula
(
p
,
pFunc
->
Head
);
if
(
!
strcmp
(
pForm
,
"0"
)
||
!
strcmp
(
pForm
,
"1"
)
)
...
...
@@ -428,17 +448,17 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName, int fVerbose )
printf
(
"Amap_LibertyPrintGenlib() skipped cell
\"
%s
\"
with constant formula
\"
%s
\"
.
\n
"
,
Amap_LibertyGetString
(
p
,
pCell
->
Head
),
pForm
);
continue
;
}
fprintf
(
pFile
,
"GATE "
);
fprintf
(
pFile
,
"%16s "
,
Amap_LibertyGetString
(
p
,
pCell
->
Head
)
);
fprintf
(
pFile
,
"%f "
,
atof
(
Amap_LibertyGetString
(
p
,
pArea
->
Head
))
);
fprintf
(
pFile
,
"%s="
,
Amap_LibertyGetString
(
p
,
pOutput
->
Head
)
);
fprintf
(
pFile
,
"%s;
\n
"
,
Amap_LibertyGetStringFormula
(
p
,
pFunc
->
Head
)
);
Amap_ItemForEachChild
(
p
,
pCell
,
pPin
)
if
(
pPin
!=
pOutput
&&
!
Amap_LibertyCompare
(
p
,
pPin
->
Key
,
"pin"
)
)
fprintf
(
pFile
,
" PIN %13s UNKNOWN 1 999 1.00 0.00 1.00 0.00
\n
"
,
Amap_LibertyGetString
(
p
,
pPin
->
Head
)
);
}
Vec_PtrFree
(
vOutputs
);
}
if
(
pFile
!=
stdout
)
fclose
(
pFile
);
return
1
;
...
...
src/map/amap/amapRead.c
View file @
480ca14c
...
...
@@ -326,10 +326,10 @@ int Amap_CollectFormulaTokens( Vec_Ptr_t * vTokens, char * pToken, int iPos )
Amap_Lib_t
*
Amap_ParseTokens
(
Vec_Ptr_t
*
vTokens
,
int
fVerbose
)
{
Amap_Lib_t
*
p
;
Amap_Gat_t
*
pGate
;
Amap_Gat_t
*
pGate
,
*
pPrev
;
Amap_Pin_t
*
pPin
;
char
*
pToken
;
int
nPins
,
iPos
=
0
;
int
i
,
nPins
,
iPos
=
0
;
p
=
Amap_LibAlloc
();
pToken
=
(
char
*
)
Vec_PtrEntry
(
vTokens
,
iPos
++
);
do
...
...
@@ -409,8 +409,21 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose )
Vec_PtrPush
(
p
->
vGates
,
pGate
);
}
pToken
=
(
char
*
)
Vec_PtrEntry
(
vTokens
,
iPos
++
);
//printf( "Finished reading gate %s (%s)\n", pGate->pName, pGate->pOutName );
}
while
(
strcmp
(
pToken
,
".end"
)
);
// check if there are gates with identical names
pPrev
=
NULL
;
Amap_LibForEachGate
(
p
,
pGate
,
i
)
{
if
(
pPrev
&&
!
strcmp
(
pPrev
->
pName
,
pGate
->
pName
)
)
{
pPrev
->
pTwin
=
pGate
,
pGate
->
pTwin
=
pPrev
;
printf
(
"Warning: Detected multi-output gate
\"
%s
\"
.
\n
"
,
pGate
->
pName
);
}
pPrev
=
pGate
;
}
return
p
;
}
...
...
src/map/mio/mioUtils.c
View file @
480ca14c
...
...
@@ -319,6 +319,8 @@ Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay,
continue
;
if
(
pGate
->
uTruth
==
~
0xAAAAAAAAAAAAAAAA
&&
fSkipInv
)
continue
;
if
(
pGate
->
pTwin
)
// skip multi-output gates for now
continue
;
// check if the gate with this functionality already exists
for
(
i
=
0
;
i
<
iGate
;
i
++
)
if
(
ppGates
[
i
]
->
uTruth
==
pGate
->
uTruth
)
...
...
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