From b759cff93956a93532c77fc93fb281fec3248ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Bron=C3=A8s?= <romain.brones@synchrotron-soleil.fr> Date: Fri, 30 Jun 2023 11:23:19 +0200 Subject: [PATCH] feat: Add a second LL corrector * Allows second order correction --- hdl/top_corr_matrix.vhd | 42 +++++++++++++++++++++++++++++++++++++---- rdl/corr_matrix.rdl | 29 ++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/hdl/top_corr_matrix.vhd b/hdl/top_corr_matrix.vhd index 7444311..38ead47 100644 --- a/hdl/top_corr_matrix.vhd +++ b/hdl/top_corr_matrix.vhd @@ -58,6 +58,10 @@ architecture struct of top_corr_matrix is signal matmult_seq : std_logic_vector(C_W_BPMSEQ-1 downto 0); -- Corrector result, parallel + signal corrfirst_valid : std_logic; + signal corrfirst_seq : std_logic_vector(C_W_BPMSEQ-1 downto 0); + signal corrfirst : signed_array(0 to C_N_MM_PSC-1)(C_W_COR-1 downto 0); + signal corrfirst_resize: signed_array(0 to C_N_MM_PSC-1)(C_W_MM-1 downto 0); signal corrout_valid : std_logic; signal corrout_seq : std_logic_vector(C_W_BPMSEQ-1 downto 0); signal corrout : signed_array(0 to C_N_MM_PSC-1)(C_W_COR-1 downto 0); @@ -165,10 +169,39 @@ begin matmult_seq => matmult_seq, -- Corr coefs - coef_a => signed(mm_a2l.CORR_KA.data.data), - coef_b => signed(mm_a2l.CORR_KB.data.data), - coef_ic => signed(mm_a2l.CORR_KIC.data.data), - coef_d => signed(mm_a2l.CORR_KD.data.data), + coef_a => signed(mm_a2l.CORR_K1A.data.data), + coef_b => signed(mm_a2l.CORR_K1B.data.data), + coef_ic => signed(mm_a2l.CORR_K1IC.data.data), + coef_d => signed(mm_a2l.CORR_K1D.data.data), + + reset_corr => mm_a2l.CONTROL.RST_CORR.data(0), + enable_corr => mm_a2l.CONTROL.ENABLE_CORR.data(0), + + -- Corr output + corrout_valid => corrfirst_valid, + corrout_seq => corrfirst_seq, + corrout => corrfirst + ); + + gen_resize:for I in 0 to C_N_MM_PSC-1 generate + corrfirst_resize(I) <= resize(corrfirst(I), C_W_MM); + end generate; + + inst_corr2: entity work.corr_ll + port map( + clk => clk, + rst_n => rst_n, + + -- matmult input + matmult => corrfirst_resize, + matmult_valid => corrfirst_valid, + matmult_seq => corrfirst_seq, + + -- Corr coefs + coef_a => signed(mm_a2l.CORR_K2A.data.data), + coef_b => signed(mm_a2l.CORR_K2B.data.data), + coef_ic => signed(mm_a2l.CORR_K2IC.data.data), + coef_d => signed(mm_a2l.CORR_K2D.data.data), reset_corr => mm_a2l.CONTROL.RST_CORR.data(0), enable_corr => mm_a2l.CONTROL.ENABLE_CORR.data(0), @@ -179,6 +212,7 @@ begin corrout => corrout ); + --------------------- -- DATA SERIALIZER -- --------------------- diff --git a/rdl/corr_matrix.rdl b/rdl/corr_matrix.rdl index 0feacce..f3c428e 100644 --- a/rdl/corr_matrix.rdl +++ b/rdl/corr_matrix.rdl @@ -36,22 +36,43 @@ addrmap corr_matrix { reg { desc="Correction coefficient A."; field {sw = rw; hw = r;} data[`C_W_COR_COEF]; - } CORR_KA; + } CORR_K1A; reg { desc="Correction coefficient B."; field {sw = rw; hw = r;} data[`C_W_COR_COEF]; - } CORR_KB; + } CORR_K1B; reg { desc="Correction coefficient (inverse) C."; field {sw = rw; hw = r;} data[`C_W_COR_COEF]; - } CORR_KIC; + } CORR_K1IC; reg { desc="Correction coefficient D."; field {sw = rw; hw = r;} data[`C_W_COR_COEF]; - } CORR_KD; + } CORR_K1D; + + + reg { + desc="Correction coefficient A."; + field {sw = rw; hw = r;} data[`C_W_COR_COEF]; + } CORR_K2A; + + reg { + desc="Correction coefficient B."; + field {sw = rw; hw = r;} data[`C_W_COR_COEF]; + } CORR_K2B; + + reg { + desc="Correction coefficient (inverse) C."; + field {sw = rw; hw = r;} data[`C_W_COR_COEF]; + } CORR_K2IC; + + reg { + desc="Correction coefficient D."; + field {sw = rw; hw = r;} data[`C_W_COR_COEF]; + } CORR_K2D; reg { desc="Number of ID to count for matrix multiplication."; -- GitLab