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
c511bccb
Commit
c511bccb
authored
Jul 20, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for constraints in AIGER.
parent
5e7de1f8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
11 deletions
+97
-11
src/aig/gia/giaAiger.c
+96
-11
src/aig/gia/giaDup.c
+1
-0
No files found.
src/aig/gia/giaAiger.c
View file @
c511bccb
...
...
@@ -568,7 +568,7 @@ Gia_Man_t * Gia_ReadAiger2( char * pFileName, int fCheck )
***********************************************************************/
Gia_Man_t
*
Gia_ReadAigerFromMemory
(
char
*
pContents
,
int
nFileSize
,
int
fCheck
)
{
Gia_Man_t
*
pNew
;
Gia_Man_t
*
pNew
,
*
pTemp
;
Vec_Int_t
*
vLits
=
NULL
;
Vec_Int_t
*
vNodes
,
*
vDrivers
;
//, * vTerms;
int
iObj
,
iNode0
,
iNode1
;
...
...
@@ -680,16 +680,6 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck
Vec_IntFree
(
vLits
);
}
// create the POs
for
(
i
=
0
;
i
<
nOutputs
;
i
++
)
Gia_ManAppendCo
(
pNew
,
Vec_IntEntry
(
vDrivers
,
nLatches
+
i
)
);
for
(
i
=
0
;
i
<
nLatches
;
i
++
)
Gia_ManAppendCo
(
pNew
,
Vec_IntEntry
(
vDrivers
,
i
)
);
Vec_IntFree
(
vDrivers
);
// create the latches
Gia_ManSetRegNum
(
pNew
,
nLatches
);
// check if there are other types of information to read
pCur
=
pSymbols
;
if
(
(
char
*
)
pCur
+
1
<
pContents
+
nFileSize
&&
*
pCur
==
'c'
)
...
...
@@ -746,6 +736,7 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck
if
(
*
pCur
!=
'c'
)
{
int
fBreakUsed
=
0
;
char
*
pCurOld
=
pCur
;
pNew
->
vUserPiIds
=
Vec_IntStartFull
(
Gia_ManPiNum
(
pNew
)
);
pNew
->
vUserPoIds
=
Vec_IntStartFull
(
Gia_ManPoNum
(
pNew
)
);
pNew
->
vUserFfIds
=
Vec_IntStartFull
(
Gia_ManRegNum
(
pNew
)
);
...
...
@@ -792,12 +783,103 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck
// in case of abnormal termination, remove the arrays
if
(
fBreakUsed
)
{
char
*
pName
;
int
Entry
,
nInvars
,
nConstr
,
iTerm
;
Vec_Int_t
*
vPoNames
=
Vec_IntStartFull
(
nOutputs
);
Vec_IntFreeP
(
&
pNew
->
vUserPiIds
);
Vec_IntFreeP
(
&
pNew
->
vUserPoIds
);
Vec_IntFreeP
(
&
pNew
->
vUserFfIds
);
// try to figure out signal names
fBreakUsed
=
0
;
pCur
=
pCurOld
;
while
(
pCur
<
pContents
+
nFileSize
&&
*
pCur
!=
'c'
)
{
// get the terminal type
if
(
*
pCur
==
'i'
||
*
pCur
==
'l'
)
continue
;
if
(
*
pCur
!=
'o'
)
{
fprintf
(
stdout
,
"Wrong terminal type.
\n
"
);
fBreakUsed
=
1
;
break
;
}
// get the terminal number
iTerm
=
atoi
(
++
pCur
);
while
(
*
pCur
++
!=
' '
);
// get the node
if
(
iTerm
<
0
||
iTerm
>=
nOutputs
)
{
fprintf
(
stdout
,
"The output number (%d) is out of range.
\n
"
,
iTerm
);
fBreakUsed
=
1
;
break
;
}
if
(
Vec_IntEntry
(
vPoNames
,
iTerm
)
!=
~
0
)
{
fprintf
(
stdout
,
"The output number (%d) is listed twice.
\n
"
,
iTerm
);
fBreakUsed
=
1
;
break
;
}
// get the name
pName
=
pCur
;
while
(
*
pCur
++
!=
'\n'
);
*
(
pCur
-
1
)
=
0
;
// assign the name
Vec_IntWriteEntry
(
vPoNames
,
iTerm
,
pName
-
pContents
);
}
// check that all names are assigned
if
(
!
fBreakUsed
)
{
nInvars
=
nConstr
=
0
;
Vec_IntForEachEntry
(
vPoNames
,
Entry
,
i
)
{
if
(
Entry
==
~
0
)
continue
;
if
(
strncmp
(
pContents
+
Entry
,
"constraint:"
,
11
)
==
0
)
nConstr
++
;
if
(
strncmp
(
pContents
+
Entry
,
"invariant:"
,
10
)
==
0
)
nInvars
++
;
}
// move constraints forward in the PO list
if
(
nConstr
||
nInvars
)
{
int
k
=
nLatches
;
Vec_Int_t
*
vDriversCopy
=
Vec_IntDup
(
vDrivers
);
Vec_IntForEachEntry
(
vPoNames
,
Entry
,
i
)
if
(
Entry
==
~
0
||
(
strncmp
(
pContents
+
Entry
,
"constraint:"
,
11
)
!=
0
&&
strncmp
(
pContents
+
Entry
,
"invariant:"
,
10
)
!=
0
)
)
Vec_IntWriteEntry
(
vDrivers
,
k
++
,
Vec_IntEntry
(
vDriversCopy
,
nLatches
+
i
)
);
Vec_IntForEachEntry
(
vPoNames
,
Entry
,
i
)
if
(
Entry
!=
~
0
&&
strncmp
(
pContents
+
Entry
,
"constraint:"
,
11
)
==
0
)
Vec_IntWriteEntry
(
vDrivers
,
k
++
,
Vec_IntEntry
(
vDriversCopy
,
nLatches
+
i
)
^
1
);
// flip polarity!!!
// update the PO count
nOutputs
-=
nInvars
;
assert
(
k
==
nLatches
+
nOutputs
);
Vec_IntFree
(
vDriversCopy
);
// mark constraints
pNew
->
nConstrs
=
nConstr
;
}
if
(
nConstr
)
fprintf
(
stdout
,
"Recognized and added %d constraints.
\n
"
,
nConstr
);
if
(
nInvars
)
fprintf
(
stdout
,
"Recognized and skipped %d invariants.
\n
"
,
nInvars
);
}
Vec_IntFree
(
vPoNames
);
}
}
// create the POs
for
(
i
=
0
;
i
<
nOutputs
;
i
++
)
Gia_ManAppendCo
(
pNew
,
Vec_IntEntry
(
vDrivers
,
nLatches
+
i
)
);
for
(
i
=
0
;
i
<
nLatches
;
i
++
)
Gia_ManAppendCo
(
pNew
,
Vec_IntEntry
(
vDrivers
,
i
)
);
Vec_IntFree
(
vDrivers
);
// create the latches
Gia_ManSetRegNum
(
pNew
,
nLatches
);
// skipping the comments
Vec_IntFree
(
vNodes
);
...
...
@@ -810,6 +892,9 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck
return NULL;
}
*/
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
return
pNew
;
}
...
...
src/aig/gia/giaDup.c
View file @
c511bccb
...
...
@@ -521,6 +521,7 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
int
i
,
nRos
=
0
,
nRis
=
0
;
Gia_ManFillValue
(
p
);
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
->
nConstrs
=
p
->
nConstrs
;
pNew
->
pName
=
Gia_UtilStrsav
(
p
->
pName
);
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachObj1
(
p
,
pObj
,
i
)
...
...
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