62 lines
1.4 KiB
C
62 lines
1.4 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];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// switch (cell->type->identifier) {
|
||
|
// case ' ':
|
||
|
// report(LL_WARNING,
|
||
|
// "ISP signal ran into empty cell. Terminating chain.");
|
||
|
// return NULL;
|
||
|
// case ']':
|
||
|
// switch (*isp_channel) {
|
||
|
// case FPGA_ISP_CHANNEL_NORMAL:
|
||
|
// *isp_channel = FPGA_ISP_CHANNEL_BACK;
|
||
|
// return cell->cell_connections[LEFT];
|
||
|
// 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;
|
||
|
}
|