mirror of
https://github.com/Steffo99/unimore-hpc-assignments.git
synced 2024-11-21 23:54:25 +00:00
Add HLS PIPELINE
and UNROLL
instructions
Co-authored-by: Fabio Zanichelli <274956@studenti.unimore.it> Co-authored-by: Stefano Pigozzi <256895@studenti.unimore.it>
This commit is contained in:
parent
8692e82290
commit
ae5f2d0c52
1 changed files with 7 additions and 1 deletions
|
@ -17,6 +17,8 @@ void sobel(uint8_t *__restrict__ out, uint8_t *__restrict__ in, const int width,
|
|||
esternoY:
|
||||
for (int y = 0; y < height - 2; y++)
|
||||
{
|
||||
#pragma HLS PIPELINE
|
||||
|
||||
esternoX:
|
||||
for (int x = 0; x < width - 2; x++)
|
||||
{
|
||||
|
@ -26,11 +28,15 @@ void sobel(uint8_t *__restrict__ out, uint8_t *__restrict__ in, const int width,
|
|||
internoY:
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
#pragma HLS UNROLL
|
||||
|
||||
const int inYOffset = (y + k) * width;
|
||||
|
||||
internoX:
|
||||
for (int z = 0; z < 3; z++)
|
||||
{
|
||||
#pragma HLS UNROLL
|
||||
|
||||
const int inXOffset = x + z;
|
||||
|
||||
const int inOffset = inYOffset + inXOffset;
|
||||
|
@ -44,7 +50,7 @@ void sobel(uint8_t *__restrict__ out, uint8_t *__restrict__ in, const int width,
|
|||
const int outYOffset = (y + 1) * width;
|
||||
const int outXOffset = (x + 1);
|
||||
const int outOffset = outYOffset + outXOffset;
|
||||
|
||||
|
||||
out[outOffset] = sqrt((float)((dx * dx) + (dy * dy)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue