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
52a8ebb4
Commit
52a8ebb4
authored
Oct 05, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding bit-blasting of sqrt using non-restoring algorithm (Parhami, 2nd ed, p. 452)
parent
4dc569c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
3 deletions
+40
-3
src/base/wlc/wlc.h
+1
-0
src/base/wlc/wlcBlast.c
+33
-1
src/base/wlc/wlcCom.c
+6
-2
No files found.
src/base/wlc/wlc.h
View file @
52a8ebb4
...
...
@@ -214,6 +214,7 @@ struct Wlc_BstPar_t_
int
fAddOutputs
;
int
fMulti
;
int
fBooth
;
int
fNonRest
;
int
fCla
;
int
fNoCleanup
;
int
fCreateMiter
;
...
...
src/base/wlc/wlcBlast.c
View file @
52a8ebb4
...
...
@@ -773,6 +773,35 @@ void Wlc_BlastSqrt( Gia_Man_t * pNew, int * pNum, int nNum, Vec_Int_t * vTmp, Ve
}
Vec_IntReverseOrder
(
vRes
);
}
void
Wlc_BlastSqrtNR
(
Gia_Man_t
*
pNew
,
int
*
pNum
,
int
nNum
,
Vec_Int_t
*
vTmp
,
Vec_Int_t
*
vRes
)
{
int
*
pSqr
,
*
pRem
,
*
pIn1
;
int
i
,
k
,
Carry
=
1
;
assert
(
nNum
%
2
==
0
);
Vec_IntFill
(
vRes
,
nNum
/
2
,
0
);
Vec_IntFill
(
vTmp
,
2
*
nNum
,
0
);
pSqr
=
Vec_IntArray
(
vRes
);
pRem
=
Vec_IntArray
(
vTmp
);
pIn1
=
pRem
+
nNum
;
for
(
i
=
0
;
i
<
nNum
/
2
;
i
++
)
{
int
SqrPrev
=
Carry
;
assert
(
pIn1
[
0
]
==
0
);
for
(
k
=
1
;
k
<
i
;
k
++
)
pIn1
[
k
]
=
0
;
for
(
k
=
i
;
k
<
2
*
i
;
k
++
)
pIn1
[
k
]
=
pSqr
[
k
-
i
];
pIn1
[
k
++
]
=
Abc_LitNot
(
Carry
);
pIn1
[
k
++
]
=
1
;
assert
(
k
==
2
*
i
+
2
);
pRem
[
2
*
i
+
0
]
=
pNum
[
nNum
-
2
*
i
-
1
];
pRem
[
2
*
i
+
1
]
=
pNum
[
nNum
-
2
*
i
-
2
];
for
(
k
=
2
*
i
+
1
;
k
>=
0
;
k
--
)
Wlc_BlastFullAdder
(
pNew
,
Gia_ManHashXor
(
pNew
,
SqrPrev
,
pIn1
[
k
]),
pRem
[
k
],
Carry
,
&
Carry
,
&
pRem
[
k
]
);
pSqr
[
i
]
=
Carry
;
}
Vec_IntReverseOrder
(
vRes
);
}
void
Wlc_IntInsert
(
Vec_Int_t
*
vProd
,
Vec_Int_t
*
vLevel
,
int
Node
,
int
Level
)
{
int
i
;
...
...
@@ -1794,7 +1823,10 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
{
int
*
pArg0
=
Wlc_VecLoadFanins
(
vTemp0
,
pFans0
,
nRange0
,
nRange0
+
(
nRange0
&
1
),
0
);
nRange0
+=
(
nRange0
&
1
);
Wlc_BlastSqrt
(
pNew
,
pArg0
,
nRange0
,
vTemp2
,
vRes
);
if
(
pPar
->
fNonRest
)
Wlc_BlastSqrtNR
(
pNew
,
pArg0
,
nRange0
,
vTemp2
,
vRes
);
else
Wlc_BlastSqrt
(
pNew
,
pArg0
,
nRange0
,
vTemp2
,
vRes
);
if
(
nRange
>
Vec_IntSize
(
vRes
)
)
Vec_IntFillExtra
(
vRes
,
nRange
,
0
);
else
...
...
src/base/wlc/wlcCom.c
View file @
52a8ebb4
...
...
@@ -1037,7 +1037,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Wlc_BstParDefault
(
pPar
);
pPar
->
nOutputRange
=
2
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"ORAMcombadestnizvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"ORAMcomb
q
adestnizvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -1097,6 +1097,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'b'
:
pPar
->
fBooth
^=
1
;
break
;
case
'q'
:
pPar
->
fNonRest
^=
1
;
break
;
case
'a'
:
pPar
->
fCla
^=
1
;
break
;
...
...
@@ -1195,7 +1198,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_FrameUpdateGia
(
pAbc
,
pNew
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: %%blast [-ORAM num] [-combadestnizvh]
\n
"
);
Abc_Print
(
-
2
,
"usage: %%blast [-ORAM num] [-comb
q
adestnizvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs bit-blasting of the word-level design
\n
"
);
Abc_Print
(
-
2
,
"
\t
-O num : zero-based index of the first word-level PO to bit-blast [default = %d]
\n
"
,
pPar
->
iOutput
);
Abc_Print
(
-
2
,
"
\t
-R num : the total number of word-level POs to bit-blast [default = %d]
\n
"
,
pPar
->
nOutputRange
);
...
...
@@ -1205,6 +1208,7 @@ usage:
Abc_Print
(
-
2
,
"
\t
-o : toggle using additional POs on the word-level boundaries [default = %s]
\n
"
,
pPar
->
fAddOutputs
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-m : toggle creating boxes for all multipliers in the design [default = %s]
\n
"
,
pPar
->
fMulti
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-b : toggle generating radix-4 Booth multipliers [default = %s]
\n
"
,
pPar
->
fBooth
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-q : toggle generating non-restoring square root [default = %s]
\n
"
,
pPar
->
fNonRest
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-a : toggle generating carry-look-ahead adder [default = %s]
\n
"
,
pPar
->
fCla
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-d : toggle creating dual-output multi-output miter [default = %s]
\n
"
,
pPar
->
fCreateMiter
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-e : toggle creating miter with output word bits combined [default = %s]
\n
"
,
pPar
->
fCreateWordMiter
?
"yes"
:
"no"
);
...
...
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