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
f96a9546
Commit
f96a9546
authored
Dec 26, 2025
by
chengshuyao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code for
parent
acfe534d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
27 deletions
+27
-27
src/BSD.h
+1
-1
src/BSD_top.h
+22
-22
src/top.h
+4
-4
No files found.
src/BSD.h
View file @
f96a9546
...
...
@@ -51,7 +51,7 @@ public:
//BSD内部使用的变量(固定)
const
double
total_weight_max
=
pow
(
2
.
0
,
20
);
//指导权重分布修改
const
int
total_sample_max
=
1000000000
;
//指导采样个数修改
const
int
BSD_samples_influence_max
=
10
*
parameter_num_threads
;
//BSD确定展开序的置信度
const
int
BSD_samples_influence_max
=
min
(
parameter_max_samples
,
10
*
parameter_num_threads
)
;
//BSD确定展开序的置信度
int
which_demo_function
;
int
BDD_id
;
...
...
src/BSD_top.h
View file @
f96a9546
...
...
@@ -100,7 +100,7 @@ int BSD_execute(int start_node_number, node_index* start_node_index,int variable
class
BSD_features
{
public
:
int
BSD_depth
;
int
BSD_area
;
double
BSD_area
;
double
accuracy
;
int
*
BSD_area_layers
;
...
...
@@ -210,13 +210,13 @@ void set_default(){
}
//double variable_features[parameter_input_bit_width];
int
search_order
(
int
start_node_number
,
int
start_node_depth
,
node_index
*
start_node_index
,
int
search_iterations
,
int
*
start_order
);
int
search_reward
(
BSD_features
BSD_features_0
);
double
search_order
(
int
start_node_number
,
int
start_node_depth
,
node_index
*
start_node_index
,
int
search_iterations
,
int
*
start_order
);
double
search_reward
(
BSD_features
BSD_features_0
);
int
search_partition
(
int
start_node_number
,
int
start_node_depth
,
node_index
*
start_node_index
,
int
*
start_order
);
int
search_partition
(
int
start_node_number
=
default_start_node_number
,
int
start_node_depth
=
0
,
node_index
*
start_node_index
=
default_start_node_index
,
int
*
start_order
=
default_start_order
){
int
search_order_times
=
2
;
int
search_order_times
=
5
;
int
min_partition_parts
;
#ifdef ACCURACY_FIRST
min_partition_parts
=
start_node_number
;
...
...
@@ -228,7 +228,7 @@ int search_partition(int start_node_number=default_start_node_number,int start_n
mt19937
gen
(
rd
());
int
max_partition_parts
=
start_node_number
;
int
best_partition_parts
=
max_partition_parts
;
int
best_area
=
999999
;
double
best_area
=
999999
;
bool
**
partition_sets
=
new
bool
*
[
max_partition_parts
];
bool
**
best_partition_sets
=
new
bool
*
[
max_partition_parts
];
...
...
@@ -242,10 +242,10 @@ int search_partition(int start_node_number=default_start_node_number,int start_n
partition_sets
[
i
][
i
]
=
1
;
best_partition_sets
[
i
][
i
]
=
1
;
}
int
*
area_parts
=
new
int
[
max_partition_parts
];
int
*
best_area_parts
=
new
int
[
max_partition_parts
];
double
*
area_parts
=
new
double
[
max_partition_parts
];
double
*
best_area_parts
=
new
double
[
max_partition_parts
];
int
area
=
0
;
double
area
=
0
;
for
(
int
i
=
0
;
i
<
max_partition_parts
;
i
++
){
cout
<<
"Partition_set ["
<<
i
<<
"] "
;
int
start_node_partition
=
0
;
...
...
@@ -372,7 +372,7 @@ int search_partition(int start_node_number=default_start_node_number,int start_n
//执行对比
int
area
=
0
;
double
area
=
0
;
for
(
int
i
=
0
;
i
<
partition_parts
;
i
++
){
if
(
i
>=
merge_part
){
...
...
@@ -563,18 +563,18 @@ int BSD_execute(int start_node_number, node_index* start_node_index,int variable
for
(
int
zi
=
0
;
zi
<
parameter_input_bit_width
;
zi
++
){
variable_order
[
zi
]
=
BSD_features_0
.
variable_order
[
zi
]
;
}
int
reward
=
search_reward
(
BSD_features_0
);
double
reward
=
search_reward
(
BSD_features_0
);
arr_delete
(
BDD_class_main
.
start_nodes
)
;
return
reward
;
};
int
search_reward
(
BSD_features
BSD_features_0
){
int
reward
=
0
;
//(1000000*double(1-BSD_features_0.accuracy));
double
search_reward
(
BSD_features
BSD_features_0
){
double
reward
=
0
;
//(1000000*double(1-BSD_features_0.accuracy));
reward
+=
BSD_features_0
.
BSD_area
;
if
(
BSD_features_0
.
accuracy
<
parameter_early_stop_accuracy
)
reward
=
int
(
1
.
2
*
reward
)
+
(
1000000
*
double
(
1
-
BSD_features_0
.
accuracy
))
;
reward
=
int
(
1
.
2
*
reward
)
+
int
(
1000000
*
double
(
1
-
BSD_features_0
.
accuracy
))
+
BSD_features_0
.
accuracy
;
cout
<<
"BSD accuracy: "
<<
BSD_features_0
.
accuracy
<<
endl
;
cout
<<
"BSD area: "
<<
BSD_features_0
.
BSD_area
<<
endl
;
//reward += int(BSD_features_0.feature_area/100) ;
...
...
@@ -583,7 +583,7 @@ int search_reward(BSD_features BSD_features_0){
};
int
search_order
(
int
start_node_number
=
default_start_node_number
,
int
start_node_depth
=
0
,
node_index
*
start_node_index
=
default_start_node_index
,
int
search_iterations
=
parameter_search_iterations
,
int
*
start_order
=
default_start_order
){
double
search_order
(
int
start_node_number
=
default_start_node_number
,
int
start_node_depth
=
0
,
node_index
*
start_node_index
=
default_start_node_index
,
int
search_iterations
=
parameter_search_iterations
,
int
*
start_order
=
default_start_order
){
arr2d_new
(
multi_variable_order
,
parameter_max_orders
);
//multi_variable_order = new int* [parameter_max_orders];
...
...
@@ -593,15 +593,15 @@ int search_order(int start_node_number = default_start_node_number, int start_no
multi_variable_order
[
vi
][
vj
]
=
0
;
}
int
best_area
=
9999999
;
double
best_area
=
9999999
;
int
best_reward
=
9999999
;
int
best_area_depth
=
0
;
int
**
best_variable_order
;
int
*
best_BDD_split_nodes
=
new
int
[
parameter_input_bit_width
];
int
*
best_areas
=
new
int
[
parameter_max_orders
];
double
*
best_areas
=
new
double
[
parameter_max_orders
];
int
*
best_rewards
=
new
int
[
parameter_max_orders
];
int
*
best_area_depths
=
new
int
[
parameter_max_orders
];
double
*
best_area_depths
=
new
double
[
parameter_max_orders
];
for
(
int
vi
=
0
;
vi
<
parameter_max_orders
;
vi
++
){
best_areas
[
vi
]
=
0
;
best_rewards
[
vi
]
=
0
;
...
...
@@ -618,7 +618,7 @@ int search_order(int start_node_number = default_start_node_number, int start_no
best_variable_order
[
vi
][
vj
]
=
0
;
}
int
area
=
0
;
double
area
=
0
;
int
reward
=
0
;
int
mutation_depth
=
0
;
random_device
rd
;
...
...
@@ -628,10 +628,10 @@ int search_order(int start_node_number = default_start_node_number, int start_no
for
(
int
vj
=
0
;
vj
<
parameter_input_bit_width
;
vj
++
)
feature_variable
[
vj
]
=
0
;
int
best_area_0
;
int
best_area_10
;
int
best_area_100
;
int
best_area_1000
;
double
best_area_0
;
double
best_area_10
;
double
best_area_100
;
double
best_area_1000
;
int
best_iteration
=
0
;
int
partition_depth
=
1000000
;
...
...
src/top.h
View file @
f96a9546
#include "head.h"
#include "io_generator/c
880
.h" //io_generator中需要包含对PI_WIDTH,PO_WIDTH的全局定义,如: extern const int PI_WIDTH = 36;
#include "io_generator_vec/c
880
_vec.h" //如果有对应Verilog, 可以在aag_to_rtl里面直接生成2个文件
#include "io_generator/c
1908
.h" //io_generator中需要包含对PI_WIDTH,PO_WIDTH的全局定义,如: extern const int PI_WIDTH = 36;
#include "io_generator_vec/c
1908
_vec.h" //如果有对应Verilog, 可以在aag_to_rtl里面直接生成2个文件
//#include "io_generator/ip-cores/combinational_circuits/c_prefix_arbiter_base.h"
//#include "io_generator/ip-cores/combinational_circuits_vec/c_prefix_arbiter_base_vec.h"
...
...
@@ -16,8 +16,8 @@ int parameter_output_bit_width = PO_WIDTH;
extern
const
int
parameter_search_iterations
=
10
;
//最大设计次数
extern
const
int
parameter_test_ios
=
10000
;
//测试要求多少样本
extern
const
int
parameter_max_samples
=
1000
0
;
//BSD每一个节点最多进行多少次采样,至少为64
extern
const
int
parameter_test_ios
=
10000
00
;
//测试要求多少样本
extern
const
int
parameter_max_samples
=
1000
;
//BSD每一个节点最多进行多少次采样,至少为64
extern
const
double
parameter_early_stop_accuracy
=
1
;
//允许的错误率,如果完全不允许,设为1;
//没有特殊需要不要设到<1,会慢一些。
//0.5以下无意义,建议至少设到0.8吧.
...
...
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