update isl for support for recent versions of clang
[ppn.git] / channel_summary.cc
blobdeac713fa89ac7772766d652f075e11d26275745
1 #include <iostream>
3 #include <isa/yaml.h>
4 #include <isa/pdg.h>
6 using namespace std;
7 using namespace pdg;
9 int main(int argc, char * argv[])
11 PDG *pdg;
12 isl_ctx *ctx = isl_ctx_alloc();
13 pdg = PDG::Load(stdin, ctx);
14 int channels = 0;
15 int wires = 0;
16 int non_wires = 0;
17 int selfloops = 0;
18 int registers = 0;
19 int connections = 0;
20 int reorderings = 0;
21 int fifos = 0;
22 int union_fifos = 0;
23 int single_fifos = 0;
24 int channel[2][2][2];
26 for (int i = 0; i < 2; ++i)
27 for (int j = 0; j < 2; ++j)
28 for (int k = 0; k < 2; ++k)
29 channel[i][j][k] = 0;
31 for (int i = 0; i < pdg->dependences.size(); ++i) {
32 pdg::dependence *dep = pdg->dependences[i];
33 if (dep->type == pdg::dependence::uninitialized)
34 continue;
35 channels++;
36 if (dep->type == pdg::dependence::pn_part) {
37 wires++;
38 continue;
40 if (dep->type == pdg::dependence::pn_wire) {
41 wires++;
42 continue;
44 non_wires++;
45 channel[dep->reordering][dep->multiplicity][dep->from != dep->to]++;
46 if (dep->from == dep->to && dep->size && !strcmp(dep->size->s->c_str(), "1"))
47 registers++;
49 printf("%d = %d + (%d = ((%d + %d) + %d) + (%d + %d) + (%d + %d) + (%d + %d))\n",
50 channels, wires, non_wires,
51 registers, channel[0][0][0]-registers, channel[0][0][1],
52 channel[0][1][0], channel[0][1][1],
53 channel[1][0][0], channel[1][0][1],
54 channel[1][1][0], channel[1][1][1]);
56 pdg->free();
57 delete pdg;
58 isl_ctx_free(ctx);
60 return 0;