added one helper function

This commit is contained in:
Wolfgang Spraul 2013-01-16 04:14:29 -05:00
parent 4e3554a4f1
commit e919fb0f4b
2 changed files with 33 additions and 0 deletions

View File

@ -46,6 +46,36 @@ int fpga_find_iob(struct fpga_model *model, const char *sitename,
return 0;
}
const char *fpga_iob_sitename(struct fpga_model *model,
int y, int x, dev_type_idx_t type_idx)
{
int i, j;
for (i = 0; i < model->die->num_t2_ios; i++) {
if (!model->die->t2_io[i].pair)
continue;
if (model->die->t2_io[i].y == y
&& model->die->t2_io[i].x == x
&& model->die->t2_io[i].type_idx == type_idx)
break;
}
if (i >= model->die->num_t2_ios) {
HERE();
return 0;
}
for (j = 0; j < model->pkg->num_pins; j++) {
if (model->pkg->pin[j].bank == model->die->t2_io[i].bank
&& model->pkg->pin[j].pair == model->die->t2_io[i].pair
&& model->pkg->pin[j].pos_side == model->die->t2_io[i].pos_side)
break;
}
if (j >= model->pkg->num_pins) {
HERE();
return 0;
}
return model->pkg->pin[j].name;
}
static void enum_x(struct fpga_model *model, enum fpgadev_type type,
int enum_i, int *y, int x, int *type_idx)
{

View File

@ -11,6 +11,9 @@ typedef int net_idx_t; // net indices are 1-based
int fpga_find_iob(struct fpga_model* model, const char* sitename,
int* y, int* x, dev_type_idx_t* idx);
const char *fpga_iob_sitename(struct fpga_model *model,
int y, int x, dev_type_idx_t type_idx);
//
// When dealing with devices, there are two indices:
// 1. The index of the device in the device array for that tile.