49 lines
1.0 KiB
C
49 lines
1.0 KiB
C
#include "fpga_cell_wire.h"
|
|
#include <stdlib.h>
|
|
#include "fpga_global.h"
|
|
|
|
struct fpga_cell *fpga_cell_wire_new()
|
|
{
|
|
struct fpga_cell_wire *fpga_cell_wire;
|
|
|
|
fpga_cell_wire = malloc(sizeof(struct fpga_cell_wire));
|
|
|
|
return FPGA_TO_CELL(fpga_cell_wire);
|
|
}
|
|
|
|
struct fpga_cell *fpga_cell_wire_get_next_isp(struct fpga_cell *cell,
|
|
enum fpga_isp_channel *isp_channel)
|
|
{
|
|
switch (*isp_channel) {
|
|
case FPGA_ISP_CHANNEL_NORMAL:
|
|
switch (cell->type->identifier) {
|
|
case 'P':
|
|
return cell->cell_connections[RIGHT];
|
|
case ']':
|
|
*isp_channel = FPGA_ISP_CHANNEL_BACK;
|
|
return cell->cell_connections[LEFT];
|
|
default:
|
|
goto fail;
|
|
}
|
|
|
|
case FPGA_ISP_CHANNEL_BACK:
|
|
switch (cell->type->identifier) {
|
|
case 'P':
|
|
case '[':
|
|
*isp_channel = FPGA_ISP_CHANNEL_LFDN;
|
|
return cell->cell_connections[RIGHT];
|
|
}
|
|
default:
|
|
goto fail;
|
|
}
|
|
|
|
fail:
|
|
report(LL_ERROR,
|
|
"Entered wiring cell %c on invalid ISP channel %d.",
|
|
cell->type->identifier, *isp_channel);
|
|
*isp_channel = FPGA_ISP_CHANNEL_ERROR;
|
|
return NULL;
|
|
|
|
return NULL;
|
|
}
|