..,., these are some words to be parsed.......


"Since conventional computing has reached its limits, new computational methods and devices are being developed," adds Ivan Schuller, a UCSD physicist and one of the paper's authors. "These have the potential of revolutionizing computing and in ways that may one day rival the human brain."

In recent years, scientists have sought to make advances in what is known as "neuromorphic computing"▒~@~a process that seeks to mimic the functionality of the human brain. Because of its human-like characteristics, it may offer more efficient and innovative ways to process data using approaches not achievable using existing computational methods.

..,., these are some words to be parsed.......


"Since conventional computing has reached its limits, new computational methods and devices are being developed," adds Ivan Schuller, a UCSD physicist and one of the paper's authors. "These have the potential of revolutionizing computing and in ways that may one day rival the human brain."

In recent years, scientists have sought to make advances in what is known as "neuromorphic computing"▒~@~a process that seeks to mimic the functionality of the human brain. Because of its human-like characteristics, it may offer more efficient and innovative ways to process data using approaches not achievable using existing computational methods.

..,., these are some words to be parsed.......
12345
6789 test{00} 

"Since conventional computing has reached its limits, new computational methods and devices are being developed," adds Ivan Schuller, a UCSD physicist and one of the paper's authors. "These have the potential of revolutionizing computing and in ways that may one day rival the human brain."

In recent years, scientists have sought to make advances in what is known as "neuromorphic computing"▒~@~a process that seeks to mimic the functionality of the human brain. Because of its human-like characteristics, it may offer more efficient and innovative ways to process data using approaches not achievable using existing computational methods.

..,., these are some words to be parsed.......


"Since conventional computing has reached its limits, new computational methods and devices are being developed," adds Ivan Schuller, a UCSD physicist and one of the paper's authors. "These have the potential of revolutionizing computing and in ways that may one day rival the human brain."

In recent years, scientists have sought to make advances in what is known as "neuromorphic computing"▒~@~a process that seeks to mimic the functionality of the human brain. Because of its human-like characteristics, it may offer more efficient and innovative ways to process data using approaches not achievable using existing computational methods.

..,., these are some words to be parsed.......



In recent years, scientists have sought to make advances in what is known as "neuromorphic computing"▒~@~a process that seeks to mimic the functionality of the human brain. Because of its human-like characteristics, it may offer more efficient and innovative ways to process data using approaches not achievable using existing computational methods.

char iname[1024], oname[1024], oname1[1024];
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}

hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);
asdfasdf
asdfasdf
// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include "hot.h"
#include "parserRL.hot"
#include "parserRL1.hot"
#include <pthread.h>

#define AXI_HPM0_FPD 0xA0000000
#define AXI_HPM0_FPD1 0xA0010000
#define AXI_HPM0_FPD2 0xA0020000
#define OCM_RAM      0xFFFC0000

extern void *read_kria(void *);
extern void *write_kria(void *);
extern void hot_start (volatile uint64_t *);
extern void hot_stop (volatile uint64_t *);
extern void hot_reset (volatile uint64_t *);

int main(int argc, char *argv[]) {
// for each runtime hot file do this
parserRL_init();
parserRL1_init();

int fd = 0;
int fd1 = 0;
int fd2 = 0;
FILE *text_in;
FILE *text_out;
FILE *text_out1;
volatile uint64_t *mem;
volatile uint64_t *mem1;
volatile uint64_t *mem2;
char iname[1024], oname[1024], oname1[1024];
strcpy (iname,argv[1]);
strcpy (oname,argv[2]);
strcpy (oname1,argv[3]);
//printf("%s %s\n",iname,oname); 
fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd > -1 ) printf("opened mem\n");
else {printf("Cound not open mem\n");exit(-1);}
fd1 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd1 > -1 ) printf("opened mem1\n");
else {printf("Cound not open mem1\n");exit(-1);}
fd2 = open("/dev/mem", O_RDWR|O_SYNC);
if (fd2 > -1 ) printf("opened mem2\n");
else {printf("Cound not open mem2\n");exit(-1);}
// opens the HPM0_FPD bus
mem = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, AXI_HPM0_FPD);
mem1 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, AXI_HPM0_FPD1);
mem2 = (uint64_t *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, AXI_HPM0_FPD2);

if (mem == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem1 == (void *) -1) {printf("could not map mem\n"); exit(0);}
if (mem2 == (void *) -1) {printf("could not map mem\n"); exit(0);}
text_in = fopen(iname,"r");
if (text_in == NULL) {
        printf("Could not open %s\n",iname);
        exit(1);
    }
fseek(text_in, 0L, SEEK_END);
int size = ftell(text_in);
int num_words = 0;
num_words = size / 8;
if (size%8 != 0) num_words = num_words + 1; 
//printf("text.txt size: bytes = %d, num_words (size/8) = %d\n",size,num_words);
//go back to the start of the file
rewind(text_in);
//there will be less text out than text in
uint64_t volatile test_data[num_words];
text_out = fopen(oname,"w");
if(text_out == NULL) {
printf("could not open %s\n",oname); 
exit(-1);
}
text_out1 = fopen(oname1,"w");
if(text_out1 == NULL) {
printf("could not open %s\n",oname1); 
exit(-1);
}
// flip endianness, could be done in hardware
char *data = (char *) aligned_alloc(512,size);
for (int i = 0; i < size; i = i+8) 
	for (int j = 7; j >= 0; j--){
	fscanf(text_in,"%c",&data[i+j]);
	}

hot_reset(mem + 0x200);
loadsmdata(mem1,&parserRL);
loaduberLUT  (mem2,&parserRL);

ReadParams_t *ReadParams = (ReadParams_t *) aligned_alloc(512, sizeof(ReadParams_t));
ReadParams->data_out = (char *) test_data;
ReadParams->baseaddress = mem;
ReadParams->statusbase =  mem1;
ReadParams->words_read = 0;


WriteParams_t *WriteParams = (WriteParams_t *) aligned_alloc(512, sizeof(WriteParams_t));
WriteParams->data_in = data;
WriteParams->baseaddress = mem;
WriteParams->statusbase = mem1;
WriteParams->size_in_bytes = size;
WriteParams->fifo_size = 0x1000;

pthread_t ReadThread, WriteThread;
pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);


char *temp;

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out);
        }
}


hot_reset(&mem[0x200]);
loadsmdata(mem1,&parserRL1);
loaduberLUT  (mem2,&parserRL1);

pthread_create(&WriteThread,NULL,write_kria,(void *) WriteParams);
pthread_create(&ReadThread,NULL,read_kria,(void *) ReadParams);
pthread_join(ReadThread,NULL);

// flip endianness
for (int i = 0; i < ReadParams->words_read; i++) { 
	temp = (char*) &test_data[i];
	for (int j = 7; j >= 0; j--){
		fputc(temp[j],text_out1);
        }
}

fclose(text_in);
fclose(text_out);
fclose(text_out1);
return(0);
}
