Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BSD
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
chengshuyao
BSD
Commits
b0da060e
Commit
b0da060e
authored
Dec 10, 2025
by
chengshuyao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rebuild oneway correct
parent
e97178bf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
25 deletions
+67
-25
src/BSD.cpp
+2
-2
src/BSD.h
+21
-8
src/io_generator_vec/c432_vec.h
+0
-0
src/tool_function.h
+41
-14
src/top.h
+3
-1
No files found.
src/BSD.cpp
View file @
b0da060e
...
...
@@ -184,8 +184,8 @@ int main(int argc,char* argv[]){
//search_partition(parameter_input_bit_width,start_order);
};
int
search_partition
(
int
start_order_depth
,
int
*
start_order
){
random_device
rd
;
mt19937
gen
(
rd
());
random_device
rd
dd
;
mt19937
gen
(
rd
dd
());
int
max_partition_parts
=
min
(
10
,
int
(
parameter_output_bit_width
)
+
1
);
int
best_partition_parts
=
1
;
int
best_area
=
999999
;
...
...
src/BSD.h
View file @
b0da060e
...
...
@@ -741,14 +741,27 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
all_zero_right_list
[
j
]
=
0
;
all_one_right_list
[
j
]
=
0
;
double
early_stop_accuracy_node
=
1
-
(
1
-
parameter_early_stop_accuracy
)
/
double
(
1
);
if
(
double
(
how_many_zeros_left
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_zero_left_list
[
j
]
=
1
;
else
if
(
double
(
how_many_ones_left
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_one_left_list
[
j
]
=
1
;
if
(
double
(
how_many_zeros_right
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_zero_right_list
[
j
]
=
1
;
else
if
(
double
(
how_many_ones_right
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_one_right_list
[
j
]
=
1
;
if
(
parameter_early_stop_oneway
){
if
(
how_many_zeros_left
==
BSD_samples
)
all_zero_left_list
[
j
]
=
1
;
else
if
(
double
(
how_many_ones_left
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_one_left_list
[
j
]
=
1
;
if
(
how_many_zeros_right
==
BSD_samples
)
all_zero_right_list
[
j
]
=
1
;
else
if
(
double
(
how_many_ones_right
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_one_right_list
[
j
]
=
1
;
}
else
{
if
(
double
(
how_many_zeros_left
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_zero_left_list
[
j
]
=
1
;
else
if
(
double
(
how_many_ones_left
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_one_left_list
[
j
]
=
1
;
if
(
double
(
how_many_zeros_right
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_zero_right_list
[
j
]
=
1
;
else
if
(
double
(
how_many_ones_right
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_one_right_list
[
j
]
=
1
;
}
}
...
...
src/io_generator_vec/c432_vec.h
View file @
b0da060e
This diff is collapsed.
Click to expand it.
src/tool_function.h
View file @
b0da060e
...
...
@@ -69,24 +69,51 @@ int BDD_class::compare_simplify_list(int list_line_amount,bool* this_line,bool**
which_list_number
=
-
1
;
double
early_stop_accuracy_node
=
1
-
(
1
-
parameter_early_stop_accuracy
)
/
double
(
4
);
if
(
early_stop_accuracy_node
<
1
-
double
(
1
)
/
BSD_samples
){
for
(
int
i
=
list_line_amount
-
1
;
i
>=
0
;
i
--
){
it_can_simplify_here
=
0
;
int
same_bit
=
0
;
if
((
hash_number
<
double
(
hash_simplify_list
[
i
])
*
early_stop_accuracy_node
)
||
(
hash_number
>
double
(
hash_simplify_list
[
i
])
/
early_stop_accuracy_node
)){
if
(
parameter_early_stop_oneway
){
for
(
int
i
=
list_line_amount
-
1
;
i
>=
0
;
i
--
){
it_can_simplify_here
=
0
;
}
else
{
for
(
int
j
=
0
;
j
<
BSD_samples
;
j
++
){
if
(
simplify_list
[
i
][
j
]
==
this_line
[
j
]){
same_bit
+=
1
;
int
same_bit
=
0
;
bool
oneway_merge
=
1
;
if
((
hash_number
<
double
(
hash_simplify_list
[
i
])
*
early_stop_accuracy_node
)
||
(
hash_number
>
double
(
hash_simplify_list
[
i
])
/
early_stop_accuracy_node
)){
it_can_simplify_here
=
0
;
}
else
{
for
(
int
j
=
0
;
j
<
BSD_samples
;
j
++
){
if
(
simplify_list
[
i
][
j
]
==
this_line
[
j
]){
same_bit
+=
1
;
}
else
if
(
!
simplify_list
[
i
][
j
]
&&
this_line
[
j
]){
oneway_merge
=
0
;
break
;
}
}
if
(
double
(
same_bit
)
/
double
(
BSD_samples
)
>
early_stop_accuracy_node
)
it_can_simplify_here
=
oneway_merge
;
}
if
(
it_can_simplify_here
){
it_can_simplify
=
1
;
which_list_number
=
i
;
break
;
}
if
(
double
(
same_bit
)
/
double
(
BSD_samples
)
>
early_stop_accuracy_node
)
it_can_simplify_here
=
1
;
}
if
(
it_can_simplify_here
){
it_can_simplify
=
1
;
which_list_number
=
i
;
break
;
}
else
{
for
(
int
i
=
list_line_amount
-
1
;
i
>=
0
;
i
--
){
it_can_simplify_here
=
0
;
int
same_bit
=
0
;
if
((
hash_number
<
double
(
hash_simplify_list
[
i
])
*
early_stop_accuracy_node
)
||
(
hash_number
>
double
(
hash_simplify_list
[
i
])
/
early_stop_accuracy_node
)){
it_can_simplify_here
=
0
;
}
else
{
for
(
int
j
=
0
;
j
<
BSD_samples
;
j
++
){
if
(
simplify_list
[
i
][
j
]
==
this_line
[
j
]){
same_bit
+=
1
;
}
}
if
(
double
(
same_bit
)
/
double
(
BSD_samples
)
>
early_stop_accuracy_node
)
it_can_simplify_here
=
1
;
}
if
(
it_can_simplify_here
){
it_can_simplify
=
1
;
which_list_number
=
i
;
break
;
}
}
}
...
...
src/top.h
View file @
b0da060e
...
...
@@ -10,8 +10,10 @@ int parameter_output_bit_width = PO_WIDTH;//最小为1,最大为PO_WIDTH
extern
const
int
parameter_search_iterations
=
10
;
//最大设计次数
extern
const
int
parameter_test_ios
=
1000000
;
//测试要求多少样本
extern
const
int
parameter_max_samples
=
64
*
100
;
//BSD每一个节点最多进行多少次采样,至少为64
extern
const
double
parameter_early_stop_accuracy
=
0
.
99
;
//允许的错误率,如果完全不允许,设为1; 没有特殊需要不要设到<1,会慢一些。
extern
const
double
parameter_early_stop_accuracy
=
1
;
//允许的错误率,如果完全不允许,设为1;
//没有特殊需要不要设到<1,会慢一些。
//0.5以下无意义,建议至少设到0.8吧.
extern
const
bool
parameter_early_stop_oneway
=
1
;
//如果设为1,只允许0->1 的错误,不允许1->0的错误
extern
const
int
parameter_num_threads
=
32
;
//线程数
...
...
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