Skip to content
Snippets Groups Projects
Commit 37724a60 authored by BRONES Romain's avatar BRONES Romain
Browse files

Dissociate X and Y plane for corr coef and control

* Two different register for enable and reset
* Duplicate coeffs
* Based on PSCID **table index**. > 50 is Y

* Threshold autostop is kept on both plane.
  Control moved to a dedicated register.
  When reached, stop both planes.
parent 90d4abe7
No related branches found
Tags 1.2.0
No related merge requests found
......@@ -12,13 +12,20 @@ entity corr_ll is
clk : in std_logic;
rst_n : in std_logic;
coef_a : in signed(C_W_COR_COEF-1 downto 0);
coef_b : in signed(C_W_COR_COEF-1 downto 0);
coef_ic : in signed(C_W_COR_COEF-1 downto 0);
coef_d : in signed(C_W_COR_COEF-1 downto 0);
enable_corr : in std_logic;
reset_corr : in std_logic;
coef_a_x : in signed(C_W_COR_COEF-1 downto 0);
coef_b_x : in signed(C_W_COR_COEF-1 downto 0);
coef_ic_x : in signed(C_W_COR_COEF-1 downto 0);
coef_d_x : in signed(C_W_COR_COEF-1 downto 0);
coef_a_y : in signed(C_W_COR_COEF-1 downto 0);
coef_b_y : in signed(C_W_COR_COEF-1 downto 0);
coef_ic_y : in signed(C_W_COR_COEF-1 downto 0);
coef_d_y : in signed(C_W_COR_COEF-1 downto 0);
enable_corr_x : in std_logic;
reset_corr_x : in std_logic;
enable_corr_y : in std_logic;
reset_corr_y : in std_logic;
matmult : in signed_array(0 to C_N_MM_PSC-1)(C_W_MM-1 downto 0);
matmult_valid : in std_logic;
......@@ -83,8 +90,33 @@ begin
signal rz_mult_b : signed(C_W_COR_SUMSAT-1 downto 0);
signal rz_mult_d : signed(C_W_COR_SUMSAT-1 downto 0);
signal coef_a : signed(C_W_COR_COEF-1 downto 0);
signal coef_b : signed(C_W_COR_COEF-1 downto 0);
signal coef_ic : signed(C_W_COR_COEF-1 downto 0);
signal coef_d : signed(C_W_COR_COEF-1 downto 0);
signal enable_corr : std_logic;
signal reset_corr : std_logic;
begin
-- Signal mux for X/Y coef and enable/reset, based on PSCID number
if I < 51 then
coef_a <= coef_a_x;
coef_b <= coef_b_x;
coef_ic <= coef_ic_x;
coef_d <= coef_d_x;
enable_corr <= enable_corr_x;
reset_corr <= reset_corr_x;
else
coef_a <= coef_a_y;
coef_b <= coef_b_y;
coef_ic <= coef_ic_y;
coef_d <= coef_d_y;
enable_corr <= enable_corr_y;
reset_corr <= reset_corr_y;
end if;
p_main:process(clk, rst_n)
begin
if rst_n = '0' then
......
......@@ -65,7 +65,8 @@ architecture struct of top_corr_matrix is
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);
signal enable_corr : std_logic;
signal enable_corr_x : std_logic;
signal enable_corr_y : std_logic;
-- Serializer
signal overrun_flag : std_logic;
......@@ -230,13 +231,19 @@ begin
matmult_seq => matmult_seq,
-- Corr coefs
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 => enable_corr,
coef_a_x => signed(mm_a2l.CORR_K1A_X.data.data),
coef_b_x => signed(mm_a2l.CORR_K1B_X.data.data),
coef_ic_x => signed(mm_a2l.CORR_K1IC_X.data.data),
coef_d_x => signed(mm_a2l.CORR_K1D_X.data.data),
coef_a_y => signed(mm_a2l.CORR_K1A_Y.data.data),
coef_b_y => signed(mm_a2l.CORR_K1B_Y.data.data),
coef_ic_y => signed(mm_a2l.CORR_K1IC_Y.data.data),
coef_d_y => signed(mm_a2l.CORR_K1D_Y.data.data),
reset_corr_x => mm_a2l.CONTROL.RST_CORR.data(0),
enable_corr_x => enable_corr_x,
reset_corr_y => mm_a2l.CONTROL.RST_CORR.data(0),
enable_corr_y => enable_corr_y,
-- Corr output
corrout_valid => corrfirst_valid,
......@@ -259,13 +266,19 @@ begin
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 => enable_corr,
coef_a_x => signed(mm_a2l.CORR_K2A_X.data.data),
coef_b_x => signed(mm_a2l.CORR_K2B_X.data.data),
coef_ic_x => signed(mm_a2l.CORR_K2IC_X.data.data),
coef_d_x => signed(mm_a2l.CORR_K2D_X.data.data),
coef_a_y => signed(mm_a2l.CORR_K2A_Y.data.data),
coef_b_y => signed(mm_a2l.CORR_K2B_Y.data.data),
coef_ic_y => signed(mm_a2l.CORR_K2IC_Y.data.data),
coef_d_y => signed(mm_a2l.CORR_K2D_Y.data.data),
reset_corr_x => mm_a2l.CONTROL_X.RST_CORR.data(0),
enable_corr_x => enable_corr_x,
reset_corr_y => mm_a2l.CONTROL_Y.RST_CORR.data(0),
enable_corr_y => enable_corr_y,
-- Corr output
corrout_valid => corrout_valid,
......@@ -273,7 +286,8 @@ begin
corrout => corrout
);
enable_corr <= mm_a2l.CONTROL.ENABLE_CORR.data(0) and not thresh_reached;
enable_corr_x <= mm_a2l.CONTROL_X.ENABLE_CORR.data(0) and not thresh_reached;
enable_corr_y <= mm_a2l.CONTROL_Y.ENABLE_CORR.data(0) and not thresh_reached;
---------------------
-- DATA SERIALIZER --
......@@ -347,8 +361,8 @@ begin
s_axis_tdata_cor => ser_tdata(C_W_COR-1 downto 0),
s_axis_tvalid => ser_tvalid,
enable_thresh => mm_a2l.CONTROL.ENABLE_THRESH.data(0),
rst_thresh => mm_a2l.CONTROL.RST_THRESH.data(0),
enable_thresh => mm_a2l.THRESH.ENABLE.data(0),
rst_thresh => mm_a2l.THRESH.RST.data(0),
thresh_reached => thresh_reached
);
......
......@@ -28,13 +28,25 @@ addrmap corr_matrix {
} VERSION @0x04;
reg {
desc="Global control of the corrector.";
desc="X-plane control of the corrector.";
default sw=rw; default hw=r;
field {} ENABLE_CORR;
field {} RST_CORR;
field {} ENABLE_THRESH;
field {} RST_THRESH;
} CONTROL;
} CONTROL_X;
reg {
desc="Y-plane control of the corrector.";
default sw=rw; default hw=r;
field {} ENABLE_CORR;
field {} RST_CORR;
} CONTROL_Y;
reg {
desc="Theshold autostop.";
default sw=rw; default hw=r;
field {} ENABLE;
field {} RST;
} THRESH;
reg {
desc="Global status of the corrector.";
......@@ -45,43 +57,84 @@ addrmap corr_matrix {
reg {
desc="Correction coefficient A.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1A;
} CORR_K1A_X;
reg {
desc="Correction coefficient B.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1B_X;
reg {
desc="Correction coefficient (inverse) C.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1IC_X;
reg {
desc="Correction coefficient D.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1D_X;
reg {
desc="Correction coefficient A.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K2A_X;
reg {
desc="Correction coefficient B.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1B;
} CORR_K2B_X;
reg {
desc="Correction coefficient (inverse) C.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1IC;
} CORR_K2IC_X;
reg {
desc="Correction coefficient D.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1D;
} CORR_K2D_X;
reg {
desc="Correction coefficient A.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1A_Y;
reg {
desc="Correction coefficient B.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1B_Y;
reg {
desc="Correction coefficient (inverse) C.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1IC_Y;
reg {
desc="Correction coefficient D.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K1D_Y;
reg {
desc="Correction coefficient A.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K2A;
} CORR_K2A_Y;
reg {
desc="Correction coefficient B.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K2B;
} CORR_K2B_Y;
reg {
desc="Correction coefficient (inverse) C.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K2IC;
} CORR_K2IC_Y;
reg {
desc="Correction coefficient D.";
field {sw = rw; hw = r;} data[`C_W_COR_COEF];
} CORR_K2D;
} CORR_K2D_Y;
reg {
desc="Number of ID to count for matrix multiplication.";
......@@ -121,7 +174,7 @@ addrmap corr_matrix {
} external ERRORBITX;
mem {
desc = "X Average orbit error";
desc = "Y Average orbit error";
sw=r;
memwidth = 32;
mementries = 2**`C_W_MM_IDCNT;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment