/** * router.hpp * * for Vivado HLS */ #ifndef __ROUTER_HPP__ #define __ROUTER_HPP__ #ifdef SOFTWARE #include "ap_int.h" #else #include #endif //#define DEBUG_PRINT // for debug #ifdef DEBUG_PRINT using namespace std; #endif // Parameters #define MAX_WIDTH 72 // Max of X, Y #define BITWIDTH_XY 13 #define BITMASK_XY 65528 // 1111 1111 1111 1000 #define MAX_LAYER 8 // Max of Z #define BITWIDTH_Z 3 #define BITMASK_Z 7 // 0000 0000 0000 0111 #define MAX_CELLS 41472 // Max #cells (16bit) #define MAX_LINES 32768 // Max #lines (15bit) #define MAX_PQ 16384 // Queue size (14bit) #define MAX_BUFFER 16384 // Line buffer size (14bit) #define CELL_BIT 16 #define LINE_BIT 15 #define PQ_BIT 14 #define BUFF_BIT 14 #define BOARDSTR_SIZE 41472 // Size of I/O // For random num generation void lfsr_random_init(ap_uint<32> seed); ap_uint<32> lfsr_random(); bool pynqrouter(char boardstr[BOARDSTR_SIZE], char boardstr_high[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *status); bool inside_board(ap_uint cell_id); bool connectable(ap_int board[MAX_CELLS], ap_uint target, ap_uint rip_up); void remove_line(ap_int board[MAX_CELLS], ap_uint rip_up); bool available(ap_uint<2> avail[MAX_CELLS], ap_uint prev[MAX_CELLS], ap_uint start_id, ap_uint goal_id); void qu_push(ap_uint qu_nodes[MAX_PQ], ap_uint id, ap_uint *top, ap_uint *bottom, bool *is_empty); void qu_pop(ap_uint qu_nodes[MAX_PQ], ap_uint *id, ap_uint *top, ap_uint *bottom, bool *is_empty); #endif /* __ROUTER_HPP__ */