diff --git a/libraries/base/dp/tb/vhdl/dp_stream_stimuli.vhd b/libraries/base/dp/tb/vhdl/dp_stream_stimuli.vhd index 5598324d73cef1c43f8ee4623f41fbf79ca07944..ffa8371c86365df31b01739c74a71ef2adf1c7dd 100644 --- a/libraries/base/dp/tb/vhdl/dp_stream_stimuli.vhd +++ b/libraries/base/dp/tb/vhdl/dp_stream_stimuli.vhd @@ -52,7 +52,10 @@ ENTITY dp_stream_stimuli IS -- initializations g_sync_period : NATURAL := 10; g_sync_offset : NATURAL := 0; + g_use_complex : BOOLEAN := FALSE; g_data_init : NATURAL := 0; -- choose some easy to recognize and unique value, data will increment at every valid + g_re_init : NATURAL := 0; -- choose some easy to recognize and unique value, data will increment at every valid + g_im_init : NATURAL := 0; -- choose some easy to recognize and unique value, data will increment at every valid g_bsn_init : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0) := TO_DP_BSN(0); -- X"0877665544332211", bsn will increment at every sop g_err_init : NATURAL := 247; -- choose some easy to recognize and unique value g_err_incr : NATURAL := 1; -- when 0 keep fixed at init value, when 1 increment at every sop @@ -125,6 +128,8 @@ BEGIN v_sosi.bsn := INCR_UVEC(g_bsn_init, -1); v_sosi.channel := INCR_UVEC(TO_DP_CHANNEL(g_channel_init), -g_channel_incr); v_sosi.data := INCR_UVEC(TO_DP_DATA(g_data_init), -g_pkt_len); + v_sosi.re := INCR_UVEC(TO_DP_DSP_DATA(g_re_init), -g_pkt_len); + v_sosi.im := INCR_UVEC(TO_DP_DSP_DATA(g_im_init), -g_pkt_len); v_sosi.err := INCR_UVEC(TO_DP_ERROR(g_err_init), -g_err_incr); i_src_out <= c_dp_sosi_rst; @@ -137,13 +142,26 @@ BEGIN v_sosi.bsn := INCR_UVEC(v_sosi.bsn, 1); v_sosi.sync := sel_a_b((UNSIGNED(v_sosi.bsn) MOD g_sync_period) = g_sync_offset, '1', '0'); -- insert sync starting at BSN=g_sync_offset and with period g_sync_period v_sosi.channel := INCR_UVEC(v_sosi.channel, g_channel_incr); - v_sosi.data := INCR_UVEC(v_sosi.data, g_pkt_len); - v_sosi.data := RESIZE_DP_DATA(v_sosi.data(g_in_dat_w-1 DOWNTO 0)); -- wrap when >= 2**g_in_dat_w v_sosi.err := INCR_UVEC(v_sosi.err, g_err_incr); - + IF g_use_complex=FALSE THEN + v_sosi.data := INCR_UVEC(v_sosi.data, g_pkt_len); + v_sosi.data := RESIZE_DP_DATA(v_sosi.data(g_in_dat_w-1 DOWNTO 0)); -- wrap when >= 2**g_in_dat_w + ELSE + v_sosi.re := INCR_UVEC(v_sosi.re, g_pkt_len); + v_sosi.re := RESIZE_DP_DSP_DATA(v_sosi.re(g_in_dat_w-1 DOWNTO 0)); -- wrap when >= 2**g_in_dat_w + v_sosi.im := INCR_UVEC(v_sosi.im, g_pkt_len); + v_sosi.im := RESIZE_DP_DSP_DATA(v_sosi.im(g_in_dat_w-1 DOWNTO 0)); -- wrap when >= 2**g_in_dat_w + END IF; -- Send packet - proc_dp_gen_block_data(g_in_dat_w, TO_UINT(v_sosi.data), g_pkt_len, TO_UINT(v_sosi.channel), TO_UINT(v_sosi.err), v_sosi.sync, v_sosi.bsn, clk, stimuli_en, src_in, i_src_out); - + IF g_use_complex=FALSE THEN + proc_dp_gen_block_data(g_in_dat_w, TO_UINT(v_sosi.data), + g_pkt_len, TO_UINT(v_sosi.channel), TO_UINT(v_sosi.err), v_sosi.sync, v_sosi.bsn, + clk, stimuli_en, src_in, i_src_out); + ELSE + proc_dp_gen_block_complex(g_in_dat_w, TO_UINT(v_sosi.re), TO_UINT(v_sosi.im), + g_pkt_len, TO_UINT(v_sosi.channel), TO_UINT(v_sosi.err), v_sosi.sync, v_sosi.bsn, + clk, stimuli_en, src_in, i_src_out); + END IF; -- Insert optional gap between the packets proc_common_wait_some_cycles(clk, g_pkt_gap); diff --git a/libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd b/libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd index b9c8dc60b8a1eaff42bacd36b337ee8d19b3b2a8..f3955889bab0b15aed221174b8c59d26642ab617 100644 --- a/libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd +++ b/libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd @@ -144,9 +144,10 @@ PACKAGE tb_dp_pkg IS SIGNAL src_in : IN t_dp_siso; SIGNAL src_out : OUT t_dp_sosi); + -- Increment only sosi.data, keep complex re,im = 0 PROCEDURE proc_dp_gen_block_data(CONSTANT c_data_w : IN NATURAL; -- data width for the data field CONSTANT c_symbol_init : IN NATURAL; -- init counter for the data in the data field - CONSTANT c_nof_symbols : IN NATURAL; -- nof symbols per frame for the data fields + CONSTANT c_nof_symbols : IN NATURAL; -- nof symbols = nof data per frame for the data fields CONSTANT c_channel : IN NATURAL; -- channel field CONSTANT c_error : IN NATURAL; -- error field CONSTANT c_sync : IN STD_LOGIC; -- when '1' issue sync pulse during this block @@ -156,6 +157,20 @@ PACKAGE tb_dp_pkg IS SIGNAL src_in : IN t_dp_siso; SIGNAL src_out : OUT t_dp_sosi); + -- Increment only sosi.re, im, keep data = 0 + PROCEDURE proc_dp_gen_block_complex(CONSTANT c_data_w : IN NATURAL; -- data width for the re, im field + CONSTANT c_symbol_re_init : IN NATURAL; -- init counter for symbols in re field + CONSTANT c_symbol_im_init : IN NATURAL; -- init counter for symbols in im field + CONSTANT c_nof_symbols : IN NATURAL; -- nof symbols = nof data per frame for the data fields + CONSTANT c_channel : IN NATURAL; -- channel field + CONSTANT c_error : IN NATURAL; -- error field + CONSTANT c_sync : IN STD_LOGIC; -- when '1' issue sync pulse during this block + CONSTANT c_bsn : IN STD_LOGIC_VECTOR; -- bsn field + SIGNAL clk : IN STD_LOGIC; + SIGNAL in_en : IN STD_LOGIC; -- when '0' then no valid output even when src_in is ready + SIGNAL src_in : IN t_dp_siso; + SIGNAL src_out : OUT t_dp_sosi); + -- Handle stream ready signal, only support RL=0 or 1. PROCEDURE proc_dp_stream_ready_latency(CONSTANT c_latency : IN NATURAL; SIGNAL clk : IN STD_LOGIC; @@ -690,7 +705,7 @@ PACKAGE BODY tb_dp_pkg IS END IF; END proc_dp_gen_block_data; - + -- Increment only sosi.data, keep complex re,im = 0 PROCEDURE proc_dp_gen_block_data(CONSTANT c_data_w : IN NATURAL; -- data width for the data field CONSTANT c_symbol_init : IN NATURAL; -- init counter for the data in the data field CONSTANT c_nof_symbols : IN NATURAL; -- nof symbols per frame for the data fields @@ -706,6 +721,22 @@ PACKAGE BODY tb_dp_pkg IS proc_dp_gen_block_data(1, TRUE, c_data_w, c_data_w, c_symbol_init, 0, 0, c_nof_symbols, c_channel, c_error, c_sync, c_bsn, clk, in_en, src_in, src_out); END proc_dp_gen_block_data; + -- Increment only sosi.re, im, keep data = 0 + PROCEDURE proc_dp_gen_block_complex(CONSTANT c_data_w : IN NATURAL; -- data width for the re, im field + CONSTANT c_symbol_re_init : IN NATURAL; -- init counter for symbols in re field + CONSTANT c_symbol_im_init : IN NATURAL; -- init counter for symbols in im field + CONSTANT c_nof_symbols : IN NATURAL; -- nof symbols per frame for the data fields + CONSTANT c_channel : IN NATURAL; -- channel field + CONSTANT c_error : IN NATURAL; -- error field + CONSTANT c_sync : IN STD_LOGIC; -- when '1' issue sync pulse during this block + CONSTANT c_bsn : IN STD_LOGIC_VECTOR; -- bsn field + SIGNAL clk : IN STD_LOGIC; + SIGNAL in_en : IN STD_LOGIC; -- when '0' then no valid output even when src_in is ready + SIGNAL src_in : IN t_dp_siso; + SIGNAL src_out : OUT t_dp_sosi) IS + BEGIN + proc_dp_gen_block_data(1, FALSE, c_data_w, c_data_w, 0, c_symbol_re_init, c_symbol_im_init, c_nof_symbols, c_channel, c_error, c_sync, c_bsn, clk, in_en, src_in, src_out); + END proc_dp_gen_block_complex; ------------------------------------------------------------------------------ -- PROCEDURE: Handle stream ready signal