VPR-6.0

vpr/SRC/pack/pb_type_graph.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void alloc_and_load_all_pb_graphs ()
void echo_pb_graph (char *filename)
void free_all_pb_graph_nodes ()
t_pb_graph_pin *** alloc_and_load_port_pin_ptrs_from_string (INP const t_pb_graph_node *pb_graph_parent_node, INP t_pb_graph_node **pb_graph_children_nodes, INP const char *port_string, OUTP int **num_ptrs, OUTP int *num_sets, INP boolean is_input_to_interc, INP boolean interconnect_error_check)

Function Documentation

void alloc_and_load_all_pb_graphs ( )

Allocate memory into types and load the pb graph with interconnect edges

Definition at line 85 of file pb_type_graph.c.

                                     {
        int i, errors;
        edges_head = NULL;
        num_edges_head = NULL;
        for(i = 0; i < num_types; i++) {
                if(type_descriptors[i].pb_type) {
                        pin_count_in_cluster = 0;
                        type_descriptors[i].pb_graph_head = my_calloc(1, sizeof(t_pb_graph_node));
                        alloc_and_load_pb_graph(type_descriptors[i].pb_graph_head, NULL, type_descriptors[i].pb_type, 0);
                        type_descriptors[i].pb_graph_head->total_pb_pins = pin_count_in_cluster;
                        alloc_and_load_pin_locations_from_pb_graph(&type_descriptors[i]);
                } else {
                        type_descriptors[i].pb_graph_head = NULL;
                        assert(&type_descriptors[i] == EMPTY_TYPE);
                }
        }

        errors = check_pb_graph ();
        if(errors > 0) {
                printf("Errors in pb graph");
                exit(1);
        }
        for(i = 0; i < num_types; i++) {
                if(type_descriptors[i].pb_type) {
                        load_pb_graph_pin_to_pin_annotations(type_descriptors[i].pb_graph_head);
                }
        }
}

Here is the call graph for this function:

Here is the caller graph for this function:

t_pb_graph_pin*** alloc_and_load_port_pin_ptrs_from_string ( INP const t_pb_graph_node pb_graph_parent_node,
INP t_pb_graph_node **  pb_graph_children_nodes,
INP const char *  port_string,
OUTP int **  num_ptrs,
OUTP int *  num_sets,
INP boolean  is_input_to_interc,
INP boolean  interconnect_error_check 
)

creates an array of pointers to the pb graph node pins in order from the port string

Returns:
t_pb_graph_pin ptr indexed by [0..num_sets_in_port - 1][0..num_ptrs - 1]

Definition at line 480 of file pb_type_graph.c.

                                                                                                                                                                        {
        t_token * tokens;
        int num_tokens, curr_set;
        int i;
        boolean in_squig_bracket, success;
        
        t_pb_graph_pin ***pb_graph_pins;

        num_tokens = 0;
        tokens = GetTokensFromString(port_string, &num_tokens);
        *num_sets = 0;
        in_squig_bracket = FALSE;
        
        /* count the number of sets available */
        for(i = 0; i < num_tokens; i++) {
                assert(tokens[i].type != TOKEN_NULL);
                if(tokens[i].type == TOKEN_OPEN_SQUIG_BRACKET) {
                        if(in_squig_bracket) {
                                printf(ERRTAG "{ inside { in port %s\n", port_string);
                                exit(1);
                        }
                        in_squig_bracket = TRUE;
                } else if(tokens[i].type == TOKEN_CLOSE_SQUIG_BRACKET) {
                        if(!in_squig_bracket) {
                                (*num_sets)++;
                                printf(ERRTAG "No matching '{' for '}' in port %s\n", port_string);
                                exit(1);
                        }
                        in_squig_bracket = FALSE;
                } else if(tokens[i].type == TOKEN_DOT) {
                        if(!in_squig_bracket) {
                                (*num_sets)++;
                        }               
                }
        }

        if(in_squig_bracket) {
                (*num_sets)++;
                printf(ERRTAG "No matching '{' for '}' in port %s\n", port_string);
                exit(1);
        }

        pb_graph_pins = my_calloc(*num_sets, sizeof(t_pb_graph_pin**));
        *num_ptrs = my_calloc(*num_sets, sizeof(int));


        curr_set = 0;
        for(i = 0; i < num_tokens; i++) {
                assert(tokens[i].type != TOKEN_NULL);
                if(tokens[i].type == TOKEN_OPEN_SQUIG_BRACKET) {
                        if(in_squig_bracket) {
                                printf(ERRTAG "{ inside { in port %s\n", port_string);
                                exit(1);
                        }
                        in_squig_bracket = TRUE;
                } else if(tokens[i].type == TOKEN_CLOSE_SQUIG_BRACKET) {
                        if((*num_ptrs)[curr_set] == 0) {
                                printf(ERRTAG "No data contained in {} in port %s\n", port_string);
                                exit(1);
                        }
                        if(!in_squig_bracket) {
                                curr_set++;
                                printf(ERRTAG "No matching '{' for '}' in port %s\n", port_string);
                                exit(1);
                        }
                        in_squig_bracket = FALSE;
                } else if(tokens[i].type == TOKEN_STRING) {

                        success = realloc_and_load_pb_graph_pin_ptrs_at_var(pb_graph_parent_node,
                                                                                                                pb_graph_children_nodes,
                                                                                                                interconnect_error_check,
                                                                                                                is_input_to_interc,
                                                                                                                tokens,
                                                                                                                &i,
                                                                                                                &((*num_ptrs)[curr_set]),
                                                                                                                &pb_graph_pins[curr_set]);

                        if(!success) {
                                printf(ERRTAG "syntax error processing port string %s\n", port_string);
                                exit(1);
                        }

                        if(!in_squig_bracket) {
                                curr_set++;
                        }               
                }
        }
        assert(curr_set == *num_sets);
        freeTokens(tokens, num_tokens);
        return pb_graph_pins;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void echo_pb_graph ( char *  filename)

Print out the pb_type graph

Definition at line 134 of file pb_type_graph.c.

                                     {
        FILE *fp;
    int i;

    fp = my_fopen(filename, "w", 0);

    fprintf(fp, "Physical Blocks Graph\n");
        fprintf(fp, "--------------------------------------------\n\n");

    for(i = 0; i < num_types; i++)
        {
                fprintf(fp, "type %s\n", type_descriptors[i].name);
                if(type_descriptors[i].pb_graph_head)
                        echo_pb_rec(type_descriptors[i].pb_graph_head, 1, fp);
        }

    fclose(fp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void free_all_pb_graph_nodes ( )

Free pb graph

Definition at line 118 of file pb_type_graph.c.

                                {
        int i;
        for(i = 0; i < num_types; i++) {
                if(type_descriptors[i].pb_type) {
                        pin_count_in_cluster = 0;
                        if(type_descriptors[i].pb_graph_head) {
                                free_pb_graph(type_descriptors[i].pb_graph_head);
                        }
                }
        }
}

Here is the call graph for this function:

Here is the caller graph for this function: