VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
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 L_nx, INP int L_ny, INP int L_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  L_nx,
INP int  L_ny,
INP int  L_num_blocks,
INOUTP struct s_block  block_list[] 
)

Definition at line 15 of file read_place.c.

17  {
18 
19  FILE *infile;
20  char **tokens;
21  int line;
22  int i;
23  int error;
24  struct s_block *cur_blk;
25 
26  infile = fopen(place_file, "r");
27 
28  /* Check filenames in first line match */
29  tokens = ReadLineTokens(infile, &line);
30  error = 0;
31  if (NULL == tokens) {
32  error = 1;
33  }
34  for (i = 0; i < 6; ++i) {
35  if (!error) {
36  if (NULL == tokens[i]) {
37  error = 1;
38  }
39  }
40  }
41  if (!error) {
42  if ((0 != strcmp(tokens[0], "Netlist"))
43  || (0 != strcmp(tokens[1], "file:"))
44  || (0 != strcmp(tokens[3], "Architecture"))
45  || (0 != strcmp(tokens[4], "file:"))) {
46  error = 1;
47  };
48  }
49  if (error) {
50  vpr_printf(TIO_MESSAGE_ERROR, "'%s' - Bad filename specification line in placement file.\n", place_file);
51  exit(1);
52  }
53  if (0 != strcmp(tokens[2], arch_file)) {
54  vpr_printf(TIO_MESSAGE_ERROR, "'%s' - Architecture file that generated placement (%s) does not match current architecture file (%s).\n",
55  place_file, tokens[2], arch_file);
56  exit(1);
57  }
58  if (0 != strcmp(tokens[5], net_file)) {
59  vpr_printf(TIO_MESSAGE_ERROR, "'%s' - Netlist file that generated placement (%s) does not match current netlist file (%s).\n",
60  place_file, tokens[5], net_file);
61  exit(1);
62  }
63  free(*tokens);
64  free(tokens);
65 
66  /* Check array size in second line matches */
67  tokens = ReadLineTokens(infile, &line);
68  error = 0;
69  if (NULL == tokens) {
70  error = 1;
71  }
72  for (i = 0; i < 7; ++i) {
73  if (!error) {
74  if (NULL == tokens[i]) {
75  error = 1;
76  }
77  }
78  }
79  if (!error) {
80  if ((0 != strcmp(tokens[0], "Array"))
81  || (0 != strcmp(tokens[1], "size:"))
82  || (0 != strcmp(tokens[3], "x"))
83  || (0 != strcmp(tokens[5], "logic"))
84  || (0 != strcmp(tokens[6], "blocks"))) {
85  error = 1;
86  };
87  }
88  if (error) {
89  vpr_printf(TIO_MESSAGE_ERROR, "'%s' - Bad FPGA size specification line in placement file.\n",
90  place_file);
91  exit(1);
92  }
93  if ((my_atoi(tokens[2]) != L_nx) || (my_atoi(tokens[4]) != L_ny)) {
94  vpr_printf(TIO_MESSAGE_ERROR, "'%s' - Current FPGA size (%d x %d) is different from size when placement generated (%d x %d).\n",
95  place_file, L_nx, L_ny, my_atoi(tokens[2]), my_atoi(tokens[4]));
96  exit(1);
97  }
98  free(*tokens);
99  free(tokens);
100 
101  tokens = ReadLineTokens(infile, &line);
102  while (tokens) {
103  /* Linear search to match pad to netlist */
104  cur_blk = NULL;
105  for (i = 0; i < L_num_blocks; ++i) {
106  if (0 == strcmp(block_list[i].name, tokens[0])) {
107  cur_blk = (block_list + i);
108  break;
109  }
110  }
111 
112  /* Error if invalid block */
113  if (NULL == cur_blk) {
114  vpr_printf(TIO_MESSAGE_ERROR, "'%s':%d - Block in placement file does not exist in netlist.\n",
115  place_file, line);
116  exit(1);
117  }
118 
119  /* Set pad coords */
120  cur_blk->x = my_atoi(tokens[1]);
121  cur_blk->y = my_atoi(tokens[2]);
122  cur_blk->z = my_atoi(tokens[3]);
123 
124  /* Get next line */
125  assert(*tokens);
126  free(*tokens);
127  free(tokens);
128  tokens = ReadLineTokens(infile, &line);
129  }
130 
131  fclose(infile);
132 }
int x
Definition: vpr_types.h:563
char * name
Definition: vpr_types.h:560
int y
Definition: vpr_types.h:564
char ** ReadLineTokens(INOUTP FILE *InFile, INOUTP int *LineNum)
Definition: ReadLine.c:39
int z
Definition: vpr_types.h:565
int my_atoi(const char *str)
Definition: util.c:116
messagelogger vpr_printf
Definition: util.c:17

+ 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)