PandA-2024.02
ap_example.cpp
Go to the documentation of this file.
1 #include "ap_int.h"
2 #include <algorithm>
3 #define SIMULATION 1
4 #pragma HLS interface port = x_fifo mode = fifo
5 #pragma HLS interface port = y_fifo mode = fifo
6 #pragma HLS interface port = res mode = fifo
7 void gcd(ap_int<11>* x_fifo, ap_int<11>* y_fifo, ap_int<11>* res)
8 {
9  do
10  {
11  ap_int<11> x = *x_fifo, y = *y_fifo;
12  if(x < y)
13  std::swap(x, y);
14 
15  while(y > 0)
16  {
17  int f = x % y;
18  x = y;
19  y = f;
20  }
21  *res = x;
22  } while(!SIMULATION);
23 }
#define SIMULATION
Definition: ap_example.cpp:3
void gcd(ap_int< 11 > *x_fifo, ap_int< 11 > *y_fifo, ap_int< 11 > *res)
Definition: ap_example.cpp:7
x
Return the smallest n such that 2^n >= _x.

Generated on Mon Feb 12 2024 13:02:47 for PandA-2024.02 by doxygen 1.8.13