From 895c68cb01f3b0c5123e0f72d282e49aac0c9554 Mon Sep 17 00:00:00 2001 From: uingrd Date: Thu, 10 Feb 2022 18:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90C=E4=BB=A3=E7=A0=81=E7=9A=84=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=BF=AE=E6=94=B9=E4=BB=A5=E6=BB=A1=E8=B6=B3?= =?UTF-8?q?=E5=9C=A8MacOS=E4=B8=8B=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +++++ FXP/fxp_filter.c | 18 +++++++++++++++--- FXP/fxp_filter.py | 15 +++++++++++---- FXP/fxp_filter_data.c | 14 +++++++------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index e17ef8d..4c1640e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,8 @@ CONV/export_code/test_conv_1d CONV/export_code/test_fir GNB/export_code/test CSD/export_code/test +FXP/test +FXP/y_int.bin +*.pyc +FXP/fxp_filter_data.c +FXP/fxp_filter_data.c diff --git a/FXP/fxp_filter.c b/FXP/fxp_filter.c index 34849f3..6fed45d 100644 --- a/FXP/fxp_filter.c +++ b/FXP/fxp_filter.c @@ -1,6 +1,10 @@ #include -#include #include +#include + +#ifndef CLANG_MACOS + #include +#endif extern const int NUM_TAPS; // 滤波器抽头数目 extern const int Y_SHIFT; // 输出数据格式转换移位量 @@ -27,12 +31,18 @@ int8_t fir(int8_t x) return (int8_t)sum; } -void main() +int main() { FILE* fp; int8_t y; - buf=(int8_t*)calloc(NUM_TAPS,1); +# ifdef CLANG_MACOS + fp = fopen("y_int.bin", "wb"); +#else fopen_s(&fp, "y_int.bin", "wb"); +#endif + + buf=(int8_t*)calloc(NUM_TAPS,1); + for (int n=0; n