From adc0450e68d84a11cb2e10506f5eae425acc6782 Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Thu, 10 Mar 2022 11:09:32 +0100 Subject: [PATCH] Use COMPLEX_RADIUS(). --- libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd b/libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd index fe84e21ca5..eac6be532f 100644 --- a/libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd +++ b/libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd @@ -80,9 +80,6 @@ -- > observe the *_scope signals as radix decimal, format analogue format signals in the Wave window. -- default use analogue(automatic), if necessary zoom in using right click analogue(custom). -- --- Note: --- . Must use ABS() with **2.0 of negative REAL, because (negative)**2.0 yields error and value 0.0, --- . Must use brackets (ABS()) to avoid compile error LIBRARY ieee, common_lib, dp_lib, diag_lib, filter_lib, rTwoSDF_lib, fft_lib, wpfb_lib; LIBRARY pfs_lib, pft2_lib, pfb2_lib; @@ -798,12 +795,11 @@ BEGIN sub_b_re_frac <= out_re WHEN rising_edge(dp_clk) AND out_bin = c_bin_b + 1 AND out_val_b = '1'; sub_b_im_frac <= out_im WHEN rising_edge(dp_clk) AND out_bin = c_bin_b + 1 AND out_val_b = '1'; - -- Must use ABS() with ** of real, because (negative)**2.0 yields error and value 0.0, also must use brackets (ABS()) to avoid compile error - sub_a_ampl <= SQRT((ABS(REAL(sub_a_re)))**2.0 + (ABS(REAL(sub_a_im)))**2.0); - sub_a_ampl_frac <= SQRT((ABS(REAL(sub_a_re_frac)))**2.0 + (ABS(REAL(sub_a_im_frac)))**2.0); + sub_a_ampl <= COMPLEX_RADIUS(sub_a_re, sub_a_im); + sub_a_ampl_frac <= COMPLEX_RADIUS(sub_a_re_frac, sub_a_im_frac); - sub_b_ampl <= SQRT((ABS(REAL(sub_b_re)))**2.0 + (ABS(REAL(sub_b_im)))**2.0); - sub_b_ampl_frac <= SQRT((ABS(REAL(sub_b_re_frac)))**2.0 + (ABS(REAL(sub_b_im_frac)))**2.0); + sub_b_ampl <= COMPLEX_RADIUS(sub_b_re, sub_b_im); + sub_b_ampl_frac <= COMPLEX_RADIUS(sub_b_re_frac, sub_b_im_frac); --------------------------------------------------------------------------- -- Measure ADC/WG input mean (DC) and power, and determine sine amplitude -- GitLab