VPR-6.0

vpr/SRC/base/read_place.h File Reference

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

Go to the source code of this file.

Functions

void read_place (INP const char *place_file, INP const char *arch_file, INP const char *net_file, INP int nx, INP int ny, INP int num_blocks, INOUTP struct s_block block_list[])
void print_place (INP char *place_file, INP char *net_file, INP char *arch_file)
void read_user_pad_loc (INP char *pad_loc_file)

Function Documentation

void print_place ( INP char *  place_file,
INP char *  net_file,
INP char *  arch_file 
)
void read_place ( INP const char *  place_file,
INP const char *  arch_file,
INP const char *  net_file,
INP int  nx,
INP int  ny,
INP int  num_blocks,
INOUTP struct s_block  block_list[] 
)

Definition at line 17 of file read_place.c.

{

    FILE *infile;
    char **tokens;
    int line;
    int i;
    int error;
    struct s_block *cur_blk;

    infile = fopen(place_file, "r");

    /* Check filenames in first line match */
    tokens = ReadLineTokens(infile, &line);
    error = 0;
    if(NULL == tokens)
        {
            error = 1;
        }
    for(i = 0; i < 6; ++i)
        {
            if(!error)
                {
                    if(NULL == tokens[i])
                        {
                            error = 1;
                        }
                }
        }
    if(!error)
        {
            if((0 != strcmp(tokens[0], "Netlist")) ||
               (0 != strcmp(tokens[1], "file:")) ||
               (0 != strcmp(tokens[3], "Architecture")) ||
               (0 != strcmp(tokens[4], "file:")))
                {
                    error = 1;
                };
        }
    if(error)
        {
            printf(ERRTAG
                   "'%s' - Bad filename specification line in placement file\n",
                   place_file);
            exit(1);
        }
    if(0 != strcmp(tokens[2], arch_file))
        {
            printf(ERRTAG
                   "'%s' - Architecture file that generated placement (%s) does "
                   "not match current architecture file (%s)\n", place_file,
                   tokens[2], arch_file);
            exit(1);
        }
    if(0 != strcmp(tokens[5], net_file))
        {
            printf(ERRTAG
                   "'%s' - Netlist file that generated placement (%s) does "
                   "not match current netlist file (%s)\n", place_file,
                   tokens[5], net_file);
            exit(1);
        }

    /* Check array size in second line matches */
    tokens = ReadLineTokens(infile, &line);
    error = 0;
    if(NULL == tokens)
        {
            error = 1;
        }
    for(i = 0; i < 7; ++i)
        {
            if(!error)
                {
                    if(NULL == tokens[i])
                        {
                            error = 1;
                        }
                }
        }
    if(!error)
        {
            if((0 != strcmp(tokens[0], "Array")) ||
               (0 != strcmp(tokens[1], "size:")) ||
               (0 != strcmp(tokens[3], "x")) ||
               (0 != strcmp(tokens[5], "logic")) ||
               (0 != strcmp(tokens[6], "blocks")))
                {
                    error = 1;
                };
        }
    if(error)
        {
            printf(ERRTAG
                   "'%s' - Bad fpga size specification line in placement file\n",
                   place_file);
            exit(1);
        }
    if((my_atoi(tokens[2]) != nx) || (my_atoi(tokens[4]) != ny))
        {
            printf(ERRTAG
                   "'%s' - Current FPGA size (%d x %d) is different from "
                   "size when placement generated (%d x %d)\n", place_file,
                   nx, ny, my_atoi(tokens[2]), my_atoi(tokens[4]));
            exit(1);
        }

    tokens = ReadLineTokens(infile, &line);
    while(tokens)
        {
            /* Linear search to match pad to netlist */
            cur_blk = NULL;
            for(i = 0; i < num_blocks; ++i)
                {
                    if(0 == strcmp(block_list[i].name, tokens[0]))
                        {
                            cur_blk = (block_list + i);
                            break;
                        }
                }

            /* Error if invalid block */
            if(NULL == cur_blk)
                {
                    printf(ERRTAG "'%s':%d - Block in placement file does "
                           "not exist in netlist\n", place_file, line);
                    exit(1);
                }

            /* Set pad coords */
            cur_blk->x = my_atoi(tokens[1]);
            cur_blk->y = my_atoi(tokens[2]);
            cur_blk->z = my_atoi(tokens[3]);

            /* Get next line */
            assert(*tokens);
            free(*tokens);
            free(tokens);
            tokens = ReadLineTokens(infile, &line);
        }

    fclose(infile);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void read_user_pad_loc ( INP char *  pad_loc_file)