From 1b101f120304f3703c8c7bf78cc6cef91f26ed3a Mon Sep 17 00:00:00 2001 From: unknown <2779155576@qq.com> Date: Tue, 26 Nov 2024 20:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E4=B8=80=E4=BA=9Breg=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=BD=AC=E4=B8=BAwire=E7=B1=BB=E5=9E=8B=EF=BC=9B.m?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=BF=9B=E8=A1=8C=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=AF=BB=E6=89=BE=E8=AF=AF=E5=B7=AE?= =?UTF-8?q?=E5=92=8C=E5=9D=87=E6=96=B9=E8=AF=AF=E5=B7=AE=E5=9D=87=E5=B0=8F?= =?UTF-8?q?=E4=BA=8E=E4=B8=87=E5=88=86=E4=B9=8B=E4=B8=80=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtl/z_dsp/IIR_Filter.v | 2 +- rtl/z_dsp/mult_C.v | 4 ++-- script_m/diff_plot_py.m | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rtl/z_dsp/IIR_Filter.v b/rtl/z_dsp/IIR_Filter.v index f0ce94f..a8e5a4c 100644 --- a/rtl/z_dsp/IIR_Filter.v +++ b/rtl/z_dsp/IIR_Filter.v @@ -172,7 +172,7 @@ inst_c4 ( assign y_re = v1_re + y2_re; assign y_im = v1_im + y2_im; -reg signed [data_in_width+frac_data_out_width+1:0] dout_round; +wire signed [data_in_width+frac_data_out_width+1:0] dout_round; FixRound #(data_in_width+frac_data_out_width+2,frac_data_out_width) u_round1 (clk, rstn, en, y_re, dout_round); diff --git a/rtl/z_dsp/mult_C.v b/rtl/z_dsp/mult_C.v index ecafc58..ce8599b 100644 --- a/rtl/z_dsp/mult_C.v +++ b/rtl/z_dsp/mult_C.v @@ -98,8 +98,8 @@ wire signed [A_width+D_width:0] Im_tmp; assign Re_tmp = ac - bd; assign Im_tmp = ad + bc; -reg signed [A_width+C_width:0] Re_round; -reg signed [A_width+D_width:0] Im_round; +wire signed [A_width+C_width:0] Re_round; +wire signed [A_width+D_width:0] Im_round; FixRound #(A_width+C_width+1,frac_coef_width) u_round1 (clk, rstn, en, Re_tmp, Re_round); FixRound #(A_width+C_width+1,frac_coef_width) u_round2 (clk, rstn, en, Im_tmp, Im_round); diff --git a/script_m/diff_plot_py.m b/script_m/diff_plot_py.m index 5d3c2a1..21c5eed 100644 --- a/script_m/diff_plot_py.m +++ b/script_m/diff_plot_py.m @@ -18,12 +18,12 @@ n1000_1100 = find((n>=edge+1000e-9-1e-12) & (n<=edge+1100e-9+1e-12));%下降沿 ne = find((abs(diff)>=1e-4) & (abs(diff)<1));%误差小于万分之一的点 ne(1) = 1; -% window_length = 100e-9*fs; -% diff_mean_window = movmean(diff,window_length); -% diff_std_window = movstd(diff,window_length); -% n_mean_window = find((abs(diff_mean_window)>=1e-4) );%100ns窗,误差均值小于万分之一点 -% n_std_window = find((abs(diff_std_window)>=1e-4) ); %100ns窗,误差方差小于万分之一点 -% n_common = max(n_mean_window(end),n_std_window(end)); +window_length = 100e-9*fs; +diff_mean_window = movmean(diff,window_length); +diff_std_window = movstd(diff,window_length); +n_mean_window = find((abs(diff_mean_window)>=1e-4) );%100ns窗,误差均值小于万分之一点 +n_std_window = find((abs(diff_std_window)>=1e-4) ); %100ns窗,误差方差小于万分之一点 +n_common = max(n_mean_window(end),n_std_window(end)); %原始数据作图 tiledlayout(2,1) ax1 = nexttile; @@ -68,10 +68,10 @@ elseif a(2) > 5e-6 plot_p(n1000(1)); %下降沿1us plot_p(ne(end)); %误差小于万分之一 fprintf("Falling edge of 20ns~40ns mean :%.4e\t std :%.4e\t",mean(diff(n20_40)),std(diff(n20_40))); - fprintf("Falling edge of 1us~1.1us mean :%.4e\t std :%.4e\n",mean(diff(n1000_1100)),std(diff(n1000_1100))); + fprintf("Falling edge of 1us~1.1us mean :%.4e\t std :%.4e\t",mean(diff(n1000_1100)),std(diff(n1000_1100))); % fprintf("The error after falling edge of 1us is:%.4e\t",diff(n1000(1))); % fprintf("The time of erroe less than 1e-4 is :%.4e us\n",(n(ne(end))-n(n_edge(1)))); - % fprintf("The mean and std stably less than 1e-4 is :%.4e s\n",(n(n_common)-n(n_edge(1)))); + fprintf("The mean and std stably less than 1e-4 is :%.4e s\n",(n(n_common)-n(n_edge(1)))); end