C の assert マクロは、 範囲情報をアサートするのに使用される場合、 合成でサポートされます。 たとえば、 変数 とループ境界の上限を指定でき ます。
// ap_fixed_test.c
// 2017/02/12 by marsee
#include <assert.h>
#include <ap_fixed.h>
int ap_fixed_test(ap_fixed<16,8, AP_RND, AP_SAT> in0, ap_fixed<16,8, AP_RND, AP_SAT> in1, int limit,
ap_fixed<16,8, AP_RND, AP_SAT> *out){
ap_fixed<16,8, AP_RND, AP_SAT> temp;
/*assert(-1 <= in0 <= 1); assert(-2 <= in1 <= 2); assert(-10 <= temp <= 10); assert(-100 <= *out <= 100); */
temp = in0;
//assert(limit <= 10);
for (int i=0; i<limit; i++)
#pragma HLS LOOP_TRIPCOUNT min=1 max=10 avg=2
temp = temp * (ap_fixed<16,8, AP_RND, AP_SAT>)2.0;
*out = temp * in1;
return(0);
}
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | - | - | - | - |