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
67c47fa4
Commit
67c47fa4
authored
Aug 22, 2021
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding input/output/flop name reading in command &r.
parent
625ccde6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
153 additions
and
2 deletions
+153
-2
src/aig/gia/giaAiger.c
+113
-0
src/aig/gia/giaDeep.c
+1
-1
src/aig/gia/giaUtil.c
+0
-1
src/base/acb/acbFunc.c
+39
-0
No files found.
src/aig/gia/giaAiger.c
View file @
67c47fa4
...
...
@@ -176,6 +176,7 @@ Vec_Str_t * Gia_AigerWriteLiterals( Vec_Int_t * vLits )
Gia_Man_t
*
Gia_AigerReadFromMemory
(
char
*
pContents
,
int
nFileSize
,
int
fGiaSimple
,
int
fSkipStrash
,
int
fCheck
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Vec_Ptr_t
*
vNamesIn
=
NULL
,
*
vNamesOut
=
NULL
,
*
vNamesRegIn
=
NULL
,
*
vNamesRegOut
=
NULL
;
Vec_Int_t
*
vLits
=
NULL
,
*
vPoTypes
=
NULL
;
Vec_Int_t
*
vNodes
,
*
vDrivers
,
*
vInits
=
NULL
;
int
iObj
,
iNode0
,
iNode1
,
fHieOnly
=
0
;
...
...
@@ -377,6 +378,88 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSi
pCur
=
pSymbols
;
if
(
pCur
<
(
unsigned
char
*
)
pContents
+
nFileSize
&&
*
pCur
!=
'c'
)
{
int
fReadNames
=
1
;
if
(
fReadNames
)
{
int
fError
=
0
;
while
(
!
fError
&&
pCur
<
(
unsigned
char
*
)
pContents
+
nFileSize
&&
*
pCur
!=
'c'
)
{
int
iTerm
;
char
*
pType
=
(
char
*
)
pCur
;
char
*
pName
=
NULL
;
// check terminal type
if
(
*
pCur
!=
'i'
&&
*
pCur
!=
'o'
&&
*
pCur
!=
'l'
)
{
fError
=
1
;
break
;
}
// get terminal number
iTerm
=
atoi
(
(
char
*
)
++
pCur
);
while
(
*
pCur
++
!=
' '
);
// skip spaces
while
(
*
pCur
==
' '
)
pCur
++
;
// skip till the end of line
for
(
pName
=
pCur
;
*
pCur
&&
*
pCur
!=
'\n'
;
pCur
++
);
if
(
*
pCur
==
'\n'
)
*
pCur
=
0
;
// save the name
if
(
*
pType
==
'i'
)
{
if
(
vNamesIn
==
NULL
)
vNamesIn
=
Vec_PtrAlloc
(
nInputs
+
nLatches
);
if
(
Vec_PtrSize
(
vNamesIn
)
!=
iTerm
)
{
fError
=
1
;
break
;
}
Vec_PtrPush
(
vNamesIn
,
Abc_UtilStrsav
(
pName
)
);
}
else
if
(
*
pType
==
'o'
)
{
if
(
vNamesOut
==
NULL
)
vNamesOut
=
Vec_PtrAlloc
(
nOutputs
+
nLatches
);
if
(
Vec_PtrSize
(
vNamesOut
)
!=
iTerm
)
{
fError
=
1
;
break
;
}
Vec_PtrPush
(
vNamesOut
,
Abc_UtilStrsav
(
pName
)
);
}
else
if
(
*
pType
==
'l'
)
{
char
Buffer
[
1000
];
assert
(
strlen
(
pName
)
<
995
);
sprintf
(
Buffer
,
"%s_in"
,
pName
);
if
(
vNamesRegIn
==
NULL
)
vNamesRegIn
=
Vec_PtrAlloc
(
nLatches
);
if
(
vNamesRegOut
==
NULL
)
vNamesRegOut
=
Vec_PtrAlloc
(
nLatches
);
if
(
Vec_PtrSize
(
vNamesRegIn
)
!=
iTerm
)
{
fError
=
1
;
break
;
}
Vec_PtrPush
(
vNamesRegIn
,
Abc_UtilStrsav
(
Buffer
)
);
Vec_PtrPush
(
vNamesRegOut
,
Abc_UtilStrsav
(
pName
)
);
}
else
{
fError
=
1
;
break
;
}
pCur
++
;
}
if
(
fError
)
{
printf
(
"Error occurred when reading signal names.
\n
"
);
if
(
vNamesIn
)
Vec_PtrFreeFree
(
vNamesIn
),
vNamesIn
=
NULL
;
if
(
vNamesOut
)
Vec_PtrFreeFree
(
vNamesOut
),
vNamesOut
=
NULL
;
if
(
vNamesRegIn
)
Vec_PtrFreeFree
(
vNamesRegIn
),
vNamesRegIn
=
NULL
;
if
(
vNamesRegOut
)
Vec_PtrFreeFree
(
vNamesRegOut
),
vNamesRegOut
=
NULL
;
}
}
else
{
int
fBreakUsed
=
0
;
unsigned
char
*
pCurOld
=
pCur
;
pNew
->
vUserPiIds
=
Vec_IntStartFull
(
nInputs
);
...
...
@@ -505,6 +588,7 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSi
}
Vec_IntFree
(
vPoNames
);
}
}
}
...
...
@@ -867,6 +951,35 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSi
Abc_Print
(
0
,
"Structural hashing enabled while reading AIGER invalidated the mapping. Consider using
\"
&r -s
\"
.
\n
"
);
Vec_IntFreeP
(
&
pNew
->
vMapping
);
}
if
(
vNamesIn
&&
Gia_ManPiNum
(
pNew
)
!=
Vec_PtrSize
(
vNamesIn
)
)
Abc_Print
(
0
,
"The number of inputs does not match the number of input names.
\n
"
);
else
if
(
vNamesOut
&&
Gia_ManPoNum
(
pNew
)
!=
Vec_PtrSize
(
vNamesOut
)
)
Abc_Print
(
0
,
"The number of output does not match the number of output names.
\n
"
);
else
if
(
vNamesRegOut
&&
Gia_ManRegNum
(
pNew
)
!=
Vec_PtrSize
(
vNamesRegOut
)
)
Abc_Print
(
0
,
"The number of inputs does not match the number of flop names.
\n
"
);
else
if
(
vNamesIn
&&
vNamesOut
)
{
pNew
->
vNamesIn
=
vNamesIn
;
vNamesIn
=
NULL
;
pNew
->
vNamesOut
=
vNamesOut
;
vNamesOut
=
NULL
;
if
(
vNamesRegOut
)
{
Vec_PtrAppend
(
pNew
->
vNamesIn
,
vNamesRegOut
);
Vec_PtrClear
(
vNamesRegOut
);
Vec_PtrFree
(
vNamesRegOut
);
vNamesRegOut
=
NULL
;
}
if
(
vNamesRegIn
)
{
Vec_PtrAppend
(
pNew
->
vNamesOut
,
vNamesRegIn
);
Vec_PtrClear
(
vNamesRegIn
);
Vec_PtrFree
(
vNamesRegIn
);
vNamesRegIn
=
NULL
;
}
}
if
(
vNamesIn
)
Vec_PtrFreeFree
(
vNamesIn
);
if
(
vNamesOut
)
Vec_PtrFreeFree
(
vNamesOut
);
if
(
vNamesRegIn
)
Vec_PtrFreeFree
(
vNamesRegIn
);
if
(
vNamesRegOut
)
Vec_PtrFreeFree
(
vNamesRegOut
);
return
pNew
;
}
...
...
src/aig/gia/giaDeep.c
View file @
67c47fa4
...
...
@@ -73,7 +73,7 @@ Gia_Man_t * Gia_ManDeepSynOne( int nNoImpr, int TimeOut, int nAnds, int Seed, in
else
if
(
fCom
==
0
)
pComp
=
"; &dc2"
;
sprintf
(
Command
,
"&dch%s; &if -a -K %d; &mfs -e -W 20 -L 20%s%s"
,
fDch
?
" -f"
:
""
,
KLut
,
fFx
?
"; &fx"
:
""
,
pComp
);
fDch
?
" -f"
:
""
,
KLut
,
fFx
?
"; &fx
; &st
"
:
""
,
pComp
);
if
(
Abc_FrameIsBatchMode
()
)
{
if
(
Cmd_CommandExecute
(
Abc_FrameGetGlobalFrame
(),
Command
)
)
...
...
src/aig/gia/giaUtil.c
View file @
67c47fa4
...
...
@@ -2937,7 +2937,6 @@ Gia_Man_t * Gia_ManConvertSupp( Gia_Man_t * p )
***********************************************************************/
Gia_Man_t
*
Gia_ManTransformCond2
(
Gia_Man_t
*
p
)
{
int
fOnly1
=
0
;
int
fVerbose
=
1
;
abctime
clk
=
Abc_Clock
();
Gia_Man_t
*
pNew
,
*
pTemp
;
...
...
src/base/acb/acbFunc.c
View file @
67c47fa4
...
...
@@ -776,6 +776,31 @@ Gia_Man_t * Acb_NtkToGia( Acb_Ntk_t * p, Vec_Int_t * vSupp, Vec_Int_t * vNodes,
Gia_ManStop
(
pOne
);
return
pNew
;
}
int
Acb_NtkSaveNames
(
Acb_Ntk_t
*
p
,
Vec_Int_t
*
vSupp
,
Vec_Int_t
*
vNodes
,
Vec_Int_t
*
vRoots
,
Vec_Int_t
*
vDivs
,
Vec_Int_t
*
vTargets
,
Gia_Man_t
*
pNew
)
{
int
i
,
iObj
;
assert
(
pNew
->
vNamesIn
==
NULL
);
pNew
->
vNamesIn
=
Vec_PtrAlloc
(
Gia_ManCiNum
(
pNew
)
);
Acb_NtkForEachCiVec
(
vSupp
,
p
,
iObj
,
i
)
Vec_PtrPush
(
pNew
->
vNamesIn
,
Abc_UtilStrsav
(
Acb_ObjNameStr
(
p
,
iObj
))
);
if
(
vTargets
)
Vec_IntForEachEntry
(
vTargets
,
iObj
,
i
)
Vec_PtrPush
(
pNew
->
vNamesIn
,
Abc_UtilStrsav
(
Acb_ObjNameStr
(
p
,
iObj
))
);
pNew
->
vNamesOut
=
Vec_PtrAlloc
(
Gia_ManCoNum
(
pNew
)
);
Acb_NtkForEachCoDriverVec
(
vRoots
,
p
,
iObj
,
i
)
Vec_PtrPush
(
pNew
->
vNamesOut
,
Abc_UtilStrsav
(
Acb_ObjNameStr
(
p
,
iObj
))
);
if
(
vDivs
)
Vec_IntForEachEntry
(
vDivs
,
iObj
,
i
)
{
char
Buffer
[
100
];
assert
(
strlen
(
Acb_ObjNameStr
(
p
,
iObj
))
<
90
);
sprintf
(
Buffer
,
"%s_%d"
,
Acb_ObjNameStr
(
p
,
iObj
),
Acb_ObjWeight
(
p
,
iObj
)
);
Vec_PtrPush
(
pNew
->
vNamesOut
,
Abc_UtilStrsav
(
Buffer
)
);
}
return
1
;
}
/**Function*************************************************************
...
...
@@ -2622,6 +2647,10 @@ int Acb_NtkEcoPerform( Acb_Ntk_t * pNtkF, Acb_Ntk_t * pNtkG, char * pFileName[4]
char
*
pSop
=
NULL
;
int
i
;
// int Value = Acb_NtkSaveNames( pNtkF, vSupp, vNodesF, vRoots, vDivs, &pNtkF->vTargets, pGiaF );
// Gia_AigerWrite( pGiaF, pFileBase, 0, 0, 0 );
// return 0;
if
(
fVerbose
)
{
printf
(
"The number of targets = %d.
\n
"
,
nTargets
);
...
...
@@ -2770,6 +2799,16 @@ int Acb_NtkEcoPerform( Acb_Ntk_t * pNtkF, Acb_Ntk_t * pNtkG, char * pFileName[4]
if
(
pFileName
[
3
]
==
NULL
)
Acb_GenerateFilePatch
(
vPatch
,
"patch.v"
);
Acb_GenerateFileOut
(
vInst
,
pFileName
[
0
],
pFileName
[
3
]
?
pFileName
[
3
]
:
(
char
*
)
"out.v"
,
vPatch
);
printf
(
"Finished dumping resulting file
\"
%s
\"
.
\n\n
"
,
pFileName
[
3
]
?
pFileName
[
3
]
:
"out.v"
);
/*
{
char * pFileBase = Extra_FileNameGenericAppend( pFileName[0], "_patch.v" );
Acb_GenerateFilePatch( vPatch, pFileBase );
pFileBase = Extra_FileNameGenericAppend( pFileName[0], "_out.v" );
Acb_GenerateFileOut( vInst, pFileName[0], pFileName[3] ? pFileName[3] : pFileBase, vPatch );
Acb_GenerateFileOut( vInst, pFileName[0], pFileName[3] ? pFileName[3] : "out.v", vPatch );
printf( "Finished dumping resulting file \"%s\".\n\n", pFileName[3] ? pFileName[3] : pFileBase );
}
*/
//Gia_AigerWrite( pGiaG, "test.aig", 0, 0, 0 );
cleanup:
// cleanup
...
...
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