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
SunMaple
BSD
Commits
2a716ce1
Commit
2a716ce1
authored
Jul 11, 2025
by
chengshuyao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug BSD partition
parent
5df737e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
61 deletions
+82
-61
src/BSD.cpp
+76
-53
src/BSD.h
+3
-3
src/top.h
+3
-5
No files found.
src/BSD.cpp
View file @
2a716ce1
...
...
@@ -127,8 +127,20 @@ int BSD_execute(int variable_order_number,int** variable_order, int partition_de
BDD_class
BDD_class_main
;
BDD_class_main
.
which_demo_function
=
GLOBAL_which_demo_function
;
cout
<<
"This variable order: "
<<
endl
;
for
(
int
vi
=
0
;
vi
<
parameter_max_partition_parts
;
vi
++
){
for
(
int
j
=
0
;
j
<
parameter_max_partition_parts
;
j
++
){
BDD_class_main
.
BSD_variable_order
[
j
]
=
new
int
[
parameter_input_bit_width
];
}
cout
<<
"This variable order: "
<<
variable_order_number
<<
endl
;
//for (int vi=0;vi<partition_parts;vi++){
// BDD_class_main.BSD_variable_order_number = variable_order_number;
// for(int i=0;i<variable_order_number;i++){
// BDD_class_main.BSD_variable_order[vi][i] = variable_order[vi][i];
// cout<<BDD_class_main.BSD_variable_order[vi][i]<<" ";
// }
// cout<<endl;
//}
//cout<<endl;
for
(
int
vi
=
0
;
vi
<
partition_parts
;
vi
++
){
BDD_class_main
.
BSD_variable_order_number
=
variable_order_number
;
for
(
int
i
=
0
;
i
<
variable_order_number
;
i
++
){
BDD_class_main
.
BSD_variable_order
[
vi
][
i
]
=
variable_order
[
vi
][
i
];
...
...
@@ -265,6 +277,7 @@ void search_order(int search_iterations, bool allow_partition){
result_1000
<<
best_area
<<
endl
;
}
cout
<<
"Debug 1"
<<
endl
;
int
parameter_learning_rate
=
1
;
if
(
best_area
>
10000
){
parameter_learning_rate
=
5
;
...
...
@@ -335,7 +348,15 @@ void search_order(int search_iterations, bool allow_partition){
}
cout
<<
"Debug 2"
<<
endl
;
for
(
int
vj
=
0
;
vj
<
parameter_max_partition_parts
;
vj
++
){
for
(
int
vi
=
0
;
vi
<
parameter_input_bit_width
;
vi
++
){
cout
<<
variable_order
[
vj
][
vi
]
<<
" "
;
//variable_features[vi] = double(BSD_features_0.BDD_width_each_layer[vi+1]) / double(BSD_features_0.BDD_width_each_layer[vi]);
//cout<<variable_features[vi]<<" ";
}
cout
<<
endl
;
}
//for(int j=mutation_depth;j<parameter_input_bit_width;j++){
// for (int vi=0;vi<parameter_input_bit_width;vi++){
...
...
@@ -349,7 +370,7 @@ void search_order(int search_iterations, bool allow_partition){
//}
if
(
i
<
1
0
){
if
(
i
<
1
){
reward
=
BSD_execute
(
0
,
variable_order
,
partition_depth
,
partition_parts
);
}
else
{
...
...
@@ -360,60 +381,62 @@ void search_order(int search_iterations, bool allow_partition){
}
cout
<<
"Debug 3"
<<
endl
;
bool
accept
;
//accept = (reward <= best_reward);
double
accept_ratio
=
double
(
reward
)
/
double
(
best_reward
);
if
(
accept_ratio
<
1
)
accept
=
1
;
else
if
(
accept_ratio
==
1
){
if
(
gen
()
%
2
==
0
)
//accept = (reward <= best_reward);
double
accept_ratio
=
double
(
reward
)
/
double
(
best_reward
);
if
(
accept_ratio
<
1
)
accept
=
1
;
else
else
if
(
accept_ratio
==
1
){
if
(
gen
()
%
2
==
0
)
accept
=
1
;
else
accept
=
0
;
}
else
if
(
accept_ratio
>
1.05
)
accept
=
0
;
}
else
if
(
accept_ratio
>
1.05
)
accept
=
0
;
else
{
int
k
=
(
1.05
-
accept_ratio
)
*
100
;
if
(
gen
()
%
100
<
k
)
accept
=
1
;
else
accept
=
0
;
}
if
(
accept
){
best_iteration
=
i
;
best_reward
=
reward
;
best_area
=
BSD_features_0
.
BSD_area
;
best_area_depth
=
BSD_features_0
.
BSD_depth
;
best_partition_depth
=
partition_depth
;
best_partition_parts
=
partition_parts
;
for
(
int
vi
=
0
;
vi
<
parameter_input_bit_width
;
vi
++
){
for
(
int
vj
=
0
;
vj
<
parameter_max_partition_parts
;
vj
++
){
best_variable_order
[
vj
][
vi
]
=
variable_order
[
vj
][
vi
];
}
best_BDD_split_nodes
[
vi
]
=
BSD_features_0
.
BSD_area_layers
[
vi
];
//variable_features[vi] = double(BSD_features_0.BDD_width_each_layer[vi+1]) / double(BSD_features_0.BDD_width_each_layer[vi]);
//cout<<variable_features[vi]<<" ";
else
{
int
k
=
(
1.05
-
accept_ratio
)
*
100
;
if
(
gen
()
%
100
<
k
)
accept
=
1
;
else
accept
=
0
;
}
if
(
accept
){
best_iteration
=
i
;
best_reward
=
reward
;
best_area
=
BSD_features_0
.
BSD_area
;
best_area_depth
=
BSD_features_0
.
BSD_depth
;
best_partition_depth
=
partition_depth
;
best_partition_parts
=
partition_parts
;
for
(
int
vj
=
0
;
vj
<
parameter_max_partition_parts
;
vj
++
){
for
(
int
vi
=
0
;
vi
<
parameter_input_bit_width
;
vi
++
){
best_variable_order
[
vj
][
vi
]
=
variable_order
[
vj
][
vi
];
cout
<<
best_variable_order
[
vj
][
vi
]
<<
" "
;
best_BDD_split_nodes
[
vi
]
=
BSD_features_0
.
BSD_area_layers
[
vi
];
//variable_features[vi] = double(BSD_features_0.BDD_width_each_layer[vi+1]) / double(BSD_features_0.BDD_width_each_layer[vi]);
//cout<<variable_features[vi]<<" ";
}
cout
<<
endl
;
}
cout
<<
"#############################"
<<
endl
;
cout
<<
"## This order accept #"
<<
endl
;
cout
<<
"#############################"
<<
endl
;
parameter_early_stop_split_nodes
=
int
(
reward
*
1.05
);
}
cout
<<
"#############################"
<<
endl
;
cout
<<
"## This order accept #"
<<
endl
;
cout
<<
"#############################"
<<
endl
;
parameter_early_stop_split_nodes
=
int
(
reward
*
1.05
);
cout
<<
endl
;
cout
<<
"Best Iteration: "
<<
best_iteration
<<
endl
;
cout
<<
"This Iteration: "
<<
i
<<
endl
;
cout
<<
"Reward: "
<<
reward
<<
endl
;
cout
<<
"Best Reward: "
<<
best_reward
<<
endl
;
cout
<<
"Area: "
<<
BSD_features_0
.
BSD_area
<<
endl
;
cout
<<
"Best Area: "
<<
best_area
<<
endl
;
//cout<<"Best Design Area: "<<BSD_features_0.BSD_area<<endl;
cout
<<
endl
;
}
cout
<<
endl
;
cout
<<
"Best Iteration: "
<<
best_iteration
<<
endl
;
cout
<<
"This Iteration: "
<<
i
<<
endl
;
cout
<<
"Reward: "
<<
reward
<<
endl
;
cout
<<
"Best Reward: "
<<
best_reward
<<
endl
;
cout
<<
"Area: "
<<
BSD_features_0
.
BSD_area
<<
endl
;
cout
<<
"Best Area: "
<<
best_area
<<
endl
;
//cout<<"Best Design Area: "<<BSD_features_0.BSD_area<<endl;
cout
<<
endl
;
}
parameter_early_stop_split_nodes
=
99999999
;
area
=
BSD_execute
(
parameter_input_bit_width
,
best_variable_order
,
best_partition_depth
,
best_partition_parts
);
parameter_early_stop_split_nodes
=
99999999
;
area
=
BSD_execute
(
parameter_input_bit_width
,
best_variable_order
,
best_partition_depth
,
best_partition_parts
);
};
src/BSD.h
View file @
2a716ce1
...
...
@@ -884,9 +884,9 @@ int BDD_class::BDD_FULL_PROCESS(){
for
(
j
=
0
;
j
<
parameter_max_samples
;
j
++
){
mask_input_data
[
j
]
=
new
bool
[
parameter_input_bit_width
*
2
];
}
for
(
j
=
0
;
j
<
parameter_max_partition_parts
;
j
++
){
BSD_variable_order
[
j
]
=
new
int
[
parameter_input_bit_width
];
}
//
for (j=0;j<parameter_max_partition_parts;j++){
//
BSD_variable_order[j] = new int [parameter_input_bit_width];
//
}
for
(
int
zi
=
0
;
zi
<
parameter_max_BDD_width
;
zi
++
){
simplify_list
[
zi
]
=
new
bool
[
parameter_max_samples
];
}
...
...
src/top.h
View file @
2a716ce1
...
...
@@ -6,14 +6,12 @@ bool* io_generator_function(bool input_data[parameter_input_bit_width],int which
int
i
,
j
;
bool
output_data_temp
[
1000
];
io_generator_outer
(
input_data
,
output_data_temp
);
for
(
i
=
0
;
i
<
parameter_output_bit_width
;
i
++
){
output_data
[
i
]
=
0
;
output_data
[
i
]
=
output_data_temp
[
i
]
;
}
io_generator_outer
(
input_data
,
output_data
);
output_data
[
0
]
=
output_data
[
12
];
return
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