diff --git a/applications/lofar2/libraries/ddrctrl/src/vhdl/repack.vhd b/applications/lofar2/libraries/ddrctrl/src/vhdl/repack.vhd index 14aeeba29877b8f179933cad47c5ca079802a370..c5a43daac7f93aabe4d21f3d184537b93cc22300 100644 --- a/applications/lofar2/libraries/ddrctrl/src/vhdl/repack.vhd +++ b/applications/lofar2/libraries/ddrctrl/src/vhdl/repack.vhd @@ -1,6 +1,6 @@ -LIBRARY IEEE; +LIBRARY IEEE, dp_lib; USE IEEE.std_logic_1164.ALL; - +USE dp_lib.dp_stream_pkg.ALL; ENTITY repack IS GENERIC ( @@ -11,8 +11,7 @@ ENTITY repack IS clk : IN STD_LOGIC; out_o_f : OUT NATURAL; in_data : IN STD_LOGIC_VECTOR(g_in_data_w-1 DOWNTO 0); - out_data : OUT STD_LOGIC_VECTOR(g_out_data_w-1 DOWNTO 0); - data_enable : OUT STD_LOGIC + out_sosi : OUT t_dp_sosi ); END repack; @@ -36,28 +35,28 @@ BEGIN IF (g_in_data_w*(c_v_count+1) >= g_out_data_w*(out_data_count+1)) THEN -- if the input data exceeds the output data vector width IF (out_data_count = 1) THEN -- if the input data exceeds c_v vector widt - out_o_f <= a_o_f; -- set the output overflow to the overflow that maches the out_data vector + out_o_f <= a_o_f; -- set the output overflow to the overflow that maches the out_sosi.data vector a_o_f <= a_o_f + g_in_data_w * c_v_count - g_out_data_w * (out_data_count + 1); -- check how much overflow there is and safe it in a_o_f c_v(k_c_v_w - 1 DOWNTO k_c_v_w - (g_in_data_w - a_o_f)) <= in_data(g_in_data_w - a_o_f - 1 DOWNTO 0); -- fill the rest of c_v untill the end c_v(a_o_f - 1 DOWNTO 0) <= in_data(g_in_data_w - 1 DOWNTO g_in_data_w - a_o_f); -- fill the start of c_v untill the a_o_f - out_data(g_out_data_w - 1 DOWNTO 0) <= c_v(k_c_v_w - 1 DOWNTO g_out_data_w); -- fill out_data with 2nd part of c_v - data_enable <= '1'; -- data_enable 1 + out_sosi.data(g_out_data_w - 1 DOWNTO 0) <= c_v(k_c_v_w - 1 DOWNTO g_out_data_w); -- fill out_sosi.data with 2nd part of c_v + out_sosi.valid <= '1'; -- out_sosi.valid 1 c_v_count <= 0; -- reset counter out_data_count <= 0; -- reset counter Else -- if the input data exceeds output data vector width but not the c_v vector widt c_v(g_in_data_w * (c_v_count + 1) + a_o_f - 1 DOWNTO g_in_data_w * c_v_count + a_o_f) <= in_data(g_in_data_w - 1 DOWNTO 0); -- fill c_v c_v_count <= c_v_count + 1; -- increase the counter of c_v with 1 - out_data(g_out_data_w - 1 DOWNTO 0) <= c_v(g_out_data_w - 1 DOWNTO 0); -- fill out_data with 1st part of c_v - out_data_count <= out_data_count + 1; -- increase the counter of out_data with 1 - data_enable <= '1'; -- data_enable 1 + out_sosi.data(g_out_data_w - 1 DOWNTO 0) <= c_v(g_out_data_w - 1 DOWNTO 0); -- fill out_sosi.data with 1st part of c_v + out_data_count <= out_data_count + 1; -- increase the counter of out_sosi.data with 1 + out_sosi.valid <= '1'; -- out_sosi.valid 1 END IF; ELSE -- if the input data doesn't exceeds the output data vector width c_v(g_in_data_w * (c_v_count + 1) + a_o_f - 1 DOWNTO g_in_data_w * c_v_count + a_o_f) <= in_data(g_in_data_w - 1 DOWNTO 0); -- fill c_v c_v_count <= c_v_count + 1; -- increase the counter of c_v with 1 - data_enable <= '0'; -- data_enable 0 + out_sosi.valid <= '0'; -- out_sosi.valid 0 END IF;