fpgatools/control.h
Wolfgang Spraul dc1a40805f slow day
2012-08-21 14:46:28 +02:00

67 lines
2.4 KiB
C

//
// Author: Wolfgang Spraul
//
// This is free and unencumbered software released into the public domain.
// For details see the UNLICENSE file at the root of the source tree.
//
int fpga_find_iob(struct fpga_model* model, const char* sitename,
int* y, int* x, int* idx);
const char* fpga_iob_sitename(struct fpga_model* model, int y, int x,
int idx);
//
// When dealing with devices, there are two indices:
// 1. The index of the device in the device array for that tile.
// 2. The index of the device within devices of the same type in the tile.
//
// Looks up a device pointer based on the type index.
struct fpga_device* fpga_dev(struct fpga_model* model,
int y, int x, enum fpgadev_type type, int type_idx);
// Counts how many devices of type 'type' are in the device
// array up to devidx.
int fpga_dev_typecount(struct fpga_model* model, int y, int x,
enum fpgadev_type type, int dev_idx);
enum { A6_LUT, B6_LUT, C6_LUT, D6_LUT };
// lut_len can be -1 (ZTERM)
int fpga_set_lut(struct fpga_model* model, struct fpga_device* dev,
int which_lut, const char* lut_str, int lut_len);
// returns a connpt dest index, or -1 (NO_CONN) if no connection was found
int fpga_conn_dest(struct fpga_model* model, int y, int x,
const char* name, int dest_idx);
const char* fpga_conn_to(struct fpga_model* model, int y, int x,
int connpt_dest_idx, int* dest_y, int* dest_x);
typedef int swidx_t;
// SW_FROM and SW_TO values are chosen such that ! inverts them.
#define SW_FROM 0
#define SW_TO 1
// returns a switch index, or -1 (NO_SWITCH) if no switch was found
swidx_t fpga_switch_first(struct fpga_model* model, int y, int x,
const char* name, int from_to);
swidx_t fpga_switch_next(struct fpga_model* model, int y, int x,
swidx_t last, int from_to);
#define SW_TREE_NEXT 0 // use for name
// returns -1 (NO_SWITCH) when there are no more switches in the tree
swidx_t fpga_switch_tree(struct fpga_model* model, int y, int x,
const char* name, int from_to, swidx_t** parents, int* num_parents);
const char* fpga_switch_str(struct fpga_model* model, int y, int x,
swidx_t swidx, int from_to);
int fpga_switch_is_bidir(struct fpga_model* model, int y, int x,
swidx_t swidx);
int fpga_switch_is_enabled(struct fpga_model* model, int y, int x,
swidx_t swidx);
void fpga_switch_enable(struct fpga_model* model, int y, int x,
swidx_t swidx);
void fpga_switch_disable(struct fpga_model* model, int y, int x,
swidx_t swidx);