Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
adc2018-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
adc2018
adc2018-system
Commits
5430e8a2
Commit
5430e8a2
authored
Aug 26, 2018
by
kazushi.kawamura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pragma for Vivado-HLS
parent
05891b65
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
router.cpp
hls_2018/router_01/router.cpp
+10
-0
router.cpp
hls_2018/router_02/router.cpp
+10
-0
No files found.
hls_2018/router_01/router.cpp
View file @
5430e8a2
...
@@ -68,6 +68,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -68,6 +68,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
INIT_WEIGHTS:
INIT_WEIGHTS:
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
#pragma HLS UNROLL factor=2
weights
[
i
]
=
1
;
weights
[
i
]
=
1
;
}
}
...
@@ -151,6 +152,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -151,6 +152,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
// Memories for Overlap Check
// Memories for Overlap Check
ap_uint
<
1
>
overlap_checks
[
MAX_CELLS
];
ap_uint
<
1
>
overlap_checks
[
MAX_CELLS
];
#pragma HLS ARRAY_PARTITION variable=overlap_checks cyclic factor=16 dim=1
bool
has_overlap
=
false
;
bool
has_overlap
=
false
;
// ================================
// ================================
...
@@ -188,6 +190,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -188,6 +190,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
// (Step.2-1) Reset weights of target line
// (Step.2-1) Reset weights of target line
WEIGHT_RESET:
WEIGHT_RESET:
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
target
];
j
!=
s_idx
[
next_target
];
j
++
)
{
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
target
];
j
!=
s_idx
[
next_target
];
j
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=1 max=256
#pragma HLS LOOP_TRIPCOUNT min=1 max=256
weights
[
paths
[
j
]]
=
1
;
weights
[
paths
[
j
]]
=
1
;
}
}
...
@@ -196,11 +199,13 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -196,11 +199,13 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
ap_uint
<
8
>
current_round_weight
=
new_weight
(
round
);
ap_uint
<
8
>
current_round_weight
=
new_weight
(
round
);
WEIGHT_PATH:
WEIGHT_PATH:
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
next_target
];
j
!=
pointer
;
j
++
)
{
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
next_target
];
j
!=
pointer
;
j
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=1 max=8192
#pragma HLS LOOP_TRIPCOUNT min=1 max=8192
weights
[
paths
[
j
]]
=
current_round_weight
;
weights
[
paths
[
j
]]
=
current_round_weight
;
}
}
WEIGHT_TERMINAL:
WEIGHT_TERMINAL:
for
(
ap_uint
<
LINE_BIT
>
i
=
0
;
i
<
(
ap_uint
<
LINE_BIT
>
)(
line_num
);
i
++
)
{
for
(
ap_uint
<
LINE_BIT
>
i
=
0
;
i
<
(
ap_uint
<
LINE_BIT
>
)(
line_num
);
i
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=2 max=999
#pragma HLS LOOP_TRIPCOUNT min=2 max=999
weights
[
starts
[
i
]]
=
MAX_WEIGHT
;
weights
[
starts
[
i
]]
=
MAX_WEIGHT
;
weights
[
goals
[
i
]]
=
MAX_WEIGHT
;
weights
[
goals
[
i
]]
=
MAX_WEIGHT
;
...
@@ -230,16 +235,19 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -230,16 +235,19 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
has_overlap
=
false
;
has_overlap
=
false
;
OVERLAP_RESET:
OVERLAP_RESET:
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
#pragma HLS UNROLL factor=32
overlap_checks
[
i
]
=
0
;
overlap_checks
[
i
]
=
0
;
}
}
OVERLAP_CHECK_LINE:
OVERLAP_CHECK_LINE:
for
(
ap_uint
<
LINE_BIT
>
i
=
0
;
i
<
(
ap_uint
<
LINE_BIT
>
)(
line_num
);
i
++
)
{
for
(
ap_uint
<
LINE_BIT
>
i
=
0
;
i
<
(
ap_uint
<
LINE_BIT
>
)(
line_num
);
i
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=2 max=999
#pragma HLS LOOP_TRIPCOUNT min=2 max=999
overlap_checks
[
starts
[
i
]]
=
1
;
overlap_checks
[
starts
[
i
]]
=
1
;
overlap_checks
[
goals
[
i
]]
=
1
;
overlap_checks
[
goals
[
i
]]
=
1
;
}
}
OVERLAP_CHECK_PATH:
OVERLAP_CHECK_PATH:
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
next_target
];
j
!=
pointer
;
j
++
)
{
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
next_target
];
j
!=
pointer
;
j
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=1 max=8192
#pragma HLS LOOP_TRIPCOUNT min=1 max=8192
ap_uint
<
CELL_BIT
>
cell_id
=
paths
[
j
];
ap_uint
<
CELL_BIT
>
cell_id
=
paths
[
j
];
if
(
overlap_checks
[
cell_id
])
{
if
(
overlap_checks
[
cell_id
])
{
...
@@ -340,10 +348,12 @@ ap_uint<3> abs_uint3(ap_uint<3> a, ap_uint<3> b) {
...
@@ -340,10 +348,12 @@ ap_uint<3> abs_uint3(ap_uint<3> a, ap_uint<3> b) {
ap_uint
<
BUFF_BIT
>
search
(
ap_uint
<
BUFF_BIT
>
idx
,
ap_uint
<
CELL_BIT
>
paths
[
MAX_BUFFER
],
ap_uint
<
CELL_BIT
>
start
,
ap_uint
<
CELL_BIT
>
goal
,
ap_uint
<
8
>
w
[
MAX_CELLS
])
{
ap_uint
<
BUFF_BIT
>
search
(
ap_uint
<
BUFF_BIT
>
idx
,
ap_uint
<
CELL_BIT
>
paths
[
MAX_BUFFER
],
ap_uint
<
CELL_BIT
>
start
,
ap_uint
<
CELL_BIT
>
goal
,
ap_uint
<
8
>
w
[
MAX_CELLS
])
{
ap_uint
<
CELL_BIT
>
dist
[
MAX_CELLS
];
ap_uint
<
CELL_BIT
>
dist
[
MAX_CELLS
];
#pragma HLS ARRAY_PARTITION variable=dist cyclic factor=64 dim=1
ap_uint
<
CELL_BIT
>
prev
[
MAX_CELLS
];
ap_uint
<
CELL_BIT
>
prev
[
MAX_CELLS
];
SEARCH_INIT_DIST
:
SEARCH_INIT_DIST
:
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
#pragma HLS UNROLL factor=128
dist
[
i
]
=
65535
;
// = (2^16 - 1)
dist
[
i
]
=
65535
;
// = (2^16 - 1)
}
}
...
...
hls_2018/router_02/router.cpp
View file @
5430e8a2
...
@@ -68,6 +68,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -68,6 +68,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
INIT_WEIGHTS:
INIT_WEIGHTS:
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
#pragma HLS UNROLL factor=2
weights
[
i
]
=
1
;
weights
[
i
]
=
1
;
}
}
...
@@ -151,6 +152,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -151,6 +152,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
// Memories for Overlap Check
// Memories for Overlap Check
ap_uint
<
1
>
overlap_checks
[
MAX_CELLS
];
ap_uint
<
1
>
overlap_checks
[
MAX_CELLS
];
#pragma HLS ARRAY_PARTITION variable=overlap_checks cyclic factor=16 dim=1
bool
has_overlap
=
false
;
bool
has_overlap
=
false
;
// ================================
// ================================
...
@@ -188,6 +190,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -188,6 +190,7 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
// (Step.2-1) Reset weights of target line
// (Step.2-1) Reset weights of target line
WEIGHT_RESET:
WEIGHT_RESET:
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
target
];
j
!=
s_idx
[
next_target
];
j
++
)
{
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
target
];
j
!=
s_idx
[
next_target
];
j
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=1 max=256
#pragma HLS LOOP_TRIPCOUNT min=1 max=256
weights
[
paths
[
j
]]
=
1
;
weights
[
paths
[
j
]]
=
1
;
}
}
...
@@ -196,11 +199,13 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -196,11 +199,13 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
ap_uint
<
8
>
current_round_weight
=
new_weight
(
round
);
ap_uint
<
8
>
current_round_weight
=
new_weight
(
round
);
WEIGHT_PATH:
WEIGHT_PATH:
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
next_target
];
j
!=
pointer
;
j
++
)
{
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
next_target
];
j
!=
pointer
;
j
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=1 max=8192
#pragma HLS LOOP_TRIPCOUNT min=1 max=8192
weights
[
paths
[
j
]]
=
current_round_weight
;
weights
[
paths
[
j
]]
=
current_round_weight
;
}
}
WEIGHT_TERMINAL:
WEIGHT_TERMINAL:
for
(
ap_uint
<
LINE_BIT
>
i
=
0
;
i
<
(
ap_uint
<
LINE_BIT
>
)(
line_num
);
i
++
)
{
for
(
ap_uint
<
LINE_BIT
>
i
=
0
;
i
<
(
ap_uint
<
LINE_BIT
>
)(
line_num
);
i
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=2 max=999
#pragma HLS LOOP_TRIPCOUNT min=2 max=999
weights
[
starts
[
i
]]
=
MAX_WEIGHT
;
weights
[
starts
[
i
]]
=
MAX_WEIGHT
;
weights
[
goals
[
i
]]
=
MAX_WEIGHT
;
weights
[
goals
[
i
]]
=
MAX_WEIGHT
;
...
@@ -230,16 +235,19 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
...
@@ -230,16 +235,19 @@ bool pynqrouter(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *stat
has_overlap
=
false
;
has_overlap
=
false
;
OVERLAP_RESET:
OVERLAP_RESET:
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
#pragma HLS UNROLL factor=32
overlap_checks
[
i
]
=
0
;
overlap_checks
[
i
]
=
0
;
}
}
OVERLAP_CHECK_LINE:
OVERLAP_CHECK_LINE:
for
(
ap_uint
<
LINE_BIT
>
i
=
0
;
i
<
(
ap_uint
<
LINE_BIT
>
)(
line_num
);
i
++
)
{
for
(
ap_uint
<
LINE_BIT
>
i
=
0
;
i
<
(
ap_uint
<
LINE_BIT
>
)(
line_num
);
i
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=2 max=999
#pragma HLS LOOP_TRIPCOUNT min=2 max=999
overlap_checks
[
starts
[
i
]]
=
1
;
overlap_checks
[
starts
[
i
]]
=
1
;
overlap_checks
[
goals
[
i
]]
=
1
;
overlap_checks
[
goals
[
i
]]
=
1
;
}
}
OVERLAP_CHECK_PATH:
OVERLAP_CHECK_PATH:
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
next_target
];
j
!=
pointer
;
j
++
)
{
for
(
ap_uint
<
BUFF_BIT
>
j
=
s_idx
[
next_target
];
j
!=
pointer
;
j
++
)
{
#pragma HLS UNROLL factor=2
#pragma HLS LOOP_TRIPCOUNT min=1 max=8192
#pragma HLS LOOP_TRIPCOUNT min=1 max=8192
ap_uint
<
CELL_BIT
>
cell_id
=
paths
[
j
];
ap_uint
<
CELL_BIT
>
cell_id
=
paths
[
j
];
if
(
overlap_checks
[
cell_id
])
{
if
(
overlap_checks
[
cell_id
])
{
...
@@ -340,10 +348,12 @@ ap_uint<3> abs_uint3(ap_uint<3> a, ap_uint<3> b) {
...
@@ -340,10 +348,12 @@ ap_uint<3> abs_uint3(ap_uint<3> a, ap_uint<3> b) {
ap_uint
<
BUFF_BIT
>
search
(
ap_uint
<
BUFF_BIT
>
idx
,
ap_uint
<
CELL_BIT
>
paths
[
MAX_BUFFER
],
ap_uint
<
CELL_BIT
>
start
,
ap_uint
<
CELL_BIT
>
goal
,
ap_uint
<
8
>
w
[
MAX_CELLS
])
{
ap_uint
<
BUFF_BIT
>
search
(
ap_uint
<
BUFF_BIT
>
idx
,
ap_uint
<
CELL_BIT
>
paths
[
MAX_BUFFER
],
ap_uint
<
CELL_BIT
>
start
,
ap_uint
<
CELL_BIT
>
goal
,
ap_uint
<
8
>
w
[
MAX_CELLS
])
{
ap_uint
<
CELL_BIT
>
dist
[
MAX_CELLS
];
ap_uint
<
CELL_BIT
>
dist
[
MAX_CELLS
];
#pragma HLS ARRAY_PARTITION variable=dist cyclic factor=64 dim=1
ap_uint
<
CELL_BIT
>
prev
[
MAX_CELLS
];
ap_uint
<
CELL_BIT
>
prev
[
MAX_CELLS
];
SEARCH_INIT_DIST
:
SEARCH_INIT_DIST
:
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
for
(
ap_uint
<
CELL_BIT
>
i
=
0
;
i
<
(
ap_uint
<
CELL_BIT
>
)(
MAX_CELLS
);
i
++
)
{
#pragma HLS UNROLL factor=128
dist
[
i
]
=
65535
;
// = (2^16 - 1)
dist
[
i
]
=
65535
;
// = (2^16 - 1)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment