ttl-fpga/sw/kousaten/src/fpga_cell.h

39 lines
840 B
C

#ifndef FPGA_CELL_H
#define FPGA_CELL_H
enum fpga_cell_position {
LEFT = 0,
TOP,
RIGHT,
BOTTOM,
FPGA_CELL_CONNECTION_COUNT
};
enum fpga_cell_type {
FPGA_CELL_NONE = 0,
FPGA_CELL_WIRE,
FPGA_CELL_LUT34
};
/* FPGA Logic cell base parameters */
struct fpga_cell
{
enum fpga_cell_type type;
struct fpga_cell *cell_connections[FPGA_CELL_CONNECTION_COUNT];
/* Cell-specific data will be appended depending on the cell type. */
};
void fpga_cell_init(struct fpga_cell *fpga_cell,
enum fpga_cell_type fpga_cell_type);
int fpga_cell_connect(struct fpga_cell *fpga_cell,
struct fpga_cell *target_cell,
enum fpga_cell_position position);
struct fpga_cell *fpga_cell_get_far(struct fpga_cell *cell,
enum fpga_cell_position position);
#define FPGA_TO_CELL(a) ((struct fpga_cell*) a)
#endif // FPGA_CELL_H