Commit 99f85c83 authored by kazushi.kawamura's avatar kazushi.kawamura

Fix bugs in router and upload a bitstream file

parent 04d34b77
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
int main(void){ int main(void){
char q[STRLEN], command[STRLEN]; char q[STRLEN], command[STRLEN];
char dir[64] = "../lines128_length256"; char dir[64] = "../lines256_length128";
FILE *fp; FILE *fp;
fp = fopen("q.txt", "r"); fp = fopen("q.txt", "r");
......
...@@ -23,3 +23,7 @@ X72Y72Z8L0000171023L0000271022L0000371021L0001171013L0001371011L0002171003L00022 ...@@ -23,3 +23,7 @@ X72Y72Z8L0000171023L0000271022L0000371021L0001171013L0001371011L0002171003L00022
X03Y03Z3L0000102002L0101101002L0200101012L0001101023L0001201013L0102102013 X03Y03Z3L0000102002L0101101002L0200101012L0001101023L0001201013L0102102013
X72Y72Z1L0100161061L2300164131L5500142501L0062106031L1771171341L2271166661L5967146631L2565161681L2665167661L2467159701L2369169691L5668157661L5569157671L0200159181L0116125331L4701170011L0209139261L6117103351L1628148341L0428103091L2400150061L1860119691L0114152461L2107156021L2158170361L0117112321L1213168041L0342114681L1643151591L5544161161L1115134161L1116134151L4342124521L0238146371L1449120631L0259113681L2243138471L0642146381L0404151031L5616159471L1216135161L1137126331L3911141261L0214159331L0269111321L6315168051L1741155561L0540109331L2322134211L4353129461L0713160351L1362118691L2244127471L0934108431L1120126191L1410140261L1957168571L5808146391L6653169311L0765166521L2719129191L3044125471L0425133311L1352110631L0405163111L0858110571L2645143541L5809165141L0515132261L2649141431L1252109611L0604141061L1955143411L1704153121L1448119541L2405145181L2447142511L1058113461L4605146211L1639122391L4613151111L4710146221L4414144181L0516105251L6822168331 X72Y72Z1L0100161061L2300164131L5500142501L0062106031L1771171341L2271166661L5967146631L2565161681L2665167661L2467159701L2369169691L5668157661L5569157671L0200159181L0116125331L4701170011L0209139261L6117103351L1628148341L0428103091L2400150061L1860119691L0114152461L2107156021L2158170361L0117112321L1213168041L0342114681L1643151591L5544161161L1115134161L1116134151L4342124521L0238146371L1449120631L0259113681L2243138471L0642146381L0404151031L5616159471L1216135161L1137126331L3911141261L0214159331L0269111321L6315168051L1741155561L0540109331L2322134211L4353129461L0713160351L1362118691L2244127471L0934108431L1120126191L1410140261L1957168571L5808146391L6653169311L0765166521L2719129191L3044125471L0425133311L1352110631L0405163111L0858110571L2645143541L5809165141L0515132261L2649141431L1252109611L0604141061L1955143411L1704153121L1448119541L2405145181L2447142511L1058113461L4605146211L1639122391L4613151111L4710146221L4414144181L0516105251L6822168331
X40Y40Z3L0000139001L0001139011L0002139021L0003139031L0004139041L0005139051L0006139061L0007139071L0008139081L0009139091L0010139101L0011139111L0012139121L0013139131L0014139141L0015139151L0016139161L0017139171L0018139181L0019139191L0020139201L0021139211L0022139221L0023139231L0024139241L0025139251L0026139261L0027139271L0028139281L0029139291L0030139301L0031139311L0032139321L0033139331L0034139341L0035139351L0036139361L0037139371L0038139381L0039139391L0100101391L0500105391L0900109391L1300113391L1700117391L2100121391L2500125391L2900129391L3300133391L3700137391L0100201392L0300203392L0500205392L0700207392L0900209392L1100211392L1300213392L1500215392L1700217392L1900219392L2100221392L2300223392L2500225392L2700227392L2900229392L3100231392L3300233392L3500235392L3700237392L3900239392L0300303393L0700307393L1100311393L1500315393L1900319393L2300323393L2700327393L3100331393L3500335393L3900339393 X40Y40Z3L0000139001L0001139011L0002139021L0003139031L0004139041L0005139051L0006139061L0007139071L0008139081L0009139091L0010139101L0011139111L0012139121L0013139131L0014139141L0015139151L0016139161L0017139171L0018139181L0019139191L0020139201L0021139211L0022139221L0023139231L0024139241L0025139251L0026139261L0027139271L0028139281L0029139291L0030139301L0031139311L0032139321L0033139331L0034139341L0035139351L0036139361L0037139371L0038139381L0039139391L0100101391L0500105391L0900109391L1300113391L1700117391L2100121391L2500125391L2900129391L3300133391L3700137391L0100201392L0300203392L0500205392L0700207392L0900209392L1100211392L1300213392L1500215392L1700217392L1900219392L2100221392L2300223392L2500225392L2700227392L2900229392L3100231392L3300233392L3500235392L3700237392L3900239392L0300303393L0700307393L1100311393L1500315393L1900319393L2300323393L2700327393L3100331393L3500335393L3900339393
X30Y30Z3L1212111103L1811311041L0412101102L0410218072L2612328231L2411128111L0503313081L1810314062L2301315031L2415326192L2224229251L0323201211L2911229192L1801317002L1128115162L1629211293L2026212291L1701317033L1714120233L2105121031L1014309152L0716104051L2221128271L1205311042L0420308243L0718204271L1221311252L0223201273L0502209071L1314109142L0317204222L2312319131L2026119241L0302116022L1611118011L1224110263L2229116171L1319220271L1710114091L0607203032L0513203131L0109100161L1424315231L1727113241L1416111182L1213213112L2510316102L2521228222L0321306273L2305228003L1501310013L1918120182L2226222241L2313220152L0117203201L2700318033L2103228022L1806215073L2813329182L0318202172L0903109022L2629228193L2610123121L1528320243L1607115061L0124103231L0216103141L2506223051L0624307253L0902110011L1128201291L2907228011L0109202103L2923329263L1016309153L1912320142L1807118051L1216211143L2504124051L1714217113L1828312293L0200100032L0705208072L1321312173L2007120031L0001201002L1312315123L0819107181L0927210281L2410225071L2726121282L1705316033L2609328093L2503321011L0018101201L2328222261L0301306011L2617225202L1112115142L0712108111L0624109221L0606104101L2728228272L0607304073L0514206161L0800306003L1006107042L2013321143L0827310273L1206111051L2715128141L2608122081L0116301183L0313302102L0715209131L2120223212L1627217243L2324322203L0423303241L0818209193L1624315241L2512327101L1912117111L2003323033L2416325132L0504106051L1404314022L1618317143L1318213191L2811326112L2516325142L1619315203L1606118081L2102222013L2806223021L2622324223L0805112041L0923309252L2307324053L2625225232L2023122212L0521105191L0717307153L1920118181L1226312283L2116122141L0727104261L0615105141L2427325263L0204100062L0225200253L1713115131L1928320273L0308203052L1822214232L0811310123L2428123271L2522127231L1109310073L0405207053L0215201142L2815127152L2905128041L2217322152L1216113171L0105202022L2317320172L1810114093L2707128081L0528306263L2418124161L2802329032L0411207122L0619305163L0208201103L1725217272L1108112092L0702208013L2106122063L2921129231L2118123181L2619324193L2908229102L0819307192L0022101231L1315115151L0729209282L0125201272L2708227093L0922308233L1320212222L0424305242L2606328063L1413214123L1819316203L0317104181L1719315201L1315314162L1212312133L2609224092L1212211132L2717327172L1428117281L2010220093L1316213152L0507106081L0113101121L1428314293L1117211162L0812108131
X40Y40Z4L0000139394L3900100394L0039139004L3939100004L3800100384L3700100374L3600100364L3500100354L3400100344L3300100334L3200100324L3100100314L3000100304L2900100294L2800100284L2700100274L2600100264L2500100254L2401100244L2301100234L2201100224L2101100214L2001100204L0601119011L3938101004L3937102004L3936103004L3935104014L3934105014L3933106014L3932107014L3931108014L3930109014L3929110014L3928111014L3927112014L3926113014L3925114014L3924115014L3923116014L3922117014L0121119391L0222118381L0323117371L0424116361L0525115351L0626114341L0727113331L0828112321L0929109311L3722121381L3623122371L3524123361L3425124351L3326125341L3227126331L3128127321L2829130291L1030111311L2930128311L1801422014L0220420384L0321419374L0422418364L0523417354L0624416344L0725415334L0826414324L0927413314L1028412284L1129412304L3823422394L3724423384L3625424374L3526425364L3427426354L3328427344L3229428334L3130431324L3031429324L0020219392L0121218382L0222217372L0323216362L0424215352L0525214342L0626213332L0727212322L0828211312L0929210302L3922222392L3823223382L3724224372L3625225362L3526226352L3427227342L3328228332L3229229322L3130230312L0000220283L0100220273L0200220263L0300220253L0401220243L0500220233L0600220223L0700220213L0800220203L0900220193L1000220183L3900211293L3800221283L3700221273L3600221263L3500221253L3400221243L3300221233L3200221223L3100221213L3000221203L0019221023L0119220033L0220220043L0321220053L0422220063L0523220073L0624220083L0725220093L0826220103L0927220113L2100223002L2500229002L3128221113L3227221103L3326221093L3425221083L3524221073L3623221063L3722221053L3821221043L3921221033L2019220382L1920219372L1821218362L1722217352L1623216342L1524215332L1425214322L1326213312L1227212302L1128211292L2121221382L2222222372L2323223362L2424224352L2525225342L2626226332L2727227322L2828228312L2929229302L1912319393L2012322393L0000339003L0001302013L0601339013L2702339023L0119338213L0220337223L0321336233L0422335243L0523334253L1918306243L1819307253L1720308263L1621309273L1522310273L1423311263L1324312253L2118333263L2119332273L2220331283L2321330283L2422329273L2523328263L2624327253L1230320383L1331319373L1432318363L1533317333L1634317353L2930321383L2831322373L2732323363L2433326333L2534324353L0121318383L0222317373L0323316363L0424315353L0525314343L0626313333L0727312323L0828311313L0929310303L3823323383L3724324373L3625325363L3526326353L3427327343L3328328333L3229329323L3130330313
X72Y72Z1L0000108151L0004171321L0013171421L0016171431L0030100631L0046170601L7164100711L7165128711L1001170321L0500105031L0501107011L0502107021L0001100031L0002102021L0705107071L0506107061L0005106161L0105101111L0106105101L0117171541L0015170341L0014165331L0518165321L0017123261L0024133411L3330169531L2228100291L0025121281L0825108271L2312169321L2412168321L2512167321L0226108261L7065131701L7066135701L7067139701L4669169691L4968143701L2605166051L2705165051L2706165061L3706149061L2707150171L2708150161L2808151161L2809161131L6009162101L5309152141L5210152131L2810132101L5512153131L5610154111L5710157131L5810158131L0664144641L0764101691L4064102661L3664103681L1564103671L3264104671L2565122661L2864109661L0965120651L1664120641L1204162311L0031169571L3131124591L0045169581L1632100441L1521140211L6421164321L1905161231L1805137231L3020130221L3021136211L2247106591L1458170611L0062170621L1457121611L1749119501L1859120591L2149120601L1205117051L1605113171L1606114161L1417116191L1607115161L1507115151L2216145201L4420146201L4118143181L4117141191L3531168511L4034143341L4434134391L3933135391L3532138381L3632138371L3634136371L3734137371L3930155361L4035164521L4330155341L4831154311L5332154331L4036162521L4840160521L4941159511L5042158501L5143157491L5244156481L5345154461L5347155471L4137147391L4037145391L5738169491L6847169481L6039169461L5938167441L6239166431L6340164411L6540165421L0234104351L0342105441L0434125571L0433126571L1534107431L0836108431L0741109421L0943125431L1035125421L1036111381L1337114391L1040110421L1041113411L1831143561L1839142451L4145129551L1838140541L2932118371L2832118361L2833119361L1933127331L2033126331L2034126341L1456100611L1447100601L1354101591L1347100591L1247100521L1248101521L1148101511L0249102511L0250110501L4045132471L3845139471L4046139521L3645140511L3646134491L3547135491
X40Y40Z2L0000139001L0100138001L0200137001L0300136001L0400135001L0500134001L0600133001L0700132001L0800131001L0900130001L1000129001L1100128001L1200127001L1300126001L1400125001L1500124001L1600123001L1700122001L1800121001L1900120001L0001100381L0002100371L0003100361L0004100351L0005100341L0006100331L0007100321L0008100311L0009100301L0010100291L0011100281L0012100271L0013100261L0014100251L0015100241L0016100231L0017100221L0018100211L0019100201L0039139391L0139138391L0239137391L0339136391L0439135391L0539134391L0639133391L0739132391L0839131391L0939130391L1039129391L1139128391L1239127391L1339126391L1439125391L1539124391L1639123391L1739122391L1839121391L1939120391L3901139381L3902139371L3903139361L3904139351L3905139341L3906139331L3907139321L3908139311L3909139301L3910139291L3911139281L3912139271L3913139261L3914139251L3915139241L3916139231L3917139221L3918139211L3919139201L1010129101L1110128101L1210127101L1310126101L1410125101L1510124101L1610123101L1710122101L1810121101L1910120101L1011110281L1012110271L1013110261L1014110251L1015110241L1016110231L1017110221L1018110211L1019110201L1029129291L1129128291L1229127291L1329126291L1429125291L1529124291L1629123291L1729122291L1829121291L1929120291L2911129281L2912129271L2913129261L2914129251L2915129241L2916129231L2917129221L2918129211L2919129201L1515124151L1615123151L1715122151L1815121151L1915120151L1516115231L1517115221L1518115211L1519115201L1524124241L1624123241L1724122241L1824121241L1924120241L2416124231L2417124221L2418124211L2419124201L1718122181L1818121181L1918120181L1719117201L1721122211L1821121211L1921120211L2219122201L0910209292L3010230292L1415214242L2515225242L1717222172L1719222192L1720222202L1722222222
This diff is collapsed.
TARGET = sim
OBJS = $(CPPS:.cpp=.o)
CPPS = $(wildcard *.cpp)
CXX = g++
CXXFLAGS = -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label -DSOFTWARE -DCALCTIME
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) -O3 -Wl,--stack,16777216 -o $@ $(OBJS)
clean:
rm *.o
rm $(TARGET)
This diff is collapsed.
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "router.hpp" #include "router.hpp"
#define PRINT_SOLUTION
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
using namespace std; using namespace std;
...@@ -50,9 +51,11 @@ int main(int argc, char *argv[]) { ...@@ -50,9 +51,11 @@ int main(int argc, char *argv[]) {
seed = atoi(argv[2]); seed = atoi(argv[2]);
} }
#ifdef PRINT_SOLUTION
int size_x = (boardstr[1] - '0') * 10 + (boardstr[2] - '0'); int size_x = (boardstr[1] - '0') * 10 + (boardstr[2] - '0');
int size_y = (boardstr[4] - '0') * 10 + (boardstr[5] - '0'); int size_y = (boardstr[4] - '0') * 10 + (boardstr[5] - '0');
int size_z = (boardstr[7] - '0'); int size_z = (boardstr[7] - '0');
#endif
// ソルバ実行 // ソルバ実行
ap_int<32> status; ap_int<32> status;
...@@ -68,6 +71,7 @@ int main(int argc, char *argv[]) { ...@@ -68,6 +71,7 @@ int main(int argc, char *argv[]) {
cout << "status = " << (int)status << endl; cout << "status = " << (int)status << endl;
cout << "elapsed = " << ((double)(clock_done - clock_start) / CLOCKS_PER_SEC) << endl << endl; cout << "elapsed = " << ((double)(clock_done - clock_start) / CLOCKS_PER_SEC) << endl << endl;
#ifdef PRINT_SOLUTION
// 解表示 // 解表示
cout << "SOLUTION" << endl; cout << "SOLUTION" << endl;
cout << "========" << endl; cout << "========" << endl;
...@@ -80,12 +84,13 @@ int main(int argc, char *argv[]) { ...@@ -80,12 +84,13 @@ int main(int argc, char *argv[]) {
cout << ","; cout << ",";
} }
int i = ((x * MAX_WIDTH + y) << BITWIDTH_Z) | z; int i = ((x * MAX_WIDTH + y) << BITWIDTH_Z) | z;
//cout << setfill('0') << setw(2) << right << (unsigned int)(unsigned char)(boardstr[i]); cout << setfill('0') << setw(3) << right << (unsigned int)(unsigned char)(boardstr[i]);
cout << (unsigned int)(unsigned char)(boardstr[i]); //cout << (unsigned int)(unsigned char)(boardstr[i]);
} }
cout << endl; cout << endl;
} }
} }
#endif
return 0; return 0;
} }
...@@ -210,7 +210,6 @@ bool pynqrouter_256x128(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<3 ...@@ -210,7 +210,6 @@ bool pynqrouter_256x128(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<3
FIRST_ROUTING: FIRST_ROUTING:
for (ap_uint<9> i = 0; i < (ap_uint<9>)(line_num); i++) { for (ap_uint<9> i = 0; i < (ap_uint<9>)(line_num); i++) {
#pragma HLS LOOP_TRIPCOUNT min=2 max=255 avg=50 #pragma HLS LOOP_TRIPCOUNT min=2 max=255 avg=50
//#pragma HLS LOOP_TRIPCOUNT min=2 max=127 avg=50
//#pragma HLS PIPELINE //#pragma HLS PIPELINE
//#pragma HLS UNROLL factor=2 //#pragma HLS UNROLL factor=2
...@@ -245,6 +244,7 @@ bool pynqrouter_256x128(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<3 ...@@ -245,6 +244,7 @@ bool pynqrouter_256x128(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<3
ap_uint<8> last_target = 255; ap_uint<8> last_target = 255;
// [Step 2] Rip-up 再ルーティング // [Step 2] Rip-up 再ルーティング
cout << "Rip-up Routing" << endl;
ROUTING: ROUTING:
for (ap_uint<16> round = 1; round <= 32768 /* = (2048 * 16) */; round++) { for (ap_uint<16> round = 1; round <= 32768 /* = (2048 * 16) */; round++) {
#pragma HLS LOOP_TRIPCOUNT min=1 max=4000 avg=50 #pragma HLS LOOP_TRIPCOUNT min=1 max=4000 avg=50
...@@ -285,8 +285,6 @@ bool pynqrouter_256x128(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<3 ...@@ -285,8 +285,6 @@ bool pynqrouter_256x128(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<3
#pragma HLS LOOP_TRIPCOUNT min=1 max=255 avg=50 #pragma HLS LOOP_TRIPCOUNT min=1 max=255 avg=50
weights[paths[target][j]] = 1; weights[paths[target][j]] = 1;
} }
// 対象ラインのスタートの重みも一旦リセット あとで (*) で戻す
weights[starts[target]] = 1;
// (2) 重みを更新 // (2) 重みを更新
ap_uint<8> current_round_weight = new_weight(round); ap_uint<8> current_round_weight = new_weight(round);
...@@ -304,10 +302,18 @@ bool pynqrouter_256x128(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<3 ...@@ -304,10 +302,18 @@ bool pynqrouter_256x128(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<3
} }
} }
} }
WEIGHT_TERMINAL:
for (ap_uint<9> i = 0; i < (ap_uint<9>)(line_num); i++) {
#pragma HLS LOOP_TRIPCOUNT min=2 max=255 avg=50
weights[starts[i]] = MAX_WEIGHT;
weights[goals[i]] = MAX_WEIGHT;
}
// 対象ラインのスタートの重みも一旦リセット あとで (*) で戻す
weights[starts[target]] = 1;
// 経路探索 // 経路探索
#ifdef DEBUG_PRINT #ifdef DEBUG_PRINT
cout << "LINE #" << (int)(target + 1) << endl; cout << "(round: " << round << ")" << "LINE #" << (int)(target + 1) << endl;
#endif #endif
search(&(paths_size[target]), paths[target], starts[target], goals[target], weights); search(&(paths_size[target]), paths[target], starts[target], goals[target], weights);
...@@ -612,18 +618,18 @@ void search(ap_uint<8> *path_size, ap_uint<16> path[MAX_PATH], ap_uint<16> start ...@@ -612,18 +618,18 @@ void search(ap_uint<8> *path_size, ap_uint<16> path[MAX_PATH], ap_uint<16> start
ap_uint<16> t = prev[goal]; ap_uint<16> t = prev[goal];
#ifdef DEBUG_PRINT #ifdef DEBUG_PRINT
int dbg_start_xy = start >> BITWIDTH_Z; //int dbg_start_xy = start >> BITWIDTH_Z;
int dbg_start_x = dbg_start_xy / MAX_WIDTH; //int dbg_start_x = dbg_start_xy / MAX_WIDTH;
int dbg_start_y = dbg_start_xy % MAX_WIDTH; //int dbg_start_y = dbg_start_xy % MAX_WIDTH;
int dbg_start_z = start & BITMASK_Z; //int dbg_start_z = start & BITMASK_Z;
int dbg_goal_xy = goal >> BITWIDTH_Z; //int dbg_goal_xy = goal >> BITWIDTH_Z;
int dbg_goal_x = dbg_goal_xy / MAX_WIDTH; //int dbg_goal_x = dbg_goal_xy / MAX_WIDTH;
int dbg_goal_y = dbg_goal_xy % MAX_WIDTH; //int dbg_goal_y = dbg_goal_xy % MAX_WIDTH;
int dbg_goal_z = goal & BITMASK_Z; //int dbg_goal_z = goal & BITMASK_Z;
cout << "(" << dbg_start_x << ", " << dbg_start_y << ", " << dbg_start_z << ") #" << start << " -> " //cout << "(" << dbg_start_x << ", " << dbg_start_y << ", " << dbg_start_z << ") #" << start << " -> "
<< "(" << dbg_goal_x << ", " << dbg_goal_y << ", " << dbg_goal_z << ") #" << goal << endl; // << "(" << dbg_goal_x << ", " << dbg_goal_y << ", " << dbg_goal_z << ") #" << goal << endl;
#endif #endif
// バックトラック // バックトラック
...@@ -634,11 +640,11 @@ void search(ap_uint<8> *path_size, ap_uint<16> path[MAX_PATH], ap_uint<16> start ...@@ -634,11 +640,11 @@ void search(ap_uint<8> *path_size, ap_uint<16> path[MAX_PATH], ap_uint<16> start
#pragma HLS PIPELINE II=2 #pragma HLS PIPELINE II=2
#ifdef DEBUG_PRINT #ifdef DEBUG_PRINT
int t_xy = prev[t] >> BITWIDTH_Z; //int t_xy = prev[t] >> BITWIDTH_Z;
int t_x = t_xy / MAX_WIDTH; //int t_x = t_xy / MAX_WIDTH;
int t_y = t_xy % MAX_WIDTH; //int t_y = t_xy % MAX_WIDTH;
int t_z = prev[t] & BITMASK_Z; //int t_z = prev[t] & BITMASK_Z;
cout << " via " << "(" << t_x << ", " << t_y << ", " << t_z << ") #" << prev[t] << " dist=" << dist[t] << endl; //cout << " via " << "(" << t_x << ", " << t_y << ", " << t_z << ") #" << prev[t] << " dist=" << dist[t] << endl;
#endif #endif
path[p] = t; // 記録 path[p] = t; // 記録
...@@ -649,8 +655,8 @@ void search(ap_uint<8> *path_size, ap_uint<16> path[MAX_PATH], ap_uint<16> start ...@@ -649,8 +655,8 @@ void search(ap_uint<8> *path_size, ap_uint<16> path[MAX_PATH], ap_uint<16> start
*path_size = p; *path_size = p;
#ifdef DEBUG_PRINT #ifdef DEBUG_PRINT
cout << "max_path_len = " << p << endl; //cout << "max_path_len = " << p << endl;
cout << "max_pq_len = " << max_pq_len << endl; //cout << "max_pq_len = " << max_pq_len << endl;
#endif #endif
} }
...@@ -676,6 +682,7 @@ void pq_push(ap_uint<16> priority, ap_uint<16> data, ap_uint<13> *pq_len, ap_uin ...@@ -676,6 +682,7 @@ void pq_push(ap_uint<16> priority, ap_uint<16> data, ap_uint<13> *pq_len, ap_uin
#pragma HLS INLINE #pragma HLS INLINE
(*pq_len)++; (*pq_len)++;
if ((*pq_len) == 0) { (*pq_len)--; } // Queue is full -> Last element is automatically removed
ap_uint<13> i = (*pq_len); // target ap_uint<13> i = (*pq_len); // target
ap_uint<13> p = (*pq_len) >> 1; // i.e., (*pq_len) / 2; // 親 ap_uint<13> p = (*pq_len) >> 1; // i.e., (*pq_len) / 2; // 親
PQ_PUSH_LOOP: PQ_PUSH_LOOP:
...@@ -708,7 +715,7 @@ void pq_pop(ap_uint<16> *ret_priority, ap_uint<16> *ret_data, ap_uint<13> *pq_le ...@@ -708,7 +715,7 @@ void pq_pop(ap_uint<16> *ret_priority, ap_uint<16> *ret_data, ap_uint<13> *pq_le
ap_uint<16> last_priority = (ap_uint<16>)(pq_nodes[*pq_len] & PQ_PRIORITY_MASK); // 末尾ノードの優先度 ap_uint<16> last_priority = (ap_uint<16>)(pq_nodes[*pq_len] & PQ_PRIORITY_MASK); // 末尾ノードの優先度
PQ_POP_LOOP: PQ_POP_LOOP:
while (1) { while (!(i >> 11)) { // (2018.08.25) Loop condition fixed
#pragma HLS LOOP_TRIPCOUNT min=1 max=8 avg=4 #pragma HLS LOOP_TRIPCOUNT min=1 max=8 avg=4
//#pragma HLS PIPELINE //#pragma HLS PIPELINE
//#pragma HLS UNROLL factor=2 //#pragma HLS UNROLL factor=2
......
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