diff --git a/libraries/base/dp/src/vhdl/dp_packet_merge.vhd b/libraries/base/dp/src/vhdl/dp_packet_merge.vhd index 47c100423e3f48ae973bf7b94526e0f7ef922e38..77a3a2dd6b0e5c090398d6099a6c720ca92a97e1 100644 --- a/libraries/base/dp/src/vhdl/dp_packet_merge.vhd +++ b/libraries/base/dp/src/vhdl/dp_packet_merge.vhd @@ -35,8 +35,6 @@ -- . with g_align_at_sync=true the merge can be forced to restart at a snk_in.sync. -- -- Issues: --- . merged err should preferrably be the bit wise or of the merged input packet err field instead --- of only the err field of the last. -- -- Design steps: -- A) No flow control @@ -318,7 +316,7 @@ BEGIN v.src_out.bsn := r.src_out.bsn; v.src_out.channel := r.src_out.channel; v.src_out.empty := r.src_out.empty; - v.src_out.err := r.src_out.err OR snk_in.err; -- OR the err fields of the packets to reflect combined error status. + v.src_out.err := r.src_out.err; v.src_out.sync := '0'; v.src_out.sop := '0'; v.src_out.eop := '0'; @@ -329,11 +327,16 @@ BEGIN v.src_out.sync := snk_in.sync; -- only preserve sync when sync interval and nof_pkt interval are aligned, else sync gets lost but could still be recovered from BSN v.src_out.bsn := snk_in.bsn; -- use BSN of first packet for merged packet v.src_out.channel := snk_in.channel; -- use channel of first packet for merged packet - v.src_out.err := snk_in.err; END IF; END IF; IF snk_in.eop = '1' THEN + IF r.pkt_cnt = 0 THEN + v.src_out.err := snk_in.err; + ELSE + v.src_out.err := r.src_out.err OR snk_in.err; -- OR the err fields of the packets to reflect combined error status. + END IF; + IF r.pkt_cnt = r.nof_pkt-1 THEN v.src_out.eop := '1'; v.src_out.empty := snk_in.empty; diff --git a/libraries/base/dp/tb/vhdl/tb_dp_packet_merge.vhd b/libraries/base/dp/tb/vhdl/tb_dp_packet_merge.vhd index afbb9d176adaee077b5943b41c95784ffedb21f8..f37dab7d34f6a13a485ea7a1fd91c31110fd13ed 100644 --- a/libraries/base/dp/tb/vhdl/tb_dp_packet_merge.vhd +++ b/libraries/base/dp/tb/vhdl/tb_dp_packet_merge.vhd @@ -198,6 +198,7 @@ BEGIN v_sosi.bsn := STD_LOGIC_VECTOR( UNSIGNED(c_bsn_init) + c_verify_at_least*g_nof_pkt); v_sosi.channel := TO_DP_CHANNEL(c_channel_init + c_verify_at_least*g_nof_pkt); v_sosi.err := TO_DP_ERROR(c_err_init + c_verify_at_least*g_nof_pkt); + -- . account for g_pkt_len v_sosi.data := INCR_UVEC(v_sosi.data, g_pkt_len-1); v_sosi.data := RESIZE_DP_DATA(v_sosi.data(g_data_w-1 DOWNTO 0)); -- wrap when >= 2**g_data_w @@ -236,7 +237,6 @@ BEGIN proc_dp_verify_data("verify_snk_in.data", c_rl, c_data_max, c_unsigned_1, clk, verify_en_valid, verify_snk_out.ready, verify_snk_in.valid, verify_snk_in.data, prev_verify_snk_in.data); proc_dp_verify_data("verify_snk_in.bsn", c_rl, c_unsigned_0, TO_UNSIGNED(c_verify_data_gap,32), clk, verify_en_sop, verify_snk_out.ready, verify_snk_in.sop, verify_snk_in.bsn, prev_verify_snk_in.bsn); proc_dp_verify_data("verify_snk_in.channel", c_rl, c_unsigned_0, TO_UNSIGNED(c_verify_data_gap,32), clk, verify_en_sop, verify_snk_out.ready, verify_snk_in.sop, verify_snk_in.channel, prev_verify_snk_in.channel); - proc_dp_verify_data("verify_snk_in.err", c_rl, c_unsigned_0, TO_UNSIGNED(c_verify_data_gap,32), clk, verify_en_eop, verify_snk_out.ready, verify_snk_in.eop, verify_snk_in.err, prev_verify_snk_in.err); -- Verify that the output sync occurs when expected proc_dp_verify_sync(c_sync_period, c_sync_offset, clk, verify_en_sop, verify_snk_in.sync, verify_snk_in.sop, verify_snk_in.bsn);