diff --git a/tests/test_app_low_level_api/main.c b/tests/test_app_low_level_api/main.c index 004c327d..64cbc882 100644 --- a/tests/test_app_low_level_api/main.c +++ b/tests/test_app_low_level_api/main.c @@ -102,6 +102,7 @@ int main(int argc, char** argv) { int16_t error; sscanf(read_buf, "%hu", &error); fprintf(stderr, "%hu\n", error); + uint32_t t0 = get_reference_time(); sw_pll_lock_status_t s = sw_pll_do_control_from_error(&sw_pll, error); uint32_t t1 = get_reference_time(); diff --git a/tests/test_lib_sw_pll_equiv.py b/tests/test_lib_sw_pll_equiv.py index 7b2a55a7..e713b0d5 100644 --- a/tests/test_lib_sw_pll_equiv.py +++ b/tests/test_lib_sw_pll_equiv.py @@ -1,13 +1,5 @@ # Copyright 2023 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -""" -Assorted tests which run the test_app in xsim - -This file is structured as a fixture which takes a while to run -and generates a pandas.DataFrame containing some time domain -outputs from the control loops. Then a series of tests which -check different aspects of the content of this DataFrame. -""" import pytest import numpy as np @@ -46,10 +38,8 @@ def test_low_level_equivalence(solution_12288, bin_dir): target_output_frequency=target_mclk_f, kp=0.0, ki=2.0, - kii=1.0, - loop_rate_count=loop_rate_count, # copied from ed's setup in 3800 - # have to call 512 times to do 1 - # control update + kii=1.0, # NOTE WE SPECIFICALLY ENABLE KII in this test as it is not tested elsewhere + loop_rate_count=loop_rate_count, pll_ratio=int(target_mclk_f / target_ref_f), ref_clk_expected_inc=0, app_pll_ctl_reg_val=0, @@ -63,7 +53,7 @@ def test_low_level_equivalence(solution_12288, bin_dir): pll.update_frac_reg(start_reg | app_pll_frac_calc.frac_enable_mask) - input_errors = np.random.randint(-lut_size // 2, lut_size // 2, size = 40) + input_errors = np.random.randint(-lut_size // 10, lut_size // 10, size = 40) print(f"input_errors: {input_errors}") result_categories = { @@ -128,7 +118,8 @@ def test_low_level_equivalence(solution_12288, bin_dir): C = results["C"][compare_item] Python = results["Python"][compare_item] print("***", compare_item) - print(C, Python) + for c, p in zip(C, Python): + print(c, p) print() assert np.allclose(C, Python), f"Error in low level equivalence checking of: {compare_item}" diff --git a/tests/test_sdm_ctrl_equiv.py b/tests/test_sdm_ctrl_equiv.py index b120bde0..3dda415a 100644 --- a/tests/test_sdm_ctrl_equiv.py +++ b/tests/test_sdm_ctrl_equiv.py @@ -1,13 +1,5 @@ # Copyright 2023 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -""" -Assorted tests which run the test_app in xsim - -This file is structured as a fixture which takes a while to run -and generates a pandas.DataFrame containing some time domain -outputs from the control loops. Then a series of tests which -check different aspects of the content of this DataFrame. -""" import pytest import numpy as np diff --git a/tests/test_sdm_dco_equiv.py b/tests/test_sdm_dco_equiv.py index 8433a06e..fa8e84f6 100644 --- a/tests/test_sdm_dco_equiv.py +++ b/tests/test_sdm_dco_equiv.py @@ -1,13 +1,5 @@ # Copyright 2023 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -""" -Assorted tests which run the test_app in xsim - -This file is structured as a fixture which takes a while to run -and generates a pandas.DataFrame containing some time domain -outputs from the control loops. Then a series of tests which -check different aspects of the content of this DataFrame. -""" import pytest import numpy as np @@ -18,8 +10,6 @@ from matplotlib import pyplot as plt from subprocess import Popen, PIPE - -# from sw_pll.app_pll_model import app_pll_frac_calc from sw_pll.dco_model import sigma_delta_dco from test_lib_sw_pll import bin_dir @@ -85,8 +75,8 @@ def close(self): def test_sdm_dco_equivalence(bin_dir): """ - Simple low level test of equivalence using do_control_from_error - Feed in random numbers into C and Python DUTs and see if we get the same results + Simple low level test of equivalence using do_modulate + Feed in a sweep of DCO control vals into C and Python DUTs and see if we get the same results """ args = DutSDMDCOArgs(