From dd73d8dab5a293d342782364be6f8fc1f34b07f3 Mon Sep 17 00:00:00 2001 From: Erik Kooistra <kooistra@astron.nl> Date: Wed, 26 Oct 2016 15:01:07 +0000 Subject: [PATCH] Added func_dp_stream_arr_combine_data_info_ctrl(). Clarified data, info and ctrl fields in t_dp_sosi. --- libraries/base/dp/src/vhdl/dp_stream_pkg.vhd | 54 +++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/libraries/base/dp/src/vhdl/dp_stream_pkg.vhd b/libraries/base/dp/src/vhdl/dp_stream_pkg.vhd index abfddba7bb..863574237d 100644 --- a/libraries/base/dp/src/vhdl/dp_stream_pkg.vhd +++ b/libraries/base/dp/src/vhdl/dp_stream_pkg.vhd @@ -45,6 +45,10 @@ PACKAGE dp_stream_pkg Is -- streaming components can remain as they are. -- * Added sync and bsn to SOSI to have timestamp information with the data -- * Added re and im to SOSI to support complex data for DSP + -- * The sosi fields can be labeled in diffent groups: ctrl, info and data as shown in comment at the t_dp_sosi definition. + -- This grouping is useful for functions that operate on a t_dp_sosi signal. + -- * The info fields are valid at the sop or at the eop, but typically they hold their last active value to avoid unnessary + -- toggling and to ease viewing in the wave window. CONSTANT c_dp_stream_bsn_w : NATURAL := 64; -- 64 is sufficient to count blocks of data for years CONSTANT c_dp_stream_data_w : NATURAL := 768; -- 72 is sufficient for max word 8 * 9-bit. 576 supports half rate DDR4 bus data width. The current 768 is enough for wide single clock SLVs (e.g. headers) CONSTANT c_dp_stream_dsp_data_w : NATURAL := 64; -- 64 is sufficient for DSP data, including complex power accumulates @@ -63,17 +67,17 @@ PACKAGE dp_stream_pkg Is END RECORD; TYPE t_dp_sosi IS RECORD -- Source Out or Sink In - sync : STD_LOGIC; - bsn : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0); -- data block sequence number - data : STD_LOGIC_VECTOR(c_dp_stream_data_w-1 DOWNTO 0); - re : STD_LOGIC_VECTOR(c_dp_stream_dsp_data_w-1 DOWNTO 0); - im : STD_LOGIC_VECTOR(c_dp_stream_dsp_data_w-1 DOWNTO 0); - valid : STD_LOGIC; - sop : STD_LOGIC; - eop : STD_LOGIC; - empty : STD_LOGIC_VECTOR(c_dp_stream_empty_w-1 DOWNTO 0); - channel : STD_LOGIC_VECTOR(c_dp_stream_channel_w-1 DOWNTO 0); - err : STD_LOGIC_VECTOR(c_dp_stream_error_w-1 DOWNTO 0); -- name field 'err' to avoid the 'error' keyword + sync : STD_LOGIC; -- ctrl + bsn : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0); -- info at sop (block sequence number) + data : STD_LOGIC_VECTOR(c_dp_stream_data_w-1 DOWNTO 0); -- data + re : STD_LOGIC_VECTOR(c_dp_stream_dsp_data_w-1 DOWNTO 0); -- data + im : STD_LOGIC_VECTOR(c_dp_stream_dsp_data_w-1 DOWNTO 0); -- data + valid : STD_LOGIC; -- ctrl + sop : STD_LOGIC; -- ctrl + eop : STD_LOGIC; -- ctrl + empty : STD_LOGIC_VECTOR(c_dp_stream_empty_w-1 DOWNTO 0); -- info at eop + channel : STD_LOGIC_VECTOR(c_dp_stream_channel_w-1 DOWNTO 0); -- info at sop + err : STD_LOGIC_VECTOR(c_dp_stream_error_w-1 DOWNTO 0); -- info at eop (name field 'err' to avoid the 'error' keyword) END RECORD; -- Initialise signal declarations with c_dp_stream_rst/rdy to ease the interpretation of slv fields with unused bits @@ -297,8 +301,10 @@ PACKAGE dp_stream_pkg Is FUNCTION func_dp_stream_arr_reverse_range(in_arr : t_dp_siso_arr) RETURN t_dp_siso_arr; -- Functions to combinatorially hold the data fields and to set or reset the control fields in an sosi array - FUNCTION func_dp_stream_arr_set_control( dp : t_dp_sosi_arr; ctrl : t_dp_sosi) RETURN t_dp_sosi_arr; - FUNCTION func_dp_stream_arr_reset_control(dp : t_dp_sosi_arr ) RETURN t_dp_sosi_arr; + FUNCTION func_dp_stream_arr_combine_data_info_ctrl(dp : t_dp_sosi_arr; info, ctrl : t_dp_sosi) RETURN t_dp_sosi_arr; + FUNCTION func_dp_stream_arr_set_info( dp : t_dp_sosi_arr; info : t_dp_sosi) RETURN t_dp_sosi_arr; + FUNCTION func_dp_stream_arr_set_control( dp : t_dp_sosi_arr; ctrl : t_dp_sosi) RETURN t_dp_sosi_arr; + FUNCTION func_dp_stream_arr_reset_control( dp : t_dp_sosi_arr ) RETURN t_dp_sosi_arr; -- Functions to combinatorially determine the maximum and minimum sosi bsn[w-1:0] value in the sosi array (for all elements or only for the mask[]='1' elements) FUNCTION func_dp_stream_arr_bsn_max(dp : t_dp_sosi_arr; mask : STD_LOGIC_VECTOR; w : NATURAL) RETURN STD_LOGIC_VECTOR; @@ -971,7 +977,27 @@ PACKAGE BODY dp_stream_pkg IS END IF; END func_dp_stream_arr_reverse_range; - -- Functions to combinatorially hold the data fields and to set or reset the control fields in an sosi array + -- Functions to combinatorially hold the data fields and to set or reset the info and control fields in an sosi array + FUNCTION func_dp_stream_arr_combine_data_info_ctrl(dp : t_dp_sosi_arr; info, ctrl : t_dp_sosi) RETURN t_dp_sosi_arr IS + VARIABLE v_dp : t_dp_sosi_arr(dp'RANGE) := dp; -- hold sosi data + BEGIN + v_dp := func_dp_stream_arr_set_info( v_dp, info); -- set sosi info + v_dp := func_dp_stream_arr_set_control(v_dp, ctrl); -- set sosi ctrl + RETURN v_dp; + END func_dp_stream_arr_combine_data_info_ctrl; + + FUNCTION func_dp_stream_arr_set_info(dp : t_dp_sosi_arr; info : t_dp_sosi) RETURN t_dp_sosi_arr IS + VARIABLE v_dp : t_dp_sosi_arr(dp'RANGE) := dp; -- hold sosi data + BEGIN + FOR I IN dp'RANGE LOOP -- set sosi info + v_dp(I).bsn := info.bsn; -- sop + v_dp(I).channel := info.channel; -- sop + v_dp(I).empty := info.empty; -- eop + v_dp(I).err := info.err; -- eop + END LOOP; + RETURN v_dp; + END func_dp_stream_arr_set_info; + FUNCTION func_dp_stream_arr_set_control(dp : t_dp_sosi_arr; ctrl : t_dp_sosi) RETURN t_dp_sosi_arr IS VARIABLE v_dp : t_dp_sosi_arr(dp'RANGE) := dp; -- hold sosi data BEGIN -- GitLab