OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_verilator/] [traffic_task_graph.h] - Diff between revs 38 and 43

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 38 Rev 43
Line 1... Line 1...
 
 
 
 
#ifndef TRAFFIC_TASK_GRAPH_H
#ifndef TRAFFIC_TASK_GRAPH_H
#define TRAFFIC_TASK_GRAPH_H
#define TRAFFIC_TASK_GRAPH_H
 
 
 
 
 
 
#define SET_AUTO -1
#define SET_AUTO -1
 
 
 
 
 
 
#define MAX_LINE_LEN 1000
#define MAX_LINE_LEN 1000
Line 50... Line 49...
 
 
 
 
 
 
unsigned int total_active_routers=0;
unsigned int total_active_routers=0;
unsigned int task_graph_total_pck_num=0;
unsigned int task_graph_total_pck_num=0;
node_t * task_graph_data[NC];
node_t * task_graph_data[NE];
index_t task_graph_abstract[NC];
index_t task_graph_abstract[NE];
 
 
 
 
 
 
 
 
void push(node_t ** head,  task_t task) {
void push(node_t ** head,  task_t task) {
Line 189... Line 188...
    st->burst_sent=0;
    st->burst_sent=0;
 
 
   return 1;
   return 1;
}
}
 
 
int calcualte_traffic_parameters(node_t * head[NC],index_t (* info)){
int calcualte_traffic_parameters(node_t * head[NE],index_t (* info)){
        int i,j;
        int i,j;
         task_t  task;
         task_t  task;
 
 
        unsigned int max_bytes=0,accum[NC];
        unsigned int max_bytes=0,accum[NE];
        unsigned int min_total[NC];
        unsigned int min_total[NE];
 
 
        //find the maximum bytes that an IP sends
        //find the maximum bytes that an IP sends
        for(i=0;i<NC;i++){
        for(i=0;i<NE;i++){
 
 
                info[i].active_index=-1;
                info[i].active_index=-1;
                j=0;
                j=0;
                accum[i]=0;
                accum[i]=0;
                if(head[i]!=NULL){
                if(head[i]!=NULL){
Line 218... Line 217...
                }
                }
 
 
        }
        }
 
 
 
 
        for(i=0;i<NC;i++){
        for(i=0;i<NE;i++){
 
 
                j=0;
                j=0;
                if(head[i]!=NULL){
                if(head[i]!=NULL){
                        while(  read(head[i],j,&task)==1){
                        while(  read(head[i],j,&task)==1){
                                if(task.burst_size ==SET_AUTO) task.burst_size = task.estimated_total_pck_num/min_total[i];
                                if(task.burst_size ==SET_AUTO) task.burst_size = task.estimated_total_pck_num/min_total[i];
Line 238... Line 237...
 
 
 
 
 
 
 
 
 
 
void load_traffic_file(char * file, node_t * head[NC], index_t (* info)){
void load_traffic_file(char * file, node_t * head[NE], index_t (* info)){
        FILE * in;
        FILE * in;
        char * line = NULL;
        char * line = NULL;
 
 
     task_t st;
     task_t st;
    char l[MAX_LINE_LEN];
    char l[MAX_LINE_LEN];
Line 252... Line 251...
    if(in == NULL){
    if(in == NULL){
        printf("Error: cannot open %s file in read mode!\n",file);
        printf("Error: cannot open %s file in read mode!\n",file);
            exit(1);
            exit(1);
        }
        }
 
 
    for(i=0;i<NC;i++){
    for(i=0;i<NE;i++){
                        head[i]=NULL;
                        head[i]=NULL;
    }
    }
 
 
 
 
        while (fgets(l,MAX_LINE_LEN, in) != NULL)  {
        while (fgets(l,MAX_LINE_LEN, in) != NULL)  {
                line = removewhiteSpacses(l);
                line = removewhiteSpacses(l);
        if(line[0] != '%' && line[0] != 0 ) {
        if(line[0] != '%' && line[0] != 0 ) {
                        n=extract_traffic_data(line, &st);
                        n=extract_traffic_data(line, &st);
                        if(n==0 || st.dst >=NC) continue;// the  destination address must be smaller than NC
                        if(n==0 || st.dst >=NE) continue;// the  destination address must be smaller than NC
                    push(&head[st.src],st);
                    push(&head[st.src],st);
                }
                }
        }
        }
        fclose(in);
        fclose(in);
        calcualte_traffic_parameters(head,info);
        calcualte_traffic_parameters(head,info);
        for(i=0;i<NC;i++){
        for(i=0;i<NE;i++){
                if(info[i].total_index !=0) total_active_routers++;
                if(info[i].total_index !=0) total_active_routers++;
        }
        }
}
}
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.