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