-
Notifications
You must be signed in to change notification settings - Fork 5
/
generate_cnp_vector_tb_exp_txt.cc
50 lines (46 loc) · 1.32 KB
/
generate_cnp_vector_tb_exp_txt.cc
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
/*
Generate dec_vector_tb_exp.txt processed from dec_vector_tb_inp.txt
Copyright 2019 Ahmet Inan <[email protected]>
*/
#include <fstream>
#include "ldpc_vector.hh"
#include "cnp_vector.hh"
int main()
{
std::ifstream vector_input("cnp_vector_tb_inp.txt");
std::ofstream vector_output("cnp_vector_tb_exp.txt");
for (int cnt; vector_input >> cnt;) {
int seq;
vector_input >> seq;
int inp[COUNT_MAX][VECTOR_SCALARS];
int prv[COUNT_MAX][VECTOR_SCALARS];
int wdf[COUNT_MAX], loc[COUNT_MAX];
int off[COUNT_MAX], shi[COUNT_MAX];
for (int j = 0; j < cnt; ++j) {
char chr;
vector_input >> chr;
wdf[j] = chr == 'T';
vector_input.ignore(4, 'E');
vector_input >> loc[j];
vector_input >> off[j];
vector_input.ignore(1, ':');
vector_input >> shi[j];
for (int k = 0; k < VECTOR_SCALARS; ++k)
vector_input >> inp[j][k];
for (int k = 0; k < VECTOR_SCALARS; ++k)
vector_input >> prv[j][k];
}
int out[COUNT_MAX][VECTOR_SCALARS];
cnp_vector(out, inp, prv, cnt, 1);
for (int j = 0; j < cnt; ++j) {
vector_output << seq << '\t';
vector_output << (wdf[j] ? "TRUE" : "FALSE") << '\t';
vector_output << loc[j] << '\t';
vector_output << off[j] << ':' << shi[j];
for (int k = 0; k < VECTOR_SCALARS; ++k)
vector_output << '\t' << out[j][k];
vector_output << std::endl;
}
}
return 0;
}