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
c345a60e
Commit
c345a60e
authored
Nov 06, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with variable permutation.
parent
9382c8fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
20 deletions
+53
-20
src/aig/cnf/cnfWrite.c
+53
-20
No files found.
src/aig/cnf/cnfWrite.c
View file @
c345a60e
...
...
@@ -198,6 +198,7 @@ int Cnf_IsopWriteCube( int Cube, int nVars, int * pVars, int * pLiterals )
***********************************************************************/
Cnf_Dat_t
*
Cnf_ManWriteCnf
(
Cnf_Man_t
*
p
,
Vec_Ptr_t
*
vMapped
,
int
nOutputs
)
{
int
fChangeVariableOrder
=
0
;
// should be set to 0 to improve performance
Aig_Obj_t
*
pObj
;
Cnf_Dat_t
*
pCnf
;
Cnf_Cut_t
*
pCut
;
...
...
@@ -252,37 +253,69 @@ Cnf_Dat_t * Cnf_ManWriteCnf( Cnf_Man_t * p, Vec_Ptr_t * vMapped, int nOutputs )
pCnf
->
pClauses
=
ABC_ALLOC
(
int
*
,
nClauses
+
1
);
pCnf
->
pClauses
[
0
]
=
ABC_ALLOC
(
int
,
nLiterals
);
pCnf
->
pClauses
[
nClauses
]
=
pCnf
->
pClauses
[
0
]
+
nLiterals
;
// create room for variable numbers
pCnf
->
pVarNums
=
ABC_ALLOC
(
int
,
Aig_ManObjNumMax
(
p
->
pManAig
)
);
// memset( pCnf->pVarNums, 0xff, sizeof(int) * Aig_ManObjNumMax(p->pManAig) );
for
(
i
=
0
;
i
<
Aig_ManObjNumMax
(
p
->
pManAig
);
i
++
)
pCnf
->
pVarNums
[
i
]
=
-
1
;
// assign variables to the last (nOutputs) POs
Number
=
1
;
if
(
nOutputs
)
if
(
!
fChangeVariableOrder
)
{
if
(
Aig_ManRegNum
(
p
->
pManAig
)
==
0
)
// assign variables to the last (nOutputs) POs
Number
=
1
;
if
(
nOutputs
)
{
assert
(
nOutputs
==
Aig_ManPoNum
(
p
->
pManAig
)
);
Aig_ManForEachPo
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
if
(
Aig_ManRegNum
(
p
->
pManAig
)
==
0
)
{
assert
(
nOutputs
==
Aig_ManPoNum
(
p
->
pManAig
)
);
Aig_ManForEachPo
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
}
else
{
assert
(
nOutputs
==
Aig_ManRegNum
(
p
->
pManAig
)
);
Aig_ManForEachLiSeq
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
}
}
else
// assign variables to the internal nodes
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
vMapped
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
// assign variables to the PIs and constant node
Aig_ManForEachPi
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
pCnf
->
pVarNums
[
Aig_ManConst1
(
p
->
pManAig
)
->
Id
]
=
Number
++
;
pCnf
->
nVars
=
Number
;
}
else
{
// assign variables to the last (nOutputs) POs
Number
=
Aig_ManObjNumMax
(
p
->
pManAig
)
+
1
;
pCnf
->
nVars
=
Number
+
1
;
if
(
nOutputs
)
{
assert
(
nOutputs
==
Aig_ManRegNum
(
p
->
pManAig
)
);
Aig_ManForEachLiSeq
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
if
(
Aig_ManRegNum
(
p
->
pManAig
)
==
0
)
{
assert
(
nOutputs
==
Aig_ManPoNum
(
p
->
pManAig
)
);
Aig_ManForEachPo
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
--
;
}
else
{
assert
(
nOutputs
==
Aig_ManRegNum
(
p
->
pManAig
)
);
Aig_ManForEachLiSeq
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
--
;
}
}
// assign variables to the internal nodes
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
vMapped
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
--
;
// assign variables to the PIs and constant node
Aig_ManForEachPi
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
--
;
pCnf
->
pVarNums
[
Aig_ManConst1
(
p
->
pManAig
)
->
Id
]
=
Number
--
;
assert
(
Number
>=
0
);
}
// assign variables to the internal nodes
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
vMapped
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
// assign variables to the PIs and constant node
Aig_ManForEachPi
(
p
->
pManAig
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
pCnf
->
pVarNums
[
Aig_ManConst1
(
p
->
pManAig
)
->
Id
]
=
Number
++
;
pCnf
->
nVars
=
Number
;
// assign the clauses
vSopTemp
=
Vec_IntAlloc
(
1
<<
16
);
...
...
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