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
5dc50744
Commit
5dc50744
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
480ca14c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
106 additions
and
21 deletions
+106
-21
src/base/abci/abcAttach.c
+1
-1
src/base/abci/abcPrint.c
+1
-1
src/base/io/ioReadBlif.c
+6
-6
src/base/ver/verCore.c
+1
-1
src/map/mapper/mapperTree.c
+2
-2
src/map/mapper/mapperTree_old.c
+2
-2
src/map/mapper/mapperUtils.c
+1
-1
src/map/mio/mio.h
+2
-1
src/map/mio/mioApi.c
+1
-1
src/map/mio/mioParse.c
+77
-0
src/map/mio/mioRead.c
+8
-1
src/map/super/superGate.c
+4
-4
No files found.
src/base/abci/abcAttach.c
View file @
5dc50744
...
...
@@ -88,7 +88,7 @@ int Abc_NtkAttach( Abc_Ntk_t * pNtk )
for
(
i
=
1
;
i
<
nGates
;
i
++
)
puTruthGates
[
i
]
=
puTruthGates
[
i
-
1
]
+
2
;
for
(
i
=
0
;
i
<
nGates
;
i
++
)
Mio_DeriveTruthTable
(
ppGates
[
i
],
uTruths
,
Mio_GateRead
Inputs
(
ppGates
[
i
]),
6
,
puTruthGates
[
i
]
);
Mio_DeriveTruthTable
(
ppGates
[
i
],
uTruths
,
Mio_GateRead
PinNum
(
ppGates
[
i
]),
6
,
puTruthGates
[
i
]
);
// assign the gates to pNode->pCopy
Abc_NtkCleanCopy
(
pNtk
);
...
...
src/base/abci/abcPrint.c
View file @
5dc50744
...
...
@@ -1049,7 +1049,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
Area
=
Counter
*
Mio_GateReadArea
(
ppGates
[
i
]
);
printf
(
"%-*s Fanin = %2d Instance = %8d Area = %10.2f %6.2f %%
\n
"
,
nGateNameLen
,
Mio_GateReadName
(
ppGates
[
i
]
),
Mio_GateRead
Inputs
(
ppGates
[
i
]
),
Mio_GateRead
PinNum
(
ppGates
[
i
]
),
Counter
,
Area
,
100
.
0
*
Area
/
AreaTotal
);
}
printf
(
"%-*s Instance = %8d Area = %10.2f %6.2f %%
\n
"
,
...
...
src/base/io/ioReadBlif.c
View file @
5dc50744
...
...
@@ -533,12 +533,12 @@ int Io_ReadBlifReorderFormalNames( Vec_Ptr_t * vTokens, Mio_Gate_t * pGate, Mio_
nSize
=
Vec_PtrSize
(
vTokens
);
if
(
pTwin
==
NULL
)
{
if
(
nSize
-
3
!=
Mio_GateRead
Inputs
(
pGate
)
)
if
(
nSize
-
3
!=
Mio_GateRead
PinNum
(
pGate
)
)
return
0
;
}
else
{
if
(
nSize
-
3
!=
Mio_GateRead
Inputs
(
pGate
)
&&
nSize
-
4
!=
Mio_GateReadInputs
(
pGate
)
)
if
(
nSize
-
3
!=
Mio_GateRead
PinNum
(
pGate
)
&&
nSize
-
4
!=
Mio_GateReadPinNum
(
pGate
)
)
return
0
;
}
// check if the names are in order
...
...
@@ -553,7 +553,7 @@ int Io_ReadBlifReorderFormalNames( Vec_Ptr_t * vTokens, Mio_Gate_t * pGate, Mio_
}
if
(
pTwin
==
NULL
)
{
if
(
i
==
Mio_GateRead
Inputs
(
pGate
)
)
if
(
i
==
Mio_GateRead
PinNum
(
pGate
)
)
return
1
;
// reorder the pins
for
(
pGatePin
=
Mio_GateReadPins
(
pGate
),
i
=
0
;
pGatePin
;
pGatePin
=
Mio_PinReadNext
(
pGatePin
),
i
++
)
...
...
@@ -589,10 +589,10 @@ int Io_ReadBlifReorderFormalNames( Vec_Ptr_t * vTokens, Mio_Gate_t * pGate, Mio_
}
else
{
if
(
i
!=
Mio_GateRead
Inputs
(
pGate
)
)
// expect the correct order of input pins in the network with twin gates
if
(
i
!=
Mio_GateRead
PinNum
(
pGate
)
)
// expect the correct order of input pins in the network with twin gates
return
0
;
// check the last two entries
if
(
nSize
-
3
==
Mio_GateRead
Inputs
(
pGate
)
)
// only one output is available
if
(
nSize
-
3
==
Mio_GateRead
PinNum
(
pGate
)
)
// only one output is available
{
pNamePin
=
Mio_GateReadOutName
(
pGate
);
Length
=
strlen
(
pNamePin
);
...
...
@@ -614,7 +614,7 @@ int Io_ReadBlifReorderFormalNames( Vec_Ptr_t * vTokens, Mio_Gate_t * pGate, Mio_
}
return
0
;
}
if
(
nSize
-
4
==
Mio_GateRead
Inputs
(
pGate
)
)
// two outputs are available
if
(
nSize
-
4
==
Mio_GateRead
PinNum
(
pGate
)
)
// two outputs are available
{
pNamePin
=
Mio_GateReadOutName
(
pGate
);
Length
=
strlen
(
pNamePin
);
...
...
src/base/ver/verCore.c
View file @
5dc50744
...
...
@@ -1527,7 +1527,7 @@ int Ver_ParseGate( Ver_Man_t * pMan, Abc_Ntk_t * pNtk, Mio_Gate_t * pGate )
Ver_Stream_t
*
p
=
pMan
->
pReader
;
Abc_Obj_t
*
pNetActual
,
*
pNode
,
*
pNode2
=
NULL
;
char
*
pWord
,
Symbol
;
int
Input
,
i
,
nFanins
=
Mio_GateRead
Inputs
(
pGate
);
int
Input
,
i
,
nFanins
=
Mio_GateRead
PinNum
(
pGate
);
// convert from the blackbox into the network with local functions representated by gates
if
(
1
!=
pMan
->
fMapped
)
...
...
src/map/mapper/mapperTree.c
View file @
5dc50744
...
...
@@ -309,7 +309,7 @@ Map_Super_t * Map_LibraryReadGateTree( Map_SuperLib_t * pLib, char * pBuffer, in
return
NULL
;
}
// set the max number of fanouts
pGate
->
nFanLimit
=
s_MapFanoutLimits
[
Mio_GateRead
Inputs
(
pGate
->
pRoot
)
];
pGate
->
nFanLimit
=
s_MapFanoutLimits
[
Mio_GateRead
PinNum
(
pGate
->
pRoot
)
];
// read the pin-to-pin delay
for
(
i
=
0
;
(
pTemp
=
strtok
(
NULL
,
"
\n\0
"
)
);
i
++
)
...
...
@@ -336,7 +336,7 @@ Map_Super_t * Map_LibraryReadGateTree( Map_SuperLib_t * pLib, char * pBuffer, in
pGate
->
pFanins
[
i
]
=
pLib
->
ppSupers
[
Num
];
}
pGate
->
nFanins
=
i
;
if
(
pGate
->
nFanins
!=
(
unsigned
)
Mio_GateRead
Inputs
(
pGate
->
pRoot
)
)
if
(
pGate
->
nFanins
!=
(
unsigned
)
Mio_GateRead
PinNum
(
pGate
->
pRoot
)
)
{
printf
(
"The number of fanins of a root gate is wrong.
\n
"
);
return
NULL
;
...
...
src/map/mapper/mapperTree_old.c
View file @
5dc50744
...
...
@@ -306,7 +306,7 @@ Map_Super_t * Map_LibraryReadGateTree( Map_SuperLib_t * pLib, char * pBuffer, in
return
NULL
;
}
// set the max number of fanouts
pGate
->
nFanLimit
=
s_MapFanoutLimits
[
Mio_GateRead
Inputs
(
pGate
->
pRoot
)
];
pGate
->
nFanLimit
=
s_MapFanoutLimits
[
Mio_GateRead
PinNum
(
pGate
->
pRoot
)
];
// read the pin-to-pin delay
for
(
i
=
0
;
(
pTemp
=
strtok
(
NULL
,
"
\n\0
"
)
);
i
++
)
...
...
@@ -333,7 +333,7 @@ Map_Super_t * Map_LibraryReadGateTree( Map_SuperLib_t * pLib, char * pBuffer, in
pGate
->
pFanins
[
i
]
=
pLib
->
ppSupers
[
Num
];
}
pGate
->
nFanins
=
i
;
if
(
pGate
->
nFanins
!=
(
unsigned
)
Mio_GateRead
Inputs
(
pGate
->
pRoot
)
)
if
(
pGate
->
nFanins
!=
(
unsigned
)
Mio_GateRead
PinNum
(
pGate
->
pRoot
)
)
{
printf
(
"The number of fanins of a root gate is wrong.
\n
"
);
return
NULL
;
...
...
src/map/mapper/mapperUtils.c
View file @
5dc50744
...
...
@@ -799,7 +799,7 @@ st_table * Map_CreateTableGate2Super( Map_Man_t * pMan )
if
(
pSuper
->
nGates
==
1
)
{
// skip different versions of the same root gate
nInputs
=
Mio_GateRead
Inputs
(
pSuper
->
pRoot
);
nInputs
=
Mio_GateRead
PinNum
(
pSuper
->
pRoot
);
for
(
v
=
0
;
v
<
nInputs
;
v
++
)
if
(
pSuper
->
pFanins
[
v
]
->
Num
!=
nInputs
-
1
-
v
)
break
;
...
...
src/map/mio/mio.h
View file @
5dc50744
...
...
@@ -111,7 +111,7 @@ extern Mio_Pin_t * Mio_GateReadPins ( Mio_Gate_t * pGate );
extern
Mio_Library_t
*
Mio_GateReadLib
(
Mio_Gate_t
*
pGate
);
extern
Mio_Gate_t
*
Mio_GateReadNext
(
Mio_Gate_t
*
pGate
);
extern
Mio_Gate_t
*
Mio_GateReadTwin
(
Mio_Gate_t
*
pGate
);
extern
int
Mio_GateRead
Inputs
(
Mio_Gate_t
*
pGate
);
extern
int
Mio_GateRead
PinNum
(
Mio_Gate_t
*
pGate
);
extern
double
Mio_GateReadDelayMax
(
Mio_Gate_t
*
pGate
);
extern
char
*
Mio_GateReadSop
(
Mio_Gate_t
*
pGate
);
extern
word
Mio_GateReadTruth
(
Mio_Gate_t
*
pGate
);
...
...
@@ -135,6 +135,7 @@ extern int Mio_LibraryReadExclude( char * ExcludeFile, st_table *
extern
int
Mio_LibraryParseFormulas
(
Mio_Library_t
*
pLib
);
/*=== mioParse.c =============================================================*/
extern
Vec_Int_t
*
Mio_ParseFormula
(
char
*
pFormInit
,
char
**
ppVarNames
,
int
nVars
);
extern
int
Mio_ParseCheckFormula
(
Mio_Gate_t
*
pGate
,
char
*
pForm
);
/*=== mioSop.c =============================================================*/
extern
char
*
Mio_LibDeriveSop
(
int
nVars
,
Vec_Int_t
*
vExpr
,
Vec_Str_t
*
vStr
);
/*=== mioUtils.c =============================================================*/
...
...
src/map/mio/mioApi.c
View file @
5dc50744
...
...
@@ -148,7 +148,7 @@ Mio_Pin_t * Mio_GateReadPins ( Mio_Gate_t * pGate ) { return
Mio_Library_t
*
Mio_GateReadLib
(
Mio_Gate_t
*
pGate
)
{
return
pGate
->
pLib
;
}
Mio_Gate_t
*
Mio_GateReadNext
(
Mio_Gate_t
*
pGate
)
{
return
pGate
->
pNext
;
}
Mio_Gate_t
*
Mio_GateReadTwin
(
Mio_Gate_t
*
pGate
)
{
return
pGate
->
pTwin
;
}
int
Mio_GateRead
Inputs
(
Mio_Gate_t
*
pGate
)
{
return
pGate
->
nInputs
;
}
int
Mio_GateRead
PinNum
(
Mio_Gate_t
*
pGate
)
{
return
pGate
->
nInputs
;
}
double
Mio_GateReadDelayMax
(
Mio_Gate_t
*
pGate
)
{
return
pGate
->
dDelayMax
;
}
char
*
Mio_GateReadSop
(
Mio_Gate_t
*
pGate
)
{
return
pGate
->
pSop
;
}
word
Mio_GateReadTruth
(
Mio_Gate_t
*
pGate
)
{
return
pGate
->
nInputs
<=
6
?
pGate
->
uTruth
:
0
;
}
...
...
src/map/mio/mioParse.c
View file @
5dc50744
...
...
@@ -382,6 +382,83 @@ Vec_Int_t * Mio_ParseFormula( char * pFormInit, char ** ppVarNames, int nVars )
return
NULL
;
}
/**Function*************************************************************
Synopsis [Checks if the gate's formula essentially depends on all variables.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Mio_ParseCheckName
(
Mio_Gate_t
*
pGate
,
char
**
ppStr
)
{
Mio_Pin_t
*
pPin
;
int
i
;
for
(
pPin
=
Mio_GateReadPins
(
pGate
),
i
=
0
;
pPin
;
pPin
=
Mio_PinReadNext
(
pPin
),
i
++
)
if
(
!
strncmp
(
*
ppStr
,
Mio_PinReadName
(
pPin
),
strlen
(
Mio_PinReadName
(
pPin
))
)
)
{
*
ppStr
+=
strlen
(
Mio_PinReadName
(
pPin
))
-
1
;
return
i
;
}
return
-
1
;
}
int
Mio_ParseCheckFormula
(
Mio_Gate_t
*
pGate
,
char
*
pForm
)
{
Mio_Pin_t
*
pPin
;
char
*
pStr
;
int
i
,
iPin
,
fVisit
[
32
]
=
{
0
};
if
(
Mio_GateReadPins
(
pGate
)
==
NULL
)
return
1
;
/*
// find the equality sign
pForm = strstr( pForm, "=" );
if ( pForm == NULL )
{
printf( "Skipping gate \"%s\" because formula \"%s\" has not equality sign (=).\n", pGate->pName, pForm );
return 0;
}
*/
printf
(
"Checking gate %s
\n
"
,
pGate
->
pName
);
for
(
pStr
=
pForm
+
1
;
*
pStr
;
pStr
++
)
{
if
(
*
pStr
==
' '
||
*
pStr
==
MIO_EQN_SYM_OPEN
||
*
pStr
==
MIO_EQN_SYM_CLOSE
||
*
pStr
==
MIO_EQN_SYM_CONST0
||
*
pStr
==
MIO_EQN_SYM_CONST1
||
*
pStr
==
MIO_EQN_SYM_NEG
||
*
pStr
==
MIO_EQN_SYM_NEGAFT
||
*
pStr
==
MIO_EQN_SYM_AND
||
*
pStr
==
MIO_EQN_SYM_AND2
||
*
pStr
==
MIO_EQN_SYM_XOR
||
*
pStr
==
MIO_EQN_SYM_OR
||
*
pStr
==
MIO_EQN_SYM_OR2
)
continue
;
// return the number of the pin which has this name
iPin
=
Mio_ParseCheckName
(
pGate
,
&
pStr
);
if
(
iPin
==
-
1
)
{
printf
(
"Skipping gate
\"
%s
\"
because substring
\"
%s
\"
does not match with a pin name.
\n
"
,
pGate
->
pName
,
*
pStr
);
return
0
;
}
assert
(
iPin
<
32
);
fVisit
[
iPin
]
=
1
;
}
// check that all pins are used
for
(
pPin
=
Mio_GateReadPins
(
pGate
),
i
=
0
;
pPin
;
pPin
=
Mio_PinReadNext
(
pPin
),
i
++
)
if
(
fVisit
[
i
]
==
0
)
{
printf
(
"Skipping gate
\"
%s
\"
because pin
\"
%s
\"
does not appear in the formula
\"
%s
\"
.
\n
"
,
pGate
->
pName
,
Mio_PinReadName
(
pPin
),
pForm
);
return
0
;
}
return
1
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/map/mio/mioRead.c
View file @
5dc50744
...
...
@@ -209,7 +209,14 @@ int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtended
pGate
=
Mio_LibraryReadGate
(
&
pToken
,
fExtendedFormat
);
if
(
pGate
==
NULL
)
return
1
;
/*
// skip the gate if its formula has problems
if ( !Mio_ParseCheckFormula(pGate, pGate->pForm) )
{
Mio_GateDelete( pGate );
continue;
}
*/
// set the library
pGate
->
pLib
=
pLib
;
...
...
src/map/super/superGate.c
View file @
5dc50744
...
...
@@ -360,7 +360,7 @@ Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGat
{
if
(
pMan
->
nLevels
>=
1
)
// First level gates have been computed
{
if
(
Mio_GateRead
Inputs
(
ppGates
[
k
])
>=
iPruneLimitRoot
)
if
(
Mio_GateRead
PinNum
(
ppGates
[
k
])
>=
iPruneLimitRoot
)
continue
;
}
}
...
...
@@ -386,7 +386,7 @@ Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGat
if
(
pMan
->
fVerbose
)
{
printf
(
"Trying %d choices for %d inputs
\n
"
,
t
,
Mio_GateRead
Inputs
(
ppGates
[
k
])
);
printf
(
"Trying %d choices for %d inputs
\n
"
,
t
,
Mio_GateRead
PinNum
(
ppGates
[
k
])
);
}
// resort part of this range by area
...
...
@@ -402,7 +402,7 @@ Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGat
// consider the combinations of gates with the root gate on top
AreaMio
=
(
float
)
Mio_GateReadArea
(
ppGates
[
k
]);
nFanins
=
Mio_GateRead
Inputs
(
ppGates
[
k
]);
nFanins
=
Mio_GateRead
PinNum
(
ppGates
[
k
]);
switch
(
nFanins
)
{
case
0
:
// should not happen
...
...
@@ -1348,7 +1348,7 @@ void Super_WriteLibraryTree_rec( FILE * pFile, Super_Man_t * pMan, Super_Gate_t
if
(
pSuper
->
fVar
||
pSuper
->
Number
>
0
)
return
;
// write the fanins
nFanins
=
Mio_GateRead
Inputs
(
pSuper
->
pRoot
);
nFanins
=
Mio_GateRead
PinNum
(
pSuper
->
pRoot
);
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
Super_WriteLibraryTree_rec
(
pFile
,
pMan
,
pSuper
->
pFanins
[
i
],
pCounter
);
// finally write the gate
...
...
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