16 INP const char *net_file,
INP int L_nx,
INP int L_ny,
26 infile = fopen(place_file,
"r");
34 for (i = 0; i < 6; ++i) {
36 if (NULL == tokens[i]) {
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:"))) {
50 vpr_printf(TIO_MESSAGE_ERROR,
"'%s' - Bad filename specification line in placement file.\n", place_file);
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);
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);
72 for (i = 0; i < 7; ++i) {
74 if (NULL == tokens[i]) {
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"))) {
89 vpr_printf(TIO_MESSAGE_ERROR,
"'%s' - Bad FPGA size specification line in placement file.\n",
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",
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);
113 if (NULL == cur_blk) {
114 vpr_printf(TIO_MESSAGE_ERROR,
"'%s':%d - Block in placement file does not exist in netlist.\n",
138 struct s_hash **hash_table, *h_ptr;
139 int iblk, i, j, xtmp, ytmp, bnum, k;
144 vpr_printf(TIO_MESSAGE_INFO,
"Reading locations of IO pads from '%s'.\n", pad_loc_file);
146 fp = fopen(pad_loc_file,
"r");
156 for (i = 0; i <=
nx + 1; i++) {
157 for (j = 0; j <=
ny + 1; j++) {
167 while (ptr != NULL) {
181 sscanf(ptr,
"%d", &xtmp);
188 sscanf(ptr,
"%d", &ytmp);
195 sscanf(ptr,
"%d", &k);
199 vpr_printf(TIO_MESSAGE_ERROR,
"[Line %d] Extra characters at end of line.\n",
206 vpr_printf(TIO_MESSAGE_WARNING,
"[Line %d] Block %s invalid, no such IO pad.\n",
216 vpr_printf(TIO_MESSAGE_ERROR,
"[Line %d] Block %s is listed twice in pad file.\n",
221 if (i < 0 || i >
nx + 1 || j < 0 || j >
ny + 1) {
222 vpr_printf(TIO_MESSAGE_ERROR,
"Block #%d (%s) location, (%d,%d) is out of range.\n",
232 vpr_printf(TIO_MESSAGE_ERROR,
"Attempt to place IO block %s at illegal location (%d, %d).\n",
238 vpr_printf(TIO_MESSAGE_ERROR,
"[Line %d] Block %s subblock number (%d) is out of range.\n",
250 vpr_printf(TIO_MESSAGE_ERROR,
"IO block %s location was not specified in the pad file.\n",
258 vpr_printf(TIO_MESSAGE_INFO,
"Successfully read %s.\n", pad_loc_file);
262 void print_place(
char *place_file,
char *net_file,
char *arch_file) {
272 fp = fopen(place_file,
"w");
274 fprintf(fp,
"Netlist file: %s Architecture file: %s\n", net_file,
276 fprintf(fp,
"Array size: %d x %d logic blocks\n\n",
nx,
ny);
277 fprintf(fp,
"#block name\tx\ty\tsubblk\tblock number\n");
278 fprintf(fp,
"#----------\t--\t--\t------\t------------\n");
282 if (strlen(
block[i].name) < 8)
286 fprintf(fp,
"\t#%d\n", i);
struct s_hash ** alloc_hash_table(void)
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[])
struct s_hash * get_hash_entry(struct s_hash **hash_table, char *name)
void free_hash_table(struct s_hash **hash_table)
void read_user_pad_loc(char *pad_loc_file)
char * my_strtok(char *ptr, const char *tokens, FILE *fp, char *buf)
void print_place(char *place_file, char *net_file, char *arch_file)
struct s_grid_tile ** grid
char ** ReadLineTokens(INOUTP FILE *InFile, INOUTP int *LineNum)
char * my_fgets(char *buf, int max_size, FILE *fp)
int my_atoi(const char *str)
struct s_hash * insert_in_hash_table(struct s_hash **hash_table, char *name, int next_free_index)