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
b3c9609e
Commit
b3c9609e
authored
Dec 21, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to hierarchical BLIF parser.
parent
3418a882
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
7 deletions
+34
-7
src/base/io/ioReadBlifMv.c
+34
-7
No files found.
src/base/io/ioReadBlifMv.c
View file @
b3c9609e
...
@@ -30,6 +30,7 @@ ABC_NAMESPACE_IMPL_START
...
@@ -30,6 +30,7 @@ ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#define IO_BLIFMV_MAXVALUES 256
#define IO_BLIFMV_MAXVALUES 256
#define IO_VERBOSE_OUTPUT
typedef
struct
Io_MvVar_t_
Io_MvVar_t
;
// parsing var
typedef
struct
Io_MvVar_t_
Io_MvVar_t
;
// parsing var
typedef
struct
Io_MvMod_t_
Io_MvMod_t
;
// parsing model
typedef
struct
Io_MvMod_t_
Io_MvMod_t
;
// parsing model
...
@@ -735,6 +736,12 @@ static int Io_MvReadInterfaces( Io_MvMan_t * p )
...
@@ -735,6 +736,12 @@ static int Io_MvReadInterfaces( Io_MvMan_t * p )
Vec_PtrForEachEntry
(
char
*
,
pMod
->
vLtlProperties
,
pLine
,
k
)
Vec_PtrForEachEntry
(
char
*
,
pMod
->
vLtlProperties
,
pLine
,
k
)
if
(
!
Io_MvParseLineLtlProperty
(
pMod
,
pLine
)
)
if
(
!
Io_MvParseLineLtlProperty
(
pMod
,
pLine
)
)
return
0
;
return
0
;
// report the results
#ifdef IO_VERBOSE_OUTPUT
printf
(
"Parsed %-32s: PI =%6d PO =%6d ND =%8d FF =%6d B =%6d
\n
"
,
pMod
->
pNtk
->
pName
,
Abc_NtkPiNum
(
pMod
->
pNtk
),
Abc_NtkPoNum
(
pMod
->
pNtk
),
Vec_PtrSize
(
pMod
->
vNames
),
Vec_PtrSize
(
pMod
->
vLatches
),
Vec_PtrSize
(
pMod
->
vSubckts
)
);
#endif
}
}
return
1
;
return
1
;
}
}
...
@@ -760,6 +767,10 @@ static Abc_Lib_t * Io_MvParse( Io_MvMan_t * p )
...
@@ -760,6 +767,10 @@ static Abc_Lib_t * Io_MvParse( Io_MvMan_t * p )
// iterate through the models
// iterate through the models
Vec_PtrForEachEntry
(
Io_MvMod_t
*
,
p
->
vModels
,
pMod
,
i
)
Vec_PtrForEachEntry
(
Io_MvMod_t
*
,
p
->
vModels
,
pMod
,
i
)
{
{
#ifdef IO_VERBOSE_OUTPUT
printf
(
"Parsing model %s...
\n
"
,
pMod
->
pNtk
->
pName
);
#endif
// check if there any MV lines
// check if there any MV lines
if
(
Vec_PtrSize
(
pMod
->
vMvs
)
>
0
)
if
(
Vec_PtrSize
(
pMod
->
vMvs
)
>
0
)
Abc_NtkStartMvVars
(
pMod
->
pNtk
);
Abc_NtkStartMvVars
(
pMod
->
pNtk
);
...
@@ -1191,14 +1202,15 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine )
...
@@ -1191,14 +1202,15 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine )
Vec_Ptr_t
*
vTokens
=
p
->
pMan
->
vTokens
;
Vec_Ptr_t
*
vTokens
=
p
->
pMan
->
vTokens
;
Abc_Ntk_t
*
pModel
;
Abc_Ntk_t
*
pModel
;
Abc_Obj_t
*
pBox
,
*
pNet
,
*
pTerm
;
Abc_Obj_t
*
pBox
,
*
pNet
,
*
pTerm
;
char
*
pToken
,
*
pName
,
**
ppNames
;
char
*
pToken
,
*
pName
,
*
pName2
,
*
*
ppNames
;
int
nEquals
,
i
,
k
;
int
nEquals
,
Last
,
i
,
k
;
// split the line into tokens
// split the line into tokens
nEquals
=
Io_MvCountChars
(
pLine
,
'='
);
nEquals
=
Io_MvCountChars
(
pLine
,
'='
);
Io_MvSplitIntoTokensAndClear
(
vTokens
,
pLine
,
'\0'
,
'='
);
Io_MvSplitIntoTokensAndClear
(
vTokens
,
pLine
,
'\0'
,
'='
);
pToken
=
(
char
*
)
Vec_PtrEntry
(
vTokens
,
0
);
pToken
=
(
char
*
)
Vec_PtrEntry
(
vTokens
,
0
);
assert
(
!
strcmp
(
pToken
,
"subckt"
)
);
assert
(
!
strcmp
(
pToken
,
"subckt"
)
);
//printf( "%d ", nEquals );
// get the model for this box
// get the model for this box
pName
=
(
char
*
)
Vec_PtrEntry
(
vTokens
,
1
);
pName
=
(
char
*
)
Vec_PtrEntry
(
vTokens
,
1
);
...
@@ -1237,13 +1249,19 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine )
...
@@ -1237,13 +1249,19 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine )
if
(
p
->
pMan
->
fBlifMv
)
if
(
p
->
pMan
->
fBlifMv
)
Abc_ObjAssignName
(
pBox
,
(
char
*
)
Vec_PtrEntry
(
vTokens
,
2
),
NULL
);
Abc_ObjAssignName
(
pBox
,
(
char
*
)
Vec_PtrEntry
(
vTokens
,
2
),
NULL
);
// go through formal inputs
// go through formal inputs
Last
=
0
;
Abc_NtkForEachPi
(
pModel
,
pTerm
,
i
)
Abc_NtkForEachPi
(
pModel
,
pTerm
,
i
)
{
{
// find this terminal among the actual inputs of the subcircuit
// find this terminal among the actual inputs of the subcircuit
pName2
=
NULL
;
pName
=
Abc_ObjName
(
Abc_ObjFanout0
(
pTerm
));
pName
=
Abc_ObjName
(
Abc_ObjFanout0
(
pTerm
));
for
(
k
=
0
;
k
<
nEquals
;
k
++
)
for
(
k
=
0
;
k
<
nEquals
;
k
++
)
if
(
!
strcmp
(
ppNames
[
2
*
k
],
pName
)
)
if
(
!
strcmp
(
ppNames
[
2
*
((
k
+
Last
)
%
nEquals
)],
pName
)
)
{
pName2
=
ppNames
[
2
*
((
k
+
Last
)
%
nEquals
)
+
1
];
Last
=
k
+
Last
+
1
;
break
;
break
;
}
/*
/*
if ( k == nEquals )
if ( k == nEquals )
{
{
...
@@ -1263,21 +1281,28 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine )
...
@@ -1263,21 +1281,28 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine )
Abc_ObjAddFanin
(
pTerm
,
pNet
);
Abc_ObjAddFanin
(
pTerm
,
pNet
);
continue
;
continue
;
}
}
assert
(
pName2
!=
NULL
);
// create the BI with the actual name
// create the BI with the actual name
pNet
=
Abc_NtkFindOrCreateNet
(
p
->
pNtk
,
p
pNames
[
2
*
k
+
1
]
);
pNet
=
Abc_NtkFindOrCreateNet
(
p
->
pNtk
,
p
Name2
);
pTerm
=
Abc_NtkCreateBi
(
p
->
pNtk
);
pTerm
=
Abc_NtkCreateBi
(
p
->
pNtk
);
Abc_ObjAddFanin
(
pBox
,
pTerm
);
Abc_ObjAddFanin
(
pBox
,
pTerm
);
Abc_ObjAddFanin
(
pTerm
,
pNet
);
Abc_ObjAddFanin
(
pTerm
,
pNet
);
}
}
// go through formal outputs
// go through formal outputs
Last
=
0
;
Abc_NtkForEachPo
(
pModel
,
pTerm
,
i
)
Abc_NtkForEachPo
(
pModel
,
pTerm
,
i
)
{
{
// find this terminal among the actual outputs of the subcircuit
// find this terminal among the actual outputs of the subcircuit
pName2
=
NULL
;
pName
=
Abc_ObjName
(
Abc_ObjFanin0
(
pTerm
));
pName
=
Abc_ObjName
(
Abc_ObjFanin0
(
pTerm
));
for
(
k
=
0
;
k
<
nEquals
;
k
++
)
for
(
k
=
0
;
k
<
nEquals
;
k
++
)
if
(
!
strcmp
(
ppNames
[
2
*
k
],
pName
)
)
if
(
!
strcmp
(
ppNames
[
2
*
((
k
+
Last
)
%
nEquals
)],
pName
)
)
{
pName2
=
ppNames
[
2
*
((
k
+
Last
)
%
nEquals
)
+
1
];
Last
=
k
+
Last
+
1
;
break
;
break
;
}
/*
/*
if ( k == nEquals )
if ( k == nEquals )
{
{
...
@@ -1286,9 +1311,11 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine )
...
@@ -1286,9 +1311,11 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine )
return 0;
return 0;
}
}
*/
*/
assert
(
pName2
!=
NULL
);
// create the BI with the actual name
// create the BI with the actual name
pTerm
=
Abc_NtkCreateBo
(
p
->
pNtk
);
pTerm
=
Abc_NtkCreateBo
(
p
->
pNtk
);
pNet
=
Abc_NtkFindOrCreateNet
(
p
->
pNtk
,
k
==
nEquals
?
Abc_ObjNameSuffix
(
pTerm
,
"abc"
)
:
p
pNames
[
2
*
k
+
1
]
);
pNet
=
Abc_NtkFindOrCreateNet
(
p
->
pNtk
,
k
==
nEquals
?
Abc_ObjNameSuffix
(
pTerm
,
"abc"
)
:
p
Name2
);
Abc_ObjAddFanin
(
pNet
,
pTerm
);
Abc_ObjAddFanin
(
pNet
,
pTerm
);
Abc_ObjAddFanin
(
pTerm
,
pBox
);
Abc_ObjAddFanin
(
pTerm
,
pBox
);
}
}
...
...
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