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
6d94b6b1
Commit
6d94b6b1
authored
Oct 01, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to bit-blaster.
parent
27b1e49d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
23 deletions
+88
-23
src/base/wlc/wlcBlast.c
+42
-14
src/base/wlc/wlcWriteVer.c
+46
-9
No files found.
src/base/wlc/wlcBlast.c
View file @
6d94b6b1
...
@@ -229,7 +229,16 @@ void Wlc_BlastSubtract( Gia_Man_t * pNew, int * pAdd0, int * pAdd1, int nBits )
...
@@ -229,7 +229,16 @@ void Wlc_BlastSubtract( Gia_Man_t * pNew, int * pAdd0, int * pAdd1, int nBits )
pAdd0
[
b
]
=
Gia_ManHashXor
(
pNew
,
top_bit
,
pAdd1
[
b
]);
pAdd0
[
b
]
=
Gia_ManHashXor
(
pNew
,
top_bit
,
pAdd1
[
b
]);
}
}
}
}
void
Wlc_BlastMinus
(
Gia_Man_t
*
pNew
,
int
*
pNum
,
int
nNum
,
Vec_Int_t
*
vRes
)
{
int
*
pRes
=
Wlc_VecCopy
(
vRes
,
pNum
,
nNum
);
int
i
,
invert
=
0
;
for
(
i
=
0
;
i
<
nNum
;
i
++
)
{
pRes
[
i
]
=
Gia_ManHashMux
(
pNew
,
invert
,
Abc_LitNot
(
pRes
[
i
]),
pRes
[
i
]
);
invert
=
Gia_ManHashOr
(
pNew
,
invert
,
pNum
[
i
]
);
}
}
void
Wlc_BlastMultiplier
(
Gia_Man_t
*
pNew
,
int
*
pArg0
,
int
*
pArg1
,
int
nBits
,
Vec_Int_t
*
vTemp
,
Vec_Int_t
*
vRes
)
void
Wlc_BlastMultiplier
(
Gia_Man_t
*
pNew
,
int
*
pArg0
,
int
*
pArg1
,
int
nBits
,
Vec_Int_t
*
vTemp
,
Vec_Int_t
*
vRes
)
{
{
int
i
,
j
;
int
i
,
j
;
...
@@ -292,9 +301,38 @@ void Wlc_BlastDivider( Gia_Man_t * pNew, int * pNum, int nNum, int * pDiv, int n
...
@@ -292,9 +301,38 @@ void Wlc_BlastDivider( Gia_Man_t * pNew, int * pNum, int nNum, int * pDiv, int n
}
}
void
Wlc_BlastDividerSigned
(
Gia_Man_t
*
pNew
,
int
*
pNum
,
int
nNum
,
int
*
pDiv
,
int
nDiv
,
int
fQuo
,
Vec_Int_t
*
vRes
)
void
Wlc_BlastDividerSigned
(
Gia_Man_t
*
pNew
,
int
*
pNum
,
int
nNum
,
int
*
pDiv
,
int
nDiv
,
int
fQuo
,
Vec_Int_t
*
vRes
)
{
{
int
iDiffSign
=
Gia_ManHashXor
(
pNew
,
pNum
[
nNum
-
1
],
pDiv
[
nDiv
-
1
]
);
Vec_Int_t
*
vNum
=
Vec_IntAlloc
(
nNum
);
Wlc_BlastDivider
(
pNew
,
pNum
,
nNum
-
1
,
pDiv
,
nDiv
-
1
,
fQuo
,
vRes
);
Vec_Int_t
*
vDiv
=
Vec_IntAlloc
(
nDiv
);
Vec_IntPush
(
vRes
,
iDiffSign
);
Vec_Int_t
*
vRes00
=
Vec_IntAlloc
(
nNum
);
Vec_Int_t
*
vRes01
=
Vec_IntAlloc
(
nNum
);
Vec_Int_t
*
vRes10
=
Vec_IntAlloc
(
nNum
);
Vec_Int_t
*
vRes11
=
Vec_IntAlloc
(
nNum
);
Vec_Int_t
*
vRes2
=
Vec_IntAlloc
(
nNum
);
int
k
,
iDiffSign
=
Gia_ManHashXor
(
pNew
,
pNum
[
nNum
-
1
],
pDiv
[
nDiv
-
1
]
);
Wlc_BlastMinus
(
pNew
,
pNum
,
nNum
,
vNum
);
Wlc_BlastMinus
(
pNew
,
pDiv
,
nDiv
,
vDiv
);
Wlc_BlastDivider
(
pNew
,
pNum
,
nNum
,
pDiv
,
nDiv
,
fQuo
,
vRes00
);
Wlc_BlastDivider
(
pNew
,
pNum
,
nNum
,
Vec_IntArray
(
vDiv
),
nDiv
,
fQuo
,
vRes01
);
Wlc_BlastDivider
(
pNew
,
Vec_IntArray
(
vNum
),
nNum
,
pDiv
,
nDiv
,
fQuo
,
vRes10
);
Wlc_BlastDivider
(
pNew
,
Vec_IntArray
(
vNum
),
nNum
,
Vec_IntArray
(
vDiv
),
nDiv
,
fQuo
,
vRes11
);
Vec_IntClear
(
vRes
);
for
(
k
=
0
;
k
<
nNum
;
k
++
)
{
int
Data0
=
Gia_ManHashMux
(
pNew
,
pDiv
[
nDiv
-
1
],
Vec_IntEntry
(
vRes01
,
k
),
Vec_IntEntry
(
vRes00
,
k
)
);
int
Data1
=
Gia_ManHashMux
(
pNew
,
pDiv
[
nDiv
-
1
],
Vec_IntEntry
(
vRes11
,
k
),
Vec_IntEntry
(
vRes10
,
k
)
);
Vec_IntPush
(
vRes
,
Gia_ManHashMux
(
pNew
,
pNum
[
nNum
-
1
],
Data1
,
Data0
)
);
}
Wlc_BlastMinus
(
pNew
,
Vec_IntArray
(
vRes
),
nNum
,
vRes2
);
for
(
k
=
0
;
k
<
nNum
;
k
++
)
Vec_IntWriteEntry
(
vRes
,
k
,
Gia_ManHashMux
(
pNew
,
fQuo
?
iDiffSign
:
pNum
[
nNum
-
1
],
Vec_IntEntry
(
vRes2
,
k
),
Vec_IntEntry
(
vRes
,
k
))
);
Vec_IntFree
(
vNum
);
Vec_IntFree
(
vDiv
);
Vec_IntFree
(
vRes00
);
Vec_IntFree
(
vRes01
);
Vec_IntFree
(
vRes10
);
Vec_IntFree
(
vRes11
);
Vec_IntFree
(
vRes2
);
assert
(
Vec_IntSize
(
vRes
)
==
nNum
);
}
}
void
Wlc_BlastZeroCondition
(
Gia_Man_t
*
pNew
,
int
*
pDiv
,
int
nDiv
,
Vec_Int_t
*
vRes
)
void
Wlc_BlastZeroCondition
(
Gia_Man_t
*
pNew
,
int
*
pDiv
,
int
nDiv
,
Vec_Int_t
*
vRes
)
{
{
...
@@ -302,16 +340,6 @@ void Wlc_BlastZeroCondition( Gia_Man_t * pNew, int * pDiv, int nDiv, Vec_Int_t *
...
@@ -302,16 +340,6 @@ void Wlc_BlastZeroCondition( Gia_Man_t * pNew, int * pDiv, int nDiv, Vec_Int_t *
Vec_IntForEachEntry
(
vRes
,
Entry
,
i
)
Vec_IntForEachEntry
(
vRes
,
Entry
,
i
)
Vec_IntWriteEntry
(
vRes
,
i
,
Gia_ManHashAnd
(
pNew
,
iLit
,
Entry
)
);
Vec_IntWriteEntry
(
vRes
,
i
,
Gia_ManHashAnd
(
pNew
,
iLit
,
Entry
)
);
}
}
void
Wlc_BlastMinus
(
Gia_Man_t
*
pNew
,
int
*
pNum
,
int
nNum
,
Vec_Int_t
*
vRes
)
{
int
*
pRes
=
Wlc_VecCopy
(
vRes
,
pNum
,
nNum
);
int
i
,
invert
=
0
;
for
(
i
=
0
;
i
<
nNum
;
i
++
)
{
pRes
[
i
]
=
Gia_ManHashMux
(
pNew
,
invert
,
Abc_LitNot
(
pRes
[
i
]),
pRes
[
i
]
);
invert
=
Gia_ManHashOr
(
pNew
,
invert
,
pNum
[
i
]
);
}
}
void
Wlc_BlastTable
(
Gia_Man_t
*
pNew
,
word
*
pTable
,
int
*
pFans
,
int
nFans
,
int
nOuts
,
Vec_Int_t
*
vRes
)
void
Wlc_BlastTable
(
Gia_Man_t
*
pNew
,
word
*
pTable
,
int
*
pFans
,
int
nFans
,
int
nOuts
,
Vec_Int_t
*
vRes
)
{
{
extern
int
Kit_TruthToGia
(
Gia_Man_t
*
pMan
,
unsigned
*
pTruth
,
int
nVars
,
Vec_Int_t
*
vMemory
,
Vec_Int_t
*
vLeaves
,
int
fHash
);
extern
int
Kit_TruthToGia
(
Gia_Man_t
*
pMan
,
unsigned
*
pTruth
,
int
nVars
,
Vec_Int_t
*
vMemory
,
Vec_Int_t
*
vLeaves
,
int
fHash
);
...
...
src/base/wlc/wlcWriteVer.c
View file @
6d94b6b1
...
@@ -96,6 +96,31 @@ void Wlc_WriteTables( FILE * pFile, Wlc_Ntk_t * p )
...
@@ -96,6 +96,31 @@ void Wlc_WriteTables( FILE * pFile, Wlc_Ntk_t * p )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Wlc_WriteAddPos
(
Wlc_Ntk_t
*
p
)
{
Wlc_Obj_t
*
pObj
;
int
i
;
Vec_IntClear
(
&
p
->
vPos
);
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
if
(
pObj
->
Type
!=
WLC_OBJ_PI
&&
pObj
->
Type
!=
WLC_OBJ_MUX
)
{
pObj
->
fIsPo
=
1
;
Vec_IntPush
(
&
p
->
vPos
,
Wlc_ObjId
(
p
,
pObj
)
);
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Wlc_WriteVerIntVec
(
FILE
*
pFile
,
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vVec
,
int
Start
)
void
Wlc_WriteVerIntVec
(
FILE
*
pFile
,
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vVec
,
int
Start
)
{
{
char
*
pName
;
char
*
pName
;
...
@@ -156,16 +181,27 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
...
@@ -156,16 +181,27 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
fprintf
(
pFile
,
"output "
);
fprintf
(
pFile
,
"output "
);
else
else
fprintf
(
pFile
,
" "
);
fprintf
(
pFile
,
" "
);
if
(
Wlc_ObjIsCi
(
pObj
)
)
if
(
Wlc_ObjIsCi
(
pObj
)
||
pObj
->
fIsPo
)
fprintf
(
pFile
,
"wire %s %s"
,
Range
,
pName
);
{
else
if
(
pObj
->
Type
==
WLC_OBJ_TABLE
)
fprintf
(
pFile
,
"wire %s %s ;
\n
"
,
Range
,
pName
);
if
(
Wlc_ObjIsCi
(
pObj
)
)
continue
;
Range
[
0
]
=
0
;
}
if
(
pObj
->
fIsPo
)
fprintf
(
pFile
,
" assign "
);
else
if
(
pObj
->
Type
==
WLC_OBJ_MUX
&&
Wlc_ObjFaninNum
(
pObj
)
>
3
)
fprintf
(
pFile
,
"reg "
);
else
fprintf
(
pFile
,
"wire "
);
if
(
pObj
->
Type
==
WLC_OBJ_TABLE
)
{
{
// wire [3:0] s4972; table0 s4972_Index(s4971, s4972);
// wire [3:0] s4972; table0 s4972_Index(s4971, s4972);
fprintf
(
pFile
,
"
wire
%s %s ; table%d s%d_Index(%s, %s)"
,
Range
,
pName
,
Wlc_ObjTableId
(
pObj
),
i
,
pName0
,
pName
);
fprintf
(
pFile
,
"%s %s ; table%d s%d_Index(%s, %s)"
,
Range
,
pName
,
Wlc_ObjTableId
(
pObj
),
i
,
pName0
,
pName
);
}
}
else
if
(
pObj
->
Type
==
WLC_OBJ_CONST
)
else
if
(
pObj
->
Type
==
WLC_OBJ_CONST
)
{
{
fprintf
(
pFile
,
"
wire
%s %-16s = %d
\'
%sh"
,
Range
,
pName
,
Wlc_ObjRange
(
pObj
),
pObj
->
Signed
?
"s"
:
""
);
fprintf
(
pFile
,
"%s %-16s = %d
\'
%sh"
,
Range
,
pName
,
Wlc_ObjRange
(
pObj
),
pObj
->
Signed
?
"s"
:
""
);
Abc_TtPrintHexArrayRev
(
pFile
,
(
word
*
)
Wlc_ObjConstValue
(
pObj
),
(
Wlc_ObjRange
(
pObj
)
+
3
)
/
4
);
Abc_TtPrintHexArrayRev
(
pFile
,
(
word
*
)
Wlc_ObjConstValue
(
pObj
),
(
Wlc_ObjRange
(
pObj
)
+
3
)
/
4
);
}
}
else
if
(
pObj
->
Type
==
WLC_OBJ_ROTATE_R
||
pObj
->
Type
==
WLC_OBJ_ROTATE_L
)
else
if
(
pObj
->
Type
==
WLC_OBJ_ROTATE_R
||
pObj
->
Type
==
WLC_OBJ_ROTATE_L
)
...
@@ -184,7 +220,7 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
...
@@ -184,7 +220,7 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
}
}
else
if
(
pObj
->
Type
==
WLC_OBJ_MUX
&&
Wlc_ObjFaninNum
(
pObj
)
>
3
)
else
if
(
pObj
->
Type
==
WLC_OBJ_MUX
&&
Wlc_ObjFaninNum
(
pObj
)
>
3
)
{
{
fprintf
(
pFile
,
"
reg
%s ;
\n
"
,
pName
);
fprintf
(
pFile
,
"%s ;
\n
"
,
pName
);
fprintf
(
pFile
,
" "
);
fprintf
(
pFile
,
" "
);
fprintf
(
pFile
,
"always @( "
);
fprintf
(
pFile
,
"always @( "
);
Wlc_ObjForEachFanin
(
pObj
,
iFanin
,
k
)
Wlc_ObjForEachFanin
(
pObj
,
iFanin
,
k
)
...
@@ -208,11 +244,13 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
...
@@ -208,11 +244,13 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
}
}
else
else
{
{
fprintf
(
pFile
,
"
wire
%s %-16s = "
,
Range
,
Wlc_ObjName
(
p
,
i
)
);
fprintf
(
pFile
,
"%s %-16s = "
,
Range
,
Wlc_ObjName
(
p
,
i
)
);
if
(
pObj
->
Type
==
WLC_OBJ_BUF
)
if
(
pObj
->
Type
==
WLC_OBJ_BUF
)
fprintf
(
pFile
,
"%s"
,
pName0
);
fprintf
(
pFile
,
"%s"
,
pName0
);
else
if
(
pObj
->
Type
==
WLC_OBJ_MUX
)
else
if
(
pObj
->
Type
==
WLC_OBJ_MUX
)
fprintf
(
pFile
,
"%s ? %s : %s"
,
pName0
,
Wlc_ObjName
(
p
,
Wlc_ObjFaninId2
(
pObj
)),
Wlc_ObjName
(
p
,
Wlc_ObjFaninId1
(
pObj
))
);
fprintf
(
pFile
,
"%s ? %s : %s"
,
pName0
,
Wlc_ObjName
(
p
,
Wlc_ObjFaninId2
(
pObj
)),
Wlc_ObjName
(
p
,
Wlc_ObjFaninId1
(
pObj
))
);
else
if
(
pObj
->
Type
==
WLC_OBJ_ARI_MINUS
)
fprintf
(
pFile
,
"-%s"
,
pName0
);
else
if
(
pObj
->
Type
==
WLC_OBJ_BIT_NOT
)
else
if
(
pObj
->
Type
==
WLC_OBJ_BIT_NOT
)
fprintf
(
pFile
,
"~%s"
,
pName0
);
fprintf
(
pFile
,
"~%s"
,
pName0
);
else
if
(
pObj
->
Type
==
WLC_OBJ_LOGIC_NOT
)
else
if
(
pObj
->
Type
==
WLC_OBJ_LOGIC_NOT
)
...
@@ -293,8 +331,6 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
...
@@ -293,8 +331,6 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
assert
(
i
==
Wlc_ObjCiId
(
pObj
)
);
assert
(
i
==
Wlc_ObjCiId
(
pObj
)
);
if
(
pObj
->
Type
==
WLC_OBJ_PI
)
if
(
pObj
->
Type
==
WLC_OBJ_PI
)
continue
;
continue
;
// CPL_FF#9 I_32890_reg ( .q ( E_42304 ) , .qbar ( ) , .d ( E_42305 ) , .clk ( E_65040 ) ,
// .arst ( E_65037 ) , .arstval ( E_62126 ) );
fprintf
(
pFile
,
" "
);
fprintf
(
pFile
,
" "
);
fprintf
(
pFile
,
"CPL_FF"
);
fprintf
(
pFile
,
"CPL_FF"
);
if
(
Wlc_ObjRange
(
pObj
)
>
1
)
if
(
Wlc_ObjRange
(
pObj
)
>
1
)
...
@@ -322,6 +358,7 @@ void Wlc_WriteVer( Wlc_Ntk_t * p, char * pFileName )
...
@@ -322,6 +358,7 @@ void Wlc_WriteVer( Wlc_Ntk_t * p, char * pFileName )
fprintf
(
pFile
,
"// Benchmark
\"
%s
\"
written by ABC on %s
\n
"
,
p
->
pName
,
Extra_TimeStamp
()
);
fprintf
(
pFile
,
"// Benchmark
\"
%s
\"
written by ABC on %s
\n
"
,
p
->
pName
,
Extra_TimeStamp
()
);
fprintf
(
pFile
,
"
\n
"
);
fprintf
(
pFile
,
"
\n
"
);
Wlc_WriteTables
(
pFile
,
p
);
Wlc_WriteTables
(
pFile
,
p
);
// Wlc_WriteAddPos( p );
Wlc_WriteVerInt
(
pFile
,
p
);
Wlc_WriteVerInt
(
pFile
,
p
);
fprintf
(
pFile
,
"
\n
"
);
fprintf
(
pFile
,
"
\n
"
);
fclose
(
pFile
);
fclose
(
pFile
);
...
...
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