diff --git a/hdl/top_corr_matrix.vhd b/hdl/top_corr_matrix.vhd index 74443117753207976df2b4355efdaf5a055a6682..38ead473b35f122ec9c9d0a47ec2a27c081b1881 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 0feacce2082719836ec2e8e325e69e8d4d8a0da6..f3c428ef0309ce4dd87c9ae997f30b02b1da849f 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.";