From 385257e2719665a5954346ed7827d27c3ea07a46 Mon Sep 17 00:00:00 2001 From: Greek Date: Fri, 19 Nov 2021 18:24:32 +0100 Subject: [PATCH] Fix WITH_KEY branching in DDS Entities --- src/dds_reader.vhd | 147 ++++++++++++++++++++++++++------------------- src/dds_writer.vhd | 6 +- 2 files changed, 87 insertions(+), 66 deletions(-) diff --git a/src/dds_reader.vhd b/src/dds_reader.vhd index 3adfb80..f64da08 100644 --- a/src/dds_reader.vhd +++ b/src/dds_reader.vhd @@ -1663,7 +1663,7 @@ begin -- Wait for Instance Search to finish if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_STATUS_FLAG or IMF_IGNORE_DEADLINE_FLAG or IMF_SAMPLE_CNT_FLAG or IMF_DISPOSED_CNT_FLAG or IMF_NO_WRITERS_CNT_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_STATUS_FLAG or IMF_IGNORE_DEADLINE_FLAG or IMF_SAMPLE_CNT_FLAG or IMF_DISPOSED_CNT_FLAG or IMF_NO_WRITERS_CNT_FLAG)) severity FAILURE; -- Instance Found if (not WITH_KEY or inst_addr_base /= INSTANCE_MEMORY_MAX_ADDRESS) then @@ -1945,17 +1945,24 @@ begin -- Memory Flow Control Guard if (sample_ready_in = '1') then - cnt_next <= cnt + 1; + if (WITH_KEY) then + cnt_next <= cnt + 1; + else + cnt_next <= cnt + 2; -- Skip next Stage + end if; end if; -- GET Instance Pointer when 3 => - sample_valid_in <= '1'; - sample_addr <= cur_sample + SMF_INSTANCE_ADDR_OFFSET; - sample_read <= '1'; - - -- Memory Flow Control Guard - if (sample_ready_in = '1') then - cnt_next <= cnt + 1; + -- Synthesis Guard + if (WITH_KEY) then + sample_valid_in <= '1'; + sample_addr <= cur_sample + SMF_INSTANCE_ADDR_OFFSET; + sample_read <= '1'; + + -- Memory Flow Control Guard + if (sample_ready_in = '1') then + cnt_next <= cnt + 1; + end if; end if; -- READ Timestamp 1/2 when 4 => @@ -2001,51 +2008,58 @@ begin -- Memory Flow Control Guard if (sample_valid_out = '1') then prev_sample_next <= resize(unsigned(sample_read_data),SAMPLE_MEMORY_ADDR_WIDTH); - cnt_next <= cnt + 1; + if (WITH_KEY) then + cnt_next <= cnt + 1; + else + cnt_next <= cnt + 2; -- Skip next stage + end if; end if; -- READ Instance Poiner when 7 => - sample_ready_out <= '1'; - - -- Memory Flow Control Guard - if (sample_valid_out = '1') then - -- Sample has Same Instance - if (resize(unsigned(sample_read_data),INSTANCE_MEMORY_ADDR_WIDTH) = cur_inst) then - -- Newer Sample of same Instance found - newer_inst_sample_next <= '1'; - -- NOT_ALIVE Sample - if (sample_status_info(SSI_DISPOSED_FLAG) = '1' or sample_status_info(SSI_UNREGISTERED_FLAG) = '1') then - -- NOTE: We drop Dispose and Unregister Samples if a newer Sample of the same Instance exists, because else - -- the Instance State and Generation Counters would have to be recalculated (by crawling through all the Instance Samples) - -- Drop Sample - stage_next <= IDLE; - else - cnt_next <= cnt + 1; - end if; - else - -- No previous Slot (Oldest Sample) - if (prev_sample = PAYLOAD_MEMORY_MAX_ADDRESS) then - assert (cur_sample = oldest_sample) severity FAILURE; - - -- NOTE: Sample is added to HEAD of List - next_sample_next <= cur_sample; - cur_sample_next <= empty_sample_list_head; - if (new_inst = '1') then - if (has_data = '1') then - stage_next <= FINALIZE_PAYLOAD; - cnt_next <= 0; - else - stage_next <= PRE_SAMPLE_FINALIZE; - cnt_next <= 0; - end if; + -- Synthesis Guard + if (WITH_KEY) then + sample_ready_out <= '1'; + + -- Memory Flow Control Guard + if (sample_valid_out = '1') then + -- Sample has Same Instance + if (resize(unsigned(sample_read_data),INSTANCE_MEMORY_ADDR_WIDTH) = cur_inst) then + -- Newer Sample of same Instance found + newer_inst_sample_next <= '1'; + -- NOT_ALIVE Sample + if (sample_status_info(SSI_DISPOSED_FLAG) = '1' or sample_status_info(SSI_UNREGISTERED_FLAG) = '1') then + -- NOTE: We drop Dispose and Unregister Samples if a newer Sample of the same Instance exists, because else + -- the Instance State and Generation Counters would have to be recalculated (by crawling through all the Instance Samples) + -- Drop Sample + stage_next <= IDLE; else - stage_next <= UPDATE_INSTANCE; + cnt_next <= cnt + 1; end if; else - -- Continue Search - cur_sample_next <= prev_sample; - next_sample_next <= cur_sample; - cnt_next <= 0; + -- No previous Slot (Oldest Sample) + if (prev_sample = PAYLOAD_MEMORY_MAX_ADDRESS) then + assert (cur_sample = oldest_sample) severity FAILURE; + + -- NOTE: Sample is added to HEAD of List + next_sample_next <= cur_sample; + cur_sample_next <= empty_sample_list_head; + if (new_inst = '1') then + if (has_data = '1') then + stage_next <= FINALIZE_PAYLOAD; + cnt_next <= 0; + else + stage_next <= PRE_SAMPLE_FINALIZE; + cnt_next <= 0; + end if; + else + stage_next <= UPDATE_INSTANCE; + end if; + else + -- Continue Search + cur_sample_next <= prev_sample; + next_sample_next <= cur_sample; + cnt_next <= 0; + end if; end if; end if; end if; @@ -2106,7 +2120,7 @@ begin -- Memory Operation Guard if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_STATUS_FLAG or IMF_WRITER_BITMAP_FLAG or IMF_DISPOSED_CNT_FLAG or IMF_NO_WRITERS_CNT_FLAG or IMF_SAMPLE_CNT_FLAG or IMF_IGNORE_DEADLINE_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_STATUS_FLAG or IMF_WRITER_BITMAP_FLAG or IMF_DISPOSED_CNT_FLAG or IMF_NO_WRITERS_CNT_FLAG or IMF_SAMPLE_CNT_FLAG or IMF_IGNORE_DEADLINE_FLAG)) severity FAILURE; -- DEFAULT STATUS INFO (LIVELINESS) if (WITH_KEY) then @@ -2345,7 +2359,7 @@ begin -- Wait for instance Update to Complete if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_DISPOSED_CNT_FLAG or IMF_NO_WRITERS_CNT_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_DISPOSED_CNT_FLAG or IMF_NO_WRITERS_CNT_FLAG)) severity FAILURE; case (cnt) is -- SET Disposed Generation Counter @@ -2554,7 +2568,7 @@ begin -- Wait for Instane Data if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_DISPOSED_CNT_FLAG or IMF_NO_WRITERS_CNT_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_DISPOSED_CNT_FLAG or IMF_NO_WRITERS_CNT_FLAG)) severity FAILURE; case (cnt) is -- GET Next Sample (Empty List) @@ -2625,17 +2639,24 @@ begin -- Memory Flow Control Guard if (sample_ready_in = '1') then - cnt_next <= cnt + 1; + if (WITH_KEY) then + cnt_next <= cnt + 1; + else + cnt_next <= cnt + 2; -- Skip next Stage + end if; end if; -- SET Instance Pointer when 7 => - sample_valid_in <= '1'; - sample_addr <= cur_sample + SMF_INSTANCE_ADDR_OFFSET; - sample_write_data <= std_logic_vector(resize(cur_inst,WORD_WIDTH)); - - -- Memory Flow Control Guard - if (sample_ready_in = '1') then - cnt_next <= cnt + 1; + -- Synthesis Guard + if (WITH_KEY) then + sample_valid_in <= '1'; + sample_addr <= cur_sample + SMF_INSTANCE_ADDR_OFFSET; + sample_write_data <= std_logic_vector(resize(cur_inst,WORD_WIDTH)); + + -- Memory Flow Control Guard + if (sample_ready_in = '1') then + cnt_next <= cnt + 1; + end if; end if; -- SET Disposed Generation Count when 8 => @@ -3036,7 +3057,7 @@ begin -- Memory Operation Guard if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_SAMPLE_CNT_FLAG or IMF_WRITER_BITMAP_FLAG or IMF_STATUS_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_SAMPLE_CNT_FLAG or IMF_WRITER_BITMAP_FLAG or IMF_STATUS_FLAG)) severity FAILURE; -- Synthesis Guard if (WITH_KEY) then @@ -3440,8 +3461,8 @@ begin when 7 => -- Wait for Instance Data if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_STATUS_FLAG) severity FAILURE; - assert (next_inst = inst_addr_base) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_STATUS_FLAG)) severity FAILURE; + assert (not WITH_KEY or next_inst = inst_addr_base) severity FAILURE; -- DEFAULT tmp_bool := TRUE; @@ -4036,7 +4057,7 @@ begin when 2 => -- Memory Operation Guard if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_STATUS_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_STATUS_FLAG)) severity FAILURE; -- NOTE: If we have a presentation of consecutive same instance samples of multiple instances, we have to -- mark the instances we have already handled, in order to prevent the GET_NEXT_SAMPLE state to -- re-process them. diff --git a/src/dds_writer.vhd b/src/dds_writer.vhd index e57f076..4c94dcb 100644 --- a/src/dds_writer.vhd +++ b/src/dds_writer.vhd @@ -1625,7 +1625,7 @@ begin -- Wait for Instance Search to finish if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_SAMPLE_CNT_FLAG or IMF_ACK_CNT_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_SAMPLE_CNT_FLAG or IMF_ACK_CNT_FLAG)) severity FAILURE; -- Instance Found if (not WITH_KEY or inst_addr_base /= INSTANCE_MEMORY_MAX_ADDRESS) then @@ -1834,7 +1834,7 @@ begin -- Memory Operation Guard if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_STATUS_FLAG or IMF_SAMPLE_CNT_FLAG or IMF_ACK_CNT_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_STATUS_FLAG or IMF_SAMPLE_CNT_FLAG or IMF_ACK_CNT_FLAG)) severity FAILURE; -- Synthesis Guard if (WITH_KEY) then @@ -2536,7 +2536,7 @@ begin -- Memory Operation Guard if (not WITH_KEY or inst_op_done = '1') then - assert check_mask(current_imf, IMF_STATUS_FLAG or IMF_SAMPLE_CNT_FLAG or IMF_ACK_CNT_FLAG) severity FAILURE; + assert (not WITH_KEY or check_mask(current_imf, IMF_STATUS_FLAG or IMF_SAMPLE_CNT_FLAG or IMF_ACK_CNT_FLAG)) severity FAILURE; -- Synthesis Guard if (WITH_KEY) then