-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprobe.cpp
More file actions
33 lines (29 loc) · 1.28 KB
/
Copy pathprobe.cpp
File metadata and controls
33 lines (29 loc) · 1.28 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
#include "CandidatePropagator.hpp"
#include "Netlist.hpp"
#include "TopologyGraph.hpp"
#include <iostream>
#include <map>
// Diagnostic: how much does candidate propagation constrain domains?
// Structured (feasible) instance -> domains collapse toward 1.
// Uniform-random instance -> domains stay near k.
int main(int argc, char** argv) {
if (argc != 3) { std::cerr << "usage: probe <topo> <netlist>\n"; return 1; }
TopologyGraph topo; topo.load_from_file(argv[1]);
Netlist net; net.load_from_file(argv[2], topo.num_nodes());
const int k = topo.num_nodes();
CandidateMask m = CandidatePropagator::initialize_and_propagate(net, topo);
std::map<int,long long> hist;
long long total = 0; long long fixed_cnt = 0;
for (int u = 0; u < net.num_nodes(); ++u) {
int c = 0;
for (int p = 0; p < k; ++p) if (m[u][p]) ++c;
++hist[c]; total += c;
if (net.is_fixed(u)) ++fixed_cnt;
}
std::cout << "topology FPGAs k=" << k << " nodes=" << net.num_nodes()
<< " fixed=" << fixed_cnt << "\n";
std::cout << "avg domain size = " << (double)total / net.num_nodes() << "\n";
std::cout << "domain-size histogram (size : #nodes):\n";
for (auto [sz, cnt] : hist) std::cout << " " << sz << " : " << cnt << "\n";
return 0;
}