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
fc24e9d3
Commit
fc24e9d3
authored
Jun 21, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added quick GIG parser.
parent
e2411552
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
8 deletions
+110
-8
src/aig/gia/giaGig.c
+110
-8
No files found.
src/aig/gia/giaGig.c
View file @
fc24e9d3
...
@@ -72,19 +72,121 @@ static char * s_GigNames[GIG_UNUSED] =
...
@@ -72,19 +72,121 @@ static char * s_GigNames[GIG_UNUSED] =
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Gia_Man_t
*
Gia_ManBuildGig
(
Vec_Int_t
*
vObjs
,
Vec_Int_t
*
vStore
)
int
*
Gia_ManGigCount
(
Vec_Int_t
*
vObjs
,
Vec_Int_t
*
vStore
)
{
{
int
i
,
Type
,
nObjs
[
GIG_UNUSED
]
=
{
0
};
static
int
nObjs
[
GIG_UNUSED
];
int
i
;
printf
(
"Parsed %d objects and %d tokens.
\n
"
,
Vec_IntSize
(
vObjs
),
Vec_IntSize
(
vStore
)
);
for
(
i
=
0
;
i
<
GIG_UNUSED
;
i
++
)
nObjs
[
i
]
=
0
;
for
(
i
=
0
;
i
<
Vec_IntSize
(
vObjs
);
i
++
)
for
(
i
=
0
;
i
<
Vec_IntSize
(
vObjs
);
i
++
)
{
nObjs
[
Vec_IntEntry
(
vStore
,
Vec_IntEntry
(
vObjs
,
i
)
+
1
)]
++
;
Type
=
Vec_IntEntry
(
vStore
,
Vec_IntEntry
(
vObjs
,
i
)
+
1
);
return
nObjs
;
nObjs
[
Type
]
++
;
}
}
void
Gia_ManGigPrint
(
int
*
nObjs
)
{
int
i
;
printf
(
"Statistics: "
);
printf
(
"Statistics: "
);
for
(
i
=
1
;
i
<
GIG_UNUSED
;
i
++
)
for
(
i
=
1
;
i
<
GIG_UNUSED
;
i
++
)
printf
(
"%s = %d "
,
s_GigNames
[
i
],
nObjs
[
i
]
);
printf
(
"%s = %d "
,
s_GigNames
[
i
],
nObjs
[
i
]
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Gia_ManPrintDelays
(
Vec_Int_t
*
vObjs
,
Vec_Int_t
*
vStore
)
{
Vec_Int_t
*
vFanCount
=
Vec_IntStart
(
Vec_IntSize
(
vObjs
)
+
100
);
int
i
,
*
pEntry
;
//, Counter = 0;
for
(
i
=
0
;
i
<
Vec_IntSize
(
vObjs
);
i
++
)
{
pEntry
=
Vec_IntEntryP
(
vStore
,
Vec_IntEntry
(
vObjs
,
i
)
);
if
(
pEntry
[
1
]
!=
GIG_SEL
)
continue
;
assert
(
pEntry
[
2
]
==
1
);
Vec_IntAddToEntry
(
vFanCount
,
pEntry
[
3
],
1
);
}
for
(
i
=
0
;
i
<
Vec_IntSize
(
vObjs
);
i
++
)
{
pEntry
=
Vec_IntEntryP
(
vStore
,
Vec_IntEntry
(
vObjs
,
i
)
);
if
(
pEntry
[
1
]
!=
GIG_DELAY
)
continue
;
printf
(
"(%d,%d,%d) "
,
pEntry
[
2
],
Vec_IntEntry
(
vFanCount
,
pEntry
[
0
]),
pEntry
[
3
+
pEntry
[
2
]]
);
}
printf
(
"
\n
"
);
Vec_IntFree
(
vFanCount
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManBuildGig2
(
Vec_Int_t
*
vObjs
,
Vec_Int_t
*
vStore
,
char
*
pFileName
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
int
*
nObjs
=
Gia_ManGigCount
(
vObjs
,
vStore
);
Vec_Int_t
*
vNets
=
Vec_IntAlloc
(
Vec_IntSize
(
vObjs
)
);
Vec_Int_t
*
vTypes
=
Vec_IntAlloc
(
Vec_IntSize
(
vObjs
)
);
Vec_Int_t
*
vMap
;
int
i
,
Type
;
// connect net IDs
for
(
i
=
0
;
i
<
Vec_IntSize
(
vObjs
);
i
++
)
{
Vec_IntPush
(
vNets
,
Vec_IntEntry
(
vStore
,
Vec_IntEntry
(
vObjs
,
i
))
);
Vec_IntPush
(
vTypes
,
Vec_IntEntry
(
vStore
,
Vec_IntEntry
(
vObjs
,
i
)
+
1
)
);
}
// create mapping for net IDs into GIA IDs
vMap
=
Vec_IntStartFull
(
Vec_IntFindMax
(
vNets
)
+
1
);
Vec_IntWriteEntry
(
vMap
,
0
,
0
);
Vec_IntWriteEntry
(
vMap
,
1
,
1
);
// create new manager
pNew
=
Gia_ManStart
(
Vec_IntSize
(
vObjs
)
);
pNew
->
pName
=
Abc_UtilStrsav
(
pFileName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
pFileName
);
// create primary inputs
for
(
i
=
0
;
i
<
Vec_IntSize
(
vObjs
);
i
++
)
if
(
Vec_IntEntry
(
vTypes
,
i
)
==
GIG_PI
)
Vec_IntWriteEntry
(
vMap
,
Vec_IntEntry
(
vNets
,
i
),
Gia_ManAppendCi
(
pNew
)
);
// create box outputs
for
(
i
=
0
;
i
<
Vec_IntSize
(
vObjs
);
i
++
)
if
(
Vec_IntEntry
(
vTypes
,
i
)
==
GIG_BOX
)
Vec_IntWriteEntry
(
vMap
,
Vec_IntEntry
(
vNets
,
i
),
Gia_ManAppendCi
(
pNew
)
);
// create internal nodes
Gia_ManHashAlloc
(
pNew
);
for
(
i
=
0
;
i
<
Vec_IntSize
(
vObjs
);
i
++
)
{
Type
=
Vec_IntEntry
(
vTypes
,
i
);
if
(
Type
!=
GIG_LUT
&&
Type
!=
GIG_DELAY
&&
Type
!=
GIG_BAR
)
continue
;
}
Vec_IntFree
(
vMap
);
Vec_IntFree
(
vNets
);
Vec_IntFree
(
vTypes
);
// rehash
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
return
pNew
;
}
Gia_Man_t
*
Gia_ManBuildGig
(
Vec_Int_t
*
vObjs
,
Vec_Int_t
*
vStore
,
char
*
pFileName
)
{
printf
(
"Parsed %d objects and %d tokens.
\n
"
,
Vec_IntSize
(
vObjs
),
Vec_IntSize
(
vStore
)
);
Gia_ManGigPrint
(
Gia_ManGigCount
(
vObjs
,
vStore
)
);
Gia_ManPrintDelays
(
vObjs
,
vStore
);
return
NULL
;
return
NULL
;
}
}
...
@@ -183,7 +285,7 @@ Gia_Man_t * Gia_ManReadGig( char * pFileName )
...
@@ -183,7 +285,7 @@ Gia_Man_t * Gia_ManReadGig( char * pFileName )
}
}
ABC_FREE
(
pBuffer
);
ABC_FREE
(
pBuffer
);
// create AIG
// create AIG
pNew
=
Gia_ManBuildGig
(
vObjs
,
vStore
);
pNew
=
Gia_ManBuildGig
(
vObjs
,
vStore
,
pFileName
);
// cleanup
// cleanup
Vec_IntFree
(
vObjs
);
Vec_IntFree
(
vObjs
);
Vec_IntFree
(
vStore
);
Vec_IntFree
(
vStore
);
...
...
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