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
23229e03
Commit
23229e03
authored
Apr 02, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing the format mismatch in writing mapped GIA.
parent
7e852767
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
5 deletions
+66
-5
src/aig/gia/giaAiger.c
+9
-5
src/aig/gia/giaAigerExt.c
+57
-0
No files found.
src/aig/gia/giaAiger.c
View file @
23229e03
...
...
@@ -603,14 +603,17 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
{
extern
int
*
Gia_AigerReadMapping
(
unsigned
char
**
ppPos
,
int
nSize
);
extern
int
*
Gia_AigerReadMappingSimple
(
unsigned
char
**
ppPos
,
int
nSize
);
int
nSize
;
extern
int
*
Gia_AigerReadMappingDoc
(
unsigned
char
**
ppPos
,
int
nObjs
,
int
*
pOffset
);
int
nSize
,
nOffset
;
pCur
++
;
nSize
=
Gia_AigerReadInt
(
pCur
);
pCurTemp
=
pCur
+
nSize
+
4
;
pCur
+=
4
;
// pNew->pMapping = Gia_AigerReadMapping( &pCur, Gia_ManObjNum(pNew) );
pNew
->
pMapping
=
Gia_AigerReadMappingSimple
(
&
pCur
,
nSize
);
pNew
->
nOffset
=
nSize
/
4
;
pCur
+=
nSize
;
// pNew->pMapping = Gia_AigerReadMappingSimple( &pCur, nSize );
// pNew->nOffset = nSize / 4;
// pCur += nSize;
pNew
->
pMapping
=
Gia_AigerReadMappingDoc
(
&
pCur
,
Gia_ManObjNum
(
pNew
),
&
nOffset
);
pNew
->
nOffset
=
nOffset
;
assert
(
pCur
==
pCurTemp
);
if
(
fVerbose
)
printf
(
"Finished reading extension
\"
m
\"
.
\n
"
);
}
...
...
@@ -1185,8 +1188,9 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
{
extern
Vec_Str_t
*
Gia_AigerWriteMapping
(
Gia_Man_t
*
p
);
extern
Vec_Str_t
*
Gia_AigerWriteMappingSimple
(
Gia_Man_t
*
p
);
extern
Vec_Str_t
*
Gia_AigerWriteMappingDoc
(
Gia_Man_t
*
p
);
fprintf
(
pFile
,
"m"
);
vStrExt
=
Gia_AigerWriteMapping
Simple
(
p
);
vStrExt
=
Gia_AigerWriteMapping
Doc
(
p
);
Gia_FileWriteBufferSize
(
pFile
,
Vec_StrSize
(
vStrExt
)
);
fwrite
(
Vec_StrArray
(
vStrExt
),
1
,
Vec_StrSize
(
vStrExt
),
pFile
);
Vec_StrFree
(
vStrExt
);
...
...
src/aig/gia/giaAigerExt.c
View file @
23229e03
...
...
@@ -233,6 +233,63 @@ Vec_Str_t * Gia_AigerWriteMappingSimple( Gia_Man_t * p )
/**Function*************************************************************
Synopsis [Read/write mapping information.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
*
Gia_AigerReadMappingDoc
(
unsigned
char
**
ppPos
,
int
nObjs
,
int
*
pOffset
)
{
int
*
pMapping
,
nLuts
,
LutSize
,
iRoot
,
nFanins
,
i
,
k
;
nLuts
=
Gia_AigerReadInt
(
*
ppPos
);
*
ppPos
+=
4
;
LutSize
=
Gia_AigerReadInt
(
*
ppPos
);
*
ppPos
+=
4
;
pMapping
=
ABC_CALLOC
(
int
,
nObjs
+
(
LutSize
+
2
)
*
nLuts
);
*
pOffset
=
nObjs
;
for
(
i
=
0
;
i
<
nLuts
;
i
++
)
{
iRoot
=
Gia_AigerReadInt
(
*
ppPos
);
*
ppPos
+=
4
;
nFanins
=
Gia_AigerReadInt
(
*
ppPos
);
*
ppPos
+=
4
;
pMapping
[
iRoot
]
=
*
pOffset
;
// write one
pMapping
[
(
*
pOffset
)
++
]
=
nFanins
;
for
(
k
=
0
;
k
<
nFanins
;
k
++
)
{
pMapping
[
(
*
pOffset
)
++
]
=
Gia_AigerReadInt
(
*
ppPos
);
*
ppPos
+=
4
;
}
pMapping
[
(
*
pOffset
)
++
]
=
iRoot
;
}
return
pMapping
;
}
Vec_Str_t
*
Gia_AigerWriteMappingDoc
(
Gia_Man_t
*
p
)
{
unsigned
char
*
pBuffer
;
int
i
,
k
,
iFan
,
nLuts
=
0
,
LutSize
=
0
,
nSize
=
2
,
nSize2
=
0
;
Gia_ManForEachLut
(
p
,
i
)
{
nLuts
++
;
nSize
+=
Gia_ObjLutSize
(
p
,
i
)
+
2
;
LutSize
=
Abc_MaxInt
(
LutSize
,
Gia_ObjLutSize
(
p
,
i
)
);
}
pBuffer
=
ABC_ALLOC
(
unsigned
char
,
4
*
nSize
);
Gia_AigerWriteInt
(
pBuffer
+
4
*
nSize2
++
,
nLuts
);
Gia_AigerWriteInt
(
pBuffer
+
4
*
nSize2
++
,
LutSize
);
Gia_ManForEachLut
(
p
,
i
)
{
Gia_AigerWriteInt
(
pBuffer
+
4
*
nSize2
++
,
i
);
Gia_AigerWriteInt
(
pBuffer
+
4
*
nSize2
++
,
Gia_ObjLutSize
(
p
,
i
)
);
Gia_LutForEachFanin
(
p
,
i
,
iFan
,
k
)
Gia_AigerWriteInt
(
pBuffer
+
4
*
nSize2
++
,
iFan
);
}
assert
(
nSize2
==
nSize
);
return
Vec_StrAllocArray
(
(
char
*
)
pBuffer
,
4
*
nSize
);
}
/**Function*************************************************************
Synopsis [Read/write packing information.]
Description []
...
...
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