Skip to content
Snippets Groups Projects
Commit e390c5db authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Added g_channel_incr and g_err_incr. Default 1, but this enables using e.g. 0 for fixed valeus.

parent ef229edc
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,10 @@
-- . The dp_stream_stimuli generates as stream of packets with counter data.
-- Description:
--
-- Remark:
-- . The stimuli empty = 0 because the data in proc_dp_gen_block_data() is
-- generated with one symbol per data (because symbol_w = data_w).
--
-- Usage:
-- . See tb_dp_example_no_dut for usage example
--
......@@ -48,10 +52,12 @@ ENTITY dp_stream_stimuli IS
-- initializations
g_sync_period : NATURAL := 10;
g_sync_offset : NATURAL := 7;
g_data_init : NATURAL := 0;
g_bsn_init : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0) := X"0000000000000000"; -- X"0877665544332211"
g_err_init : NATURAL := 247;
g_channel_init : NATURAL := 5; -- fixed
g_data_init : NATURAL := 0; -- choose some easy to recognize and unique value, data will increment at every sop
g_bsn_init : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0) := X"0000000000000000"; -- 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
g_channel_init : NATURAL := 5; -- choose some easy to recognize and unique value
g_channel_incr : NATURAL := 1; -- when 0 keep fixed at init value, when 1 increment at every sop
-- specific
g_in_dat_w : NATURAL := 32;
g_nof_repeat : NATURAL := 5;
......@@ -116,9 +122,9 @@ BEGIN
-- Adjust initial sosi field values by -1 to compensate for auto increment
v_sosi.bsn := INCR_UVEC(g_bsn_init, -1);
v_sosi.channel := INCR_UVEC(TO_DP_CHANNEL(g_channel_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.err := INCR_UVEC(TO_DP_ERROR(g_err_init), -1);
v_sosi.err := INCR_UVEC(TO_DP_ERROR(g_err_init), -g_err_incr);
i_src_out <= c_dp_sosi_rst;
proc_common_wait_until_low(clk, rst);
......@@ -129,10 +135,10 @@ BEGIN
-- Auto increment v_sosi field values for this packet
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, 1);
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, 1);
v_sosi.err := INCR_UVEC(v_sosi.err, g_err_incr);
-- 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);
......@@ -154,8 +160,8 @@ BEGIN
-- Determine and keep last expected sosi field values after end of stimuli
-- . e_qual
v_last.bsn := STD_LOGIC_VECTOR( UNSIGNED(g_bsn_init) + g_nof_repeat-1);
v_last.channel := TO_DP_CHANNEL(g_channel_init + g_nof_repeat-1);
v_last.err := TO_DP_ERROR(g_err_init + g_nof_repeat-1);
v_last.channel := TO_DP_CHANNEL(g_channel_init + (g_nof_repeat-1)*g_channel_incr);
v_last.err := TO_DP_ERROR(g_err_init + (g_nof_repeat-1)*g_err_incr);
-- . account for g_pkt_len
v_last.data := INCR_UVEC(v_sosi.data, g_pkt_len-1);
v_last.data := RESIZE_DP_DATA(v_last.data(g_in_dat_w-1 DOWNTO 0)); -- wrap when >= 2**g_in_dat_w
......
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