-
Notifications
You must be signed in to change notification settings - Fork 0
/
branchCounter2.c
40 lines (32 loc) · 1.05 KB
/
branchCounter2.c
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
//Script to generate a list of branches and their outcome following the format above
//First column: the id or address of the branch
//Second column: the outcome of the branch
// 0 means the branch is not taken (0 = NT)
// 1 means the branch is taken (1 = NT)
#include <stdio.h>
int main() {
FILE *fptr;
fptr = fopen("vhdl_input2.txt", "w"); //open the file to store the data
for(int i =0; i<1000; i++){
//fprintf(fptr, "1 T\n");
if(i != 0) //first time in the loop, no branch
fprintf(fptr, "1 1\n");
for(int j=0; j<4; j++){
//fprintf(fptr, "2 T\n");
if (j != 0) //first time in the loop, no branch
fprintf(fptr, "2 1\n");
for(int k=0; k<20; k++){
//fprintf(fptr, "2 T\n");
if (k != 0) //first time in the loop, no branch
fprintf(fptr, "3 1\n");
}
//fprintf(fptr, "2 NT\n");
fprintf(fptr, "3 0\n");
}
//fprintf(fptr, "2 NT\n");
fprintf(fptr, "2 0\n");
}
//fprintf(fptr, "1 NT\n");
fprintf(fptr, "1 0\n");
return 0;
}