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
b2ea336e
Commit
b2ea336e
authored
Nov 27, 2025
by
chengshuyao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug parameters
parent
00a996fb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
29 deletions
+19
-29
src/BSD.cpp
+1
-1
src/BSD.h
+8
-8
src/next_layer_bit.h
+2
-1
src/tool_function.h
+1
-1
src/top.h
+7
-18
No files found.
src/BSD.cpp
View file @
b2ea336e
...
@@ -39,7 +39,7 @@ extern const int parameter_max_orders = 2;
...
@@ -39,7 +39,7 @@ extern const int parameter_max_orders = 2;
//算法的parameter Algorithm_parameter
//算法的parameter Algorithm_parameter
extern
const
int
parameter_num_threads
=
64
;
//线程数
extern
const
int
parameter_num_threads
=
64
;
//线程数
extern
const
int
parameter_multi_output_index
=
0
;
//BSD从第几层开始化简,前面若干层展开序确定
extern
const
int
parameter_multi_output_index
=
0
;
//BSD从第几层开始化简,前面若干层展开序确定
extern
const
int
parameter_max_BDD_width
=
32000
;
//BSD每一层最多多少个节点
extern
const
int
parameter_max_BDD_width
=
32000
0
;
//BSD每一层最多多少个节点
int
parameter_early_stop_depth
=
parameter_input_bit_width
;
//BSD到第几层终止,输出此时的不准确BSD
int
parameter_early_stop_depth
=
parameter_input_bit_width
;
//BSD到第几层终止,输出此时的不准确BSD
int
parameter_early_stop_split_nodes
=
1000000
;
//BSD每一层最多多少个节点
int
parameter_early_stop_split_nodes
=
1000000
;
//BSD每一层最多多少个节点
...
...
src/BSD.h
View file @
b2ea336e
...
@@ -42,9 +42,9 @@ public:
...
@@ -42,9 +42,9 @@ public:
class
BDD_class
{
class
BDD_class
{
public
:
public
:
//BSD内部使用的变量(可变)
//BSD内部使用的变量(可变)
int
BSD_samples
=
min
(
1000
,
parameter_max_samples
);
int
BSD_samples
=
min
(
4
,
parameter_max_samples
);
int
BSD_samples_train
=
min
(
4
0000
,
parameter_max_samples
);
int
BSD_samples_train
=
min
(
4
,
parameter_max_samples
);
int
BSD_samples_sort
=
min
(
4
00
,
parameter_max_samples
);
int
BSD_samples_sort
=
min
(
4
,
parameter_max_samples
);
const
int
how_often_simplify
=
1
;
const
int
how_often_simplify
=
1
;
//BSD内部使用的变量(固定)
//BSD内部使用的变量(固定)
const
double
total_weight_max
=
pow
(
2
.
0
,
20
);
//指导权重分布修改
const
double
total_weight_max
=
pow
(
2
.
0
,
20
);
//指导权重分布修改
...
@@ -234,7 +234,7 @@ int BDD_class::BSD_samples_train_each_layer(){
...
@@ -234,7 +234,7 @@ int BDD_class::BSD_samples_train_each_layer(){
BSD_samples_train
=
2
;
BSD_samples_train
=
2
;
}
}
}
else
{
}
else
{
BSD_samples_train
=
max
(
4
,
min
(
int
(
total_sample_max
*
(
1
-
total_finish_weight
/
(
pow
(
2
.
0
,
20
)
*
how_many_start_nodes
))),
parameter_max_samples
));
BSD_samples_train
=
max
(
4
,
min
(
int
(
total_sample_max
*
(
1
-
total_finish_weight
/
(
pow
(
2
.
0
,
20
)
*
how_many_start_nodes
))),
parameter_max_samples
-
1
));
}
}
cout
<<
"BSD train samples: "
<<
BSD_samples_train
<<
endl
;
cout
<<
"BSD train samples: "
<<
BSD_samples_train
<<
endl
;
return
BSD_samples_train
;
return
BSD_samples_train
;
...
@@ -657,7 +657,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
...
@@ -657,7 +657,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
bool
*
left_mask_output_data_tmp
=
new
bool
[
BSD_samples
];
bool
*
left_mask_output_data_tmp
=
new
bool
[
BSD_samples
];
bool
*
right_mask_output_data_tmp
=
new
bool
[
BSD_samples
];
bool
*
right_mask_output_data_tmp
=
new
bool
[
BSD_samples
];
if
((
i
==
(
parameter_early_stop_depth
-
1
))
&&
(
which_BDD
==
0
)
||
((
i
==
(
parameter_early_stop_depth
-
1
))
&&
(
which_BDD
==
1
))
||
((
total_split_nodes_recursive
)
>
parameter_early_stop_split_nodes
-
BDD_width_each_layer
[
i
])){
if
((
i
==
(
parameter_early_stop_depth
-
1
))
&&
(
which_BDD
==
0
)
||
((
i
==
(
parameter_early_stop_depth
-
1
))
&&
(
which_BDD
==
1
))
||
((
total_split_nodes_recursive
)
>
parameter_early_stop_split_nodes
-
BDD_width_each_layer
[
i
])){
cout
<<
"Early Stop: Condition A "
<<
endl
;
//
cout<<"Early Stop: Condition A "<<endl;
for
(
int
zi
=
0
;
zi
<
min
(
BSD_samples
,
100
);
zi
++
){
for
(
int
zi
=
0
;
zi
<
min
(
BSD_samples
,
100
);
zi
++
){
left_mask_output_data_tmp
[
zi
]
=
left_mask_output_data_all
[
zi
+
BSD_samples
*
j
];
left_mask_output_data_tmp
[
zi
]
=
left_mask_output_data_all
[
zi
+
BSD_samples
*
j
];
if
(
left_mask_output_data_tmp
[
zi
]){
if
(
left_mask_output_data_tmp
[
zi
]){
...
@@ -690,7 +690,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
...
@@ -690,7 +690,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
all_zero_right_list
[
j
]
=
1
;
all_zero_right_list
[
j
]
=
1
;
}
}
}
else
if
((
BDD_width_each_layer
[
i
]
>
parameter_max_BDD_width
/
2
)
){
}
else
if
((
BDD_width_each_layer
[
i
]
>
parameter_max_BDD_width
/
2
)
){
cout
<<
"Early Stop: Condition B "
<<
endl
;
//
cout<<"Early Stop: Condition B "<<endl;
cout
<<
"which node this layer: "
<<
j
<<
endl
;
cout
<<
"which node this layer: "
<<
j
<<
endl
;
cout
<<
" Finish trained weight = "
<<
setprecision
(
12
)
<<
(
total_finish_weight
)
/
pow
(
2
.
0
,
20
)
<<
endl
;
cout
<<
" Finish trained weight = "
<<
setprecision
(
12
)
<<
(
total_finish_weight
)
/
pow
(
2
.
0
,
20
)
<<
endl
;
for
(
int
zi
=
0
;
zi
<
min
(
BSD_samples
,
10
);
zi
++
){
for
(
int
zi
=
0
;
zi
<
min
(
BSD_samples
,
10
);
zi
++
){
...
@@ -779,7 +779,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
...
@@ -779,7 +779,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
BDD
[
i
][
j
].
non_equal_number
=
total_non_equal_nodes
;
BDD
[
i
][
j
].
non_equal_number
=
total_non_equal_nodes
;
total_non_equal_nodes
+=
1
;
total_non_equal_nodes
+=
1
;
}
}
//cout<<
"
Debug 1"<<" ";
//cout<<
j<<"
Debug 1"<<" ";
for
(
zi
=
0
;
zi
<
i
;
zi
++
){
for
(
zi
=
0
;
zi
<
i
;
zi
++
){
left_son_mask
[
most_influence
[
zi
]]
=
BDD_mask_this
[
j
].
mask
[
most_influence
[
zi
]];
left_son_mask
[
most_influence
[
zi
]]
=
BDD_mask_this
[
j
].
mask
[
most_influence
[
zi
]];
right_son_mask
[
most_influence
[
zi
]]
=
BDD_mask_this
[
j
].
mask
[
most_influence
[
zi
]];
right_son_mask
[
most_influence
[
zi
]]
=
BDD_mask_this
[
j
].
mask
[
most_influence
[
zi
]];
...
@@ -796,7 +796,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
...
@@ -796,7 +796,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
left_mask_output_data
[
zi
]
=
left_mask_output_data_all
[
zi
+
BSD_samples
*
j
];
left_mask_output_data
[
zi
]
=
left_mask_output_data_all
[
zi
+
BSD_samples
*
j
];
right_mask_output_data
[
zi
]
=
right_mask_output_data_all
[
zi
+
BSD_samples
*
j
];
right_mask_output_data
[
zi
]
=
right_mask_output_data_all
[
zi
+
BSD_samples
*
j
];
}
}
//cout<<"Debug 2"<<" ";
//cout<<"Debug 2"<<" "
<<endl
;
///int left_zeros = 0;
///int left_zeros = 0;
///int left_ones = 0;
///int left_ones = 0;
///int right_zeros = 0;
///int right_zeros = 0;
...
...
src/next_layer_bit.h
View file @
b2ea336e
...
@@ -133,8 +133,9 @@ int BDD_class::next_bit_layer(int depth,int order_num){
...
@@ -133,8 +133,9 @@ int BDD_class::next_bit_layer(int depth,int order_num){
}
}
return
next_bit_layer_0
(
depth
);
return
next_bit_layer_0
(
depth
);
}
}
else
else
{
return
next_bit_layer_0
(
depth
);
return
next_bit_layer_0
(
depth
);
}
}
}
int
BDD_class
::
next_bit_layer_1
(
int
depth
){
int
BDD_class
::
next_bit_layer_1
(
int
depth
){
...
...
src/tool_function.h
View file @
b2ea336e
...
@@ -91,7 +91,7 @@ int BDD_class::compare_simplify_list(int list_line_amount,bool* this_line,bool**
...
@@ -91,7 +91,7 @@ int BDD_class::compare_simplify_list(int list_line_amount,bool* this_line,bool**
};
};
int
BDD_class
::
compare_simplify_list_neg
(
int
list_line_amount
,
bool
*
this_line
,
bool
**
simplify_list
,
int
*
hash_simplify_list
,
int
hash_neg_number
){
int
BDD_class
::
compare_simplify_list_neg
(
int
list_line_amount
,
bool
*
this_line
,
bool
**
simplify_list
,
int
*
hash_simplify_list
,
int
hash_neg_number
){
int
which_list_number
=
-
1
;
int
which_list_number
=
-
1
;
//
return which_list_number;
return
which_list_number
;
bool
it_can_simplify
=
0
;
bool
it_can_simplify
=
0
;
int
i
,
j
;
int
i
,
j
;
bool
it_can_simplify_here
;
bool
it_can_simplify_here
;
...
...
src/top.h
View file @
b2ea336e
#define INPUT_AIG
#define INPUT_AIG
#include "io_generator/multiplier_88.h"
#include "io_generator/c1908.h"
#include "multiplier_88_vec.h"
#include "c1908_vec.h"
//int PI_WIDTH = 32;
//int PO_WIDTH = 18;
extern
const
int
parameter_input_bit_width
=
PI_WIDTH
+
5
;
extern
const
int
parameter_input_bit_width
=
PI_WIDTH
+
5
;
extern
const
int
parameter_output_bit_width
=
PO_WIDTH
;
extern
const
int
parameter_output_bit_width
=
PO_WIDTH
;
//extern const int parameter_train_output_bit_width = 1 ;
//int parameter_input_bit_width = 80+5; //输入bit有几位,写在+6前面。+6是为了防止一些bug的冗余设计。
//int parameter_output_bit_width = 65; //输出bit有几位
//#include"io_generator_tmp.h"
//#include"io_generator_function.h"
extern
const
int
parameter_search_iterations
=
1
;
//最大设计次数
extern
const
int
parameter_search_iterations
=
10
;
//最大设计次数
extern
const
int
parameter_test_ios
=
1000
;
//测试要求多少样本
extern
const
int
parameter_test_ios
=
100000
;
//测试要求多少样本
extern
const
int
parameter_max_samples
=
int
(
parameter_test_ios
*
100
/
32
)
*
32
;
//BSD每一个节点最多进行多少次采样
//extern const int parameter_max_samples = int(parameter_test_ios*100/32)*32; //BSD每一个节点最多进行多少次采样
//extern const int parameter_max_samples = 64; //BSD每一个节点最多进行多少次采样,至少为64
extern
const
int
parameter_max_samples
=
64
*
100
;
//BSD每一个节点最多进行多少次采样,至少为64
bool
*
io_generator_function
(
bool
*
input_data
,
bool
*
output_data
)
{
bool
*
io_generator_function
(
bool
*
input_data
,
bool
*
output_data
)
{
...
...
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