Commit ab546e29 authored by kazushi.kawamura's avatar kazushi.kawamura

Update a bitstream file

parent 266ebb97
......@@ -7,7 +7,7 @@ CXXFLAGS = -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label -DSOFTWARE -DCALCTIM
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) -O3 -Wl,--stack,33554432 -o $@ $(OBJS)
$(CXX) -O3 -Wl,--stack,134217728 -o $@ $(OBJS)
clean:
rm *.o
......
This diff is collapsed.
......@@ -17,11 +17,13 @@
static ap_uint<32> lfsr;
void lfsr_random_init(ap_uint<32> seed) {
#pragma HLS INLINE
lfsr = seed;
}
ap_uint<32> lfsr_random() {
#pragma HLS INLINE
bool b_32 = lfsr.get_bit(32-32);
bool b_22 = lfsr.get_bit(32-22);
......@@ -54,9 +56,12 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], char boardstr_high[BOARDSTR_SIZE],
*status = -1;
// board
ap_int<LINE_BIT+1> board[MAX_CELLS]; // -1024 ~ 1023 (Negative values mean terminals)
ap_int<LINE_BIT+1> board[MAX_CELLS];
#pragma HLS ARRAY_PARTITION variable=board cyclic factor=64 dim=1
// -1024 ~ 1023 (Negative values mean terminals)
INIT_BOARD_ARRAY:
for (ap_uint<CELL_BIT> i = 0; i < (ap_uint<CELL_BIT>)(BOARDSTR_SIZE); i++) {
#pragma HLS UNROLL factor=128
board[i] = 0;
}
......@@ -97,8 +102,11 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], char boardstr_high[BOARDSTR_SIZE],
// For each line
ap_uint<LINE_BIT> connected_line_num = 0;
bool connected[MAX_LINES];
#pragma HLS ARRAY_PARTITION variable=connected cyclic factor=2 dim=1
INIT_CONNECTED:
for (ap_uint<LINE_BIT> i = 1; i <= (ap_uint<LINE_BIT>)(line_num); i++) {
#pragma HLS LOOP_TRIPCOUNT min=2 max=20736
#pragma HLS UNROLL factor=4
connected[i] = false;
}
......@@ -127,7 +135,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], char boardstr_high[BOARDSTR_SIZE],
ap_uint<LINE_BIT> target = lfsr_random() % line_num + 1;
#ifdef DEBUG_PRINT
cout << "(round " << round << ") LINE #" << (int)target << " " << lfsr_random() << endl;
//cout << "(round " << round << ") LINE #" << (int)target << " " << lfsr_random() << endl;
#endif
if (connected[target]) continue;
......@@ -200,6 +208,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], char boardstr_high[BOARDSTR_SIZE],
// ================================ //
bool inside_board(ap_uint<CELL_BIT> cell_id) {
#pragma HLS INLINE
ap_uint<13> cell_xy = (ap_uint<13>)(cell_id >> BITWIDTH_Z);
ap_uint<7> cell_x = (ap_uint<7>)(cell_xy / MAX_WIDTH);
......@@ -256,6 +265,7 @@ bool connectable(ap_int<LINE_BIT+1> board[MAX_CELLS], ap_uint<LINE_BIT> target,
ap_uint<CELL_BIT> id = prev[goal_id];
BACKTRACK:
while (id != start_id) {
#pragma HLS LOOP_TRIPCOUNT min=0 max=256
board[id] = target; id = prev[id];
}
}
......@@ -266,6 +276,7 @@ bool connectable(ap_int<LINE_BIT+1> board[MAX_CELLS], ap_uint<LINE_BIT> target,
void remove_line(ap_int<LINE_BIT+1> board[MAX_CELLS], ap_uint<LINE_BIT> rip_up) {
for (ap_uint<CELL_BIT> i = 0; i < (ap_uint<CELL_BIT>)(MAX_CELLS); i++) {
#pragma HLS UNROLL factor=64
if (!inside_board(i)) continue;
if (board[i] == rip_up) board[i] = 0;
......@@ -383,6 +394,7 @@ bool available(ap_uint<2> avail[MAX_CELLS], ap_uint<CELL_BIT> prev[MAX_CELLS], a
ap_uint<3> j, t;
SHUFFLE_1:
for (ap_uint<3> a = 0; a < p; a++) {
#pragma HLS LOOP_TRIPCOUNT min=1 max=3
j = lfsr_random() % p;
t = search_order[a];
search_order[a] = search_order[j];
......@@ -390,6 +402,7 @@ bool available(ap_uint<2> avail[MAX_CELLS], ap_uint<CELL_BIT> prev[MAX_CELLS], a
}
SHUFFLE_2:
for (ap_uint<3> a = p; a < 6; a++) {
#pragma HLS LOOP_TRIPCOUNT min=3 max=5
j = lfsr_random() % (6-p) + p;
t = search_order[a];
search_order[a] = search_order[j];
......
......@@ -13,7 +13,7 @@
#include <ap_int.h>
#endif
//#define DEBUG_PRINT // for debug
#define DEBUG_PRINT // for debug
#ifdef DEBUG_PRINT
using namespace std;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment