From 5b8206d5390e042a85accb75f2779760ee4c8675 Mon Sep 17 00:00:00 2001 From: Greek Date: Tue, 2 Feb 2021 23:07:34 +0100 Subject: [PATCH] Modify Lifespan Checktime Make the time, at which the Lifespan of samples is checked dependant on the actual Lifespans. This should prevent unnecessary memory bandwidth waste. --- src/dds_reader.vhd | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/dds_reader.vhd b/src/dds_reader.vhd index ea39838..5b88e4f 100644 --- a/src/dds_reader.vhd +++ b/src/dds_reader.vhd @@ -269,6 +269,8 @@ architecture arch of dds_reader is signal key_hash, key_hash_next : KEY_HASH_TYPE := (others => (others => '0')); -- Source Timestamp Latch signal ts_latch, ts_latch_next : TIME_TYPE := TIME_INVALID; + -- Lifespan Latch + signal lifespan, lifespan_next : TIME_TYPE := TIME_INVALID; -- Sample Status Info Latch signal sample_status_info, sample_status_info_next : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := (others => '0'); -- General Purpose Payload Pointer @@ -611,6 +613,7 @@ begin is_lifespan_check_next <= is_lifespan_check; status_sig_next <= status_sig; cnt2_next <= cnt2; + lifespan_next <= lifespan; -- DEFAULT Unregistered inst_opcode <= NOP; res_rtps <= UNDEFINED; @@ -662,7 +665,7 @@ begin -- LIFESPAN QoS elsif (lifespan_time <= time) then -- Reset Timeout - lifespan_time_next <= time + TODO; + lifespan_time_next <= TIME_INFINITE; -- Samples Available if (oldest_sample /= SAMPLE_MEMORY_MAX_ADDRESS) then @@ -879,11 +882,13 @@ begin end if; end if; end if; - -- Lifespane Deadline 1/2 + -- Lifespan Deadline 1/2 when 3 => sample_valid_in <= '1'; sample_addr <= cur_sample + SMF_LIFESPAN_DEADLINE_OFFSET; sample_write_data <= data_in_rtps; + -- Latch Lifespan + lifespan_next(0) <= data_in_rtps; -- Memory Flow Control Guard if (sample_ready_in = '1') then ready_in_rtps <= '1'; @@ -894,6 +899,8 @@ begin sample_valid_in <= '1'; sample_addr <= cur_sample + SMF_LIFESPAN_DEADLINE_OFFSET + 1; sample_write_data <= data_in_rtps; + -- Latch Lifespan + lifespan_next(1) <= data_in_rtps; -- Memory Flow Control Guard if (sample_ready_in = '1') then ready_in_rtps <= '1'; @@ -1661,6 +1668,11 @@ begin -- Signal Data Available status_sig_next(DATA_AVAILABLE_STATUS) <= '1'; + -- Update Lifespan Check Time + if (lifespan /= TIME_INVALID and lifespan < lifespan_time) then + lifespan_next <= lifespan; + end if; + -- NOTE: added_new_instance and remove_oldest_sample are NOT mutual exclusive, but Instance Removal takes precedence. -- New Instance was added, and Instance Memory is Full @@ -3236,17 +3248,23 @@ begin -- Sample Lifespan Expired if (tmp_dw /= TIME_INVALID and time >= tmp_dw) then -- Remove Sample - stage_next <= REMOVE_SAMPLE; - cnt_next <= 0; + stage_next <= REMOVE_SAMPLE; + cnt_next <= 0; else + + -- Update Check Time + if (tmp_dw /= TIME_INVALID and tmp_dw < lifespan_time) then + lifespan_time_next <= tmp_dw; + end if; + -- Reached End of Samples if (next_sample = SAMPLE_MEMORY_MAX_ADDRESS) then -- DONE stage_next <= IDLE; else -- Continue Search - cur_sample_next <= next_sample; - cnt_next <= 0; + cur_sample_next <= next_sample; + cnt_next <= 0; end if; end if; end if;