-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChip.cpp
More file actions
59 lines (57 loc) · 1.46 KB
/
Copy pathChip.cpp
File metadata and controls
59 lines (57 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "Chip.h"
using namespace std;
Chip::Chip(int m_, int n_) :m(m_), n(n_) {
map.push_back(vector<int>());
for (int i = 1; i <= m; ++i) {
vector<int> row;
for (int j = 0; j <= n; ++j) {
row.push_back(-1);
}
map.push_back(row);
}
}
ostream& operator<<(ostream& os, const Chip& chip) {
for (int i = 1; i <= chip.m; ++i) {
for (int j = 1; j <= chip.n; ++j) {
cout << chip.map[i][j] << '\t';
}
cout << endl;
}
cout << "Path 1: ";
int sz1 = chip.route[0].size();
for (int i = 0; i < sz1; ++i) {
cout << "(" << chip.route[0][i].x << "," << chip.route[0][i].y << ")";
}
cout << endl;
cout << "Path 2: ";
int sz2 = chip.route[1].size();
for (int i = 0; i < sz2; ++i) {
cout << "(" << chip.route[1][i].x << "," << chip.route[1][i].y << ")";
}
cout << endl;
if (chip.getB) {
cout << "Buffer path: ";
int sz3 = chip.BRoute.size();
for (int i = 0; i < sz3; ++i) {
cout << "(" << chip.BRoute[i].x << "," << chip.BRoute[i].y << ")";
}
cout << endl;
}
if (chip.getS) {
cout << "Sample path: ";
int sz3 = chip.SRoute.size();
for (int i = 0; i < sz3; ++i) {
cout << "(" << chip.SRoute[i].x << "," << chip.SRoute[i].y << ")";
}
cout << endl;
}
if (chip.discard) {
cout << "Discard path: ";
int sz3 = chip.discardRoute.size();
for (int i = 0; i < sz3; ++i) {
cout << "(" << chip.discardRoute[i].x << "," << chip.discardRoute[i].y << ")";
}
cout << endl;
}
return os;
}