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2 @(0,13)
BLOCK#3 @(4,5)
BLOCK#4 @(2,4)
BLOCK#5 @(0,9)
BLOCK#6 @(8,0)
BLOCK#7 @(6,9)
BLOCK#8 @(4,0)
BLOCK#9 @(7,8)
BLOCK#10 @(6,0)
BLOCK#11 @(3,9)
BLOCK#12 @(0,10)
BLOCK#13 @(7,5)
BLOCK#14 @(1,6)
BLOCK#15 @(0,0)
BLOCK#16 @(10,0)
BLOCK#17 @(5,3)
BLOCK#18 @(1,2)
BLOCK#19 @(0,11)
BLOCK#20 @(0,1)
...@@ -78,7 +78,7 @@ int main(int argc, char *argv[]) { ...@@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
show_result(line_num, blocks, W_ext, H_ext, opt_result, block_place_basis); show_result(line_num, blocks, W_ext, H_ext, opt_result, block_place_basis);
} }
if(W_ext > W || H_ext > H) { if(W_ext > W || H_ext > H) {
cout << "Fail satisfying constraint" << endl; cout << "Fail satisfying constraint T_T" << endl;
} }
else { else {
cout << "Satisfy constraint ^_^" << endl; cout << "Satisfy constraint ^_^" << endl;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define RI 3 #define RI 3
#define BO 4 #define BO 4
#define SA_O 100 #define SA_O 1000
#define SA_I 100000 #define SA_I 100000
#define TEMP_S 500 #define TEMP_S 500
#define TEMP_E 0.1 #define TEMP_E 0.1
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
#define INTER_BLOCK_MARGIN 2 #define INTER_BLOCK_MARGIN 2
#define LOOP 50 #define LOOP 50
#define TRY_LIMIT 50 #define TRY_LIMIT 500
#define NO_MOVE 4 #define NO_MOVE 10
#define LFSR_RAND_MAX 4294967295 #define LFSR_RAND_MAX 4294967295
......
...@@ -480,7 +480,7 @@ bool local_placement_with_routing_2(short int line_num, short int blocks, short ...@@ -480,7 +480,7 @@ bool local_placement_with_routing_2(short int line_num, short int blocks, short
} }
} }
if(move_x) { if(move_x) {
block_place_slack[t][0]++; if(++block_place_slack[t][0] >= 9) break;
} }
else { else {
break; break;
...@@ -503,7 +503,7 @@ bool local_placement_with_routing_2(short int line_num, short int blocks, short ...@@ -503,7 +503,7 @@ bool local_placement_with_routing_2(short int line_num, short int blocks, short
} }
} }
if(move_y) { if(move_y) {
block_place_slack[t][1]++; if(++block_place_slack[t][1] >= 9) break;
} }
else { else {
break; break;
...@@ -531,6 +531,10 @@ bool local_placement_with_routing_2(short int line_num, short int blocks, short ...@@ -531,6 +531,10 @@ bool local_placement_with_routing_2(short int line_num, short int blocks, short
case 0: dx = lfsr_x_random() % (block_place_slack[i][0] + 1); break; case 0: dx = lfsr_x_random() % (block_place_slack[i][0] + 1); break;
case 1: dy = lfsr_y_random() % (block_place_slack[i][1] + 1); break; case 1: dy = lfsr_y_random() % (block_place_slack[i][1] + 1); break;
} }
if(lfsr_random() % 16 >= 2) {
dx = 0;
dy = 0;
}
block_place_delta[i] = make_pair(dx, dy); block_place_delta[i] = make_pair(dx, dy);
d_sum += dx + dy; d_sum += dx + dy;
for(int it = 1; it < 5; it++) { for(int it = 1; it < 5; it++) {
......
...@@ -44,7 +44,7 @@ void show_result(short int line_num, short int blocks, short int wi, short int h ...@@ -44,7 +44,7 @@ void show_result(short int line_num, short int blocks, short int wi, short int h
} }
cout << setfill(' '); cout << setfill(' ');
cout << dec; cout << dec;
for(int i = 1; i <= blocks; i++) { //for(int i = 1; i <= blocks; i++) {
cout << "BLOCK#" << i << " @(" << block_place[i].first << "," << block_place[i].second << ")" << endl; // cout << "BLOCK#" << i << " @(" << block_place[i].first << "," << block_place[i].second << ")" << endl;
} //}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment