// ap_fixed_test.h
// 2017/11/03 by marsee
//
#ifndef __ap_fixed_test_H__
#define __ap_fixed_test_H__
typedef ap_fixed<4, 3, AP_TRN_ZERO, AP_SAT> ap_fixed_def;
// for simulation test
// ap_fixed<4, 3, AP_TRN_ZERO, AP_SAT>
// ap_fixed<4, 3, AP_TRN_ZERO, AP_WRAP>
// ap_fixed<4, 3, AP_RND, AP_SAT>
// ap_fixed<4, 3, AP_TRN, AP_SAT>
// for synthesis test
// ap_fixed<4, 3, AP_TRN_ZERO, AP_SAT>
// ap_fixed<4, 3, AP_TRN_ZERO, AP_WRAP>
#endif
// ap_fixed_test.cpp
// 2017/11/03 by marsee
//
#include <ap_fixed.h>
#include "ap_fixed_test.h"
int ap_fixed_test(ap_fixed_def in0, ap_fixed_def in1,ap_fixed_def &out){out = in0 * in1;return(0);
}
// ap_fixed_test_tb.cpp
// 2017/11/03 by marsee
//
#include <stdio.h>
#include <ap_fixed.h>
#include "ap_fixed_test.h"
int ap_fixed_test(ap_fixed_def in0, ap_fixed_def in1,ap_fixed_def &out);
int main(){ap_fixed_def out;ap_fixed_test(1.5, 1.5, out);printf("1.5 x 1.5 = %f\n", (float)out);ap_fixed_test(-1.5, 1.5, out);printf("-1.5 x 1.5 = %f\n", (float)out);ap_fixed_test(2, 2, out);printf("2 x 2 = %f\n", (float)out);ap_fixed_test(-2, 2, out);printf("-2 x 2 = %f\n", (float)out);ap_fixed_test(3, 3, out);printf("3 x 3 = %f\n", (float)out);ap_fixed_test(-3, 3, out);printf("-3 x 3 = %f\n", (float)out);return(0);
}
1.5 x 1.5 = 2.000000
-1.5 x 1.5 = -2.000000
2 x 2 = 3.500000
-2 x 2 = -4.000000
3 x 3 = 3.500000
-3 x 3 = -4.000000
1.5 x 1.5 = 2.000000
-1.5 x 1.5 = -2.000000
2 x 2 = -4.000000
-2 x 2 = -4.000000
3 x 3 = 1.000000
-3 x 3 = -1.000000
1.5 x 1.5 = 2.500000
-1.5 x 1.5 = -2.000000
2 x 2 = 3.500000
-2 x 2 = -4.000000
3 x 3 = 3.500000
-3 x 3 = -4.000000
1.5 x 1.5 = 2.000000
-1.5 x 1.5 = -2.500000
2 x 2 = 3.500000
-2 x 2 = -4.000000
3 x 3 = 3.500000
-3 x 3 = -4.000000
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | - | - | 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 | 29 | 30 |
31 | - | - | - | - | - | - |