SRC/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 (IN const char *place_file, IN const char *arch_file, IN const char *net_file, IN int nx, IN int ny, IN int num_blocks, INOUT struct s_block block_list[])
void print_place (IN char *place_file, IN char *net_file, IN char *arch_file)
void read_user_pad_loc (IN char *pad_loc_file)

Function Documentation

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

Definition at line 17 of file read_place.c.

00024 {
00025 
00026     FILE *infile;
00027     char **tokens;
00028     int line;
00029     int i;
00030     int error;
00031     struct s_block *cur_blk;
00032 
00033     infile = my_fopen(place_file, "r");
00034 
00035     /* Check filenames in first line match */
00036     tokens = ReadLineTokens(infile, &line);
00037     error = 0;
00038     if(NULL == tokens)
00039         {
00040             error = 1;
00041         }
00042     for(i = 0; i < 6; ++i)
00043         {
00044             if(!error)
00045                 {
00046                     if(NULL == tokens[i])
00047                         {
00048                             error = 1;
00049                         }
00050                 }
00051         }
00052     if(!error)
00053         {
00054             if((0 != strcmp(tokens[0], "Netlist")) ||
00055                (0 != strcmp(tokens[1], "file:")) ||
00056                (0 != strcmp(tokens[3], "Architecture")) ||
00057                (0 != strcmp(tokens[4], "file:")))
00058                 {
00059                     error = 1;
00060                 };
00061         }
00062     if(error)
00063         {
00064             printf(ERRTAG
00065                    "'%s' - Bad filename specification line in placement file\n",
00066                    place_file);
00067             exit(1);
00068         }
00069     if(0 != strcmp(tokens[2], arch_file))
00070         {
00071             printf(ERRTAG
00072                    "'%s' - Architecture file that generated placement (%s) does "
00073                    "not match current architecture file (%s)\n", place_file,
00074                    tokens[2], arch_file);
00075             exit(1);
00076         }
00077     if(0 != strcmp(tokens[5], net_file))
00078         {
00079             printf(ERRTAG
00080                    "'%s' - Netlist file that generated placement (%s) does "
00081                    "not match current netlist file (%s)\n", place_file,
00082                    tokens[5], net_file);
00083             exit(1);
00084         }
00085 
00086     /* Check array size in second line matches */
00087     tokens = ReadLineTokens(infile, &line);
00088     error = 0;
00089     if(NULL == tokens)
00090         {
00091             error = 1;
00092         }
00093     for(i = 0; i < 7; ++i)
00094         {
00095             if(!error)
00096                 {
00097                     if(NULL == tokens[i])
00098                         {
00099                             error = 1;
00100                         }
00101                 }
00102         }
00103     if(!error)
00104         {
00105             if((0 != strcmp(tokens[0], "Array")) ||
00106                (0 != strcmp(tokens[1], "size:")) ||
00107                (0 != strcmp(tokens[3], "x")) ||
00108                (0 != strcmp(tokens[5], "logic")) ||
00109                (0 != strcmp(tokens[6], "blocks")))
00110                 {
00111                     error = 1;
00112                 };
00113         }
00114     if(error)
00115         {
00116             printf(ERRTAG
00117                    "'%s' - Bad fpga size specification line in placement file\n",
00118                    place_file);
00119             exit(1);
00120         }
00121     if((my_atoi(tokens[2]) != nx) || (my_atoi(tokens[4]) != ny))
00122         {
00123             printf(ERRTAG
00124                    "'%s' - Current FPGA size (%d x %d) is different from "
00125                    "size when placement generated (%d x %d)\n", place_file,
00126                    nx, ny, my_atoi(tokens[2]), my_atoi(tokens[4]));
00127             exit(1);
00128         }
00129 
00130     tokens = ReadLineTokens(infile, &line);
00131     while(tokens)
00132         {
00133             /* Linear search to match pad to netlist */
00134             cur_blk = NULL;
00135             for(i = 0; i < num_blocks; ++i)
00136                 {
00137                     if(0 == strcmp(block_list[i].name, tokens[0]))
00138                         {
00139                             cur_blk = (block_list + i);
00140                             break;
00141                         }
00142                 }
00143 
00144             /* Error if invalid block */
00145             if(NULL == cur_blk)
00146                 {
00147                     printf(ERRTAG "'%s':%d - Block in placement file does "
00148                            "not exist in netlist\n", place_file, line);
00149                     exit(1);
00150                 }
00151 
00152             /* Set pad coords */
00153             cur_blk->x = my_atoi(tokens[1]);
00154             cur_blk->y = my_atoi(tokens[2]);
00155             cur_blk->z = my_atoi(tokens[3]);
00156 
00157             /* Get next line */
00158             assert(*tokens);
00159             free(*tokens);
00160             free(tokens);
00161             tokens = ReadLineTokens(infile, &line);
00162         }
00163 
00164     fclose(infile);
00165 }

Here is the call graph for this function:

Here is the caller graph for this function:

void read_user_pad_loc ( IN char *  pad_loc_file  ) 

Generated on Tue Jan 5 15:26:02 2010 for VPR5.0 by  doxygen 1.6.1