diff --git a/src/rtps_builtin_endpoint.vhd b/src/rtps_builtin_endpoint.vhd index b40137c..7e7c300 100644 --- a/src/rtps_builtin_endpoint.vhd +++ b/src/rtps_builtin_endpoint.vhd @@ -3133,19 +3133,33 @@ begin when 2 => -- No Match if (mem_read_data /= guid(1)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + -- Reached End of Memory, No Match + if (mem_addr_base = max_participant_addr) then + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; -- GUID Prefix 3/3 when 3 => -- No Match if (mem_read_data /= guid(2)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + -- Reached End of Memory, No Match + if (mem_addr_base = max_participant_addr) then + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; -- Match else -- Fetch Participant Data @@ -3562,23 +3576,69 @@ begin when 2 => -- Slot Occupied if (mem_read_data /= GUIDPREFIX_UNKNOWN(1)) then - -- Latch last occupied Participant Slot - last_addr_next <= mem_addr_base; - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + if (mem_addr_base = max_participant_addr) then + -- We are in the middle of resetting the MAX Participant Pointer + if (reset_max_pointer = '1') then + -- No Change + mem_stage_next <= IDLE; + -- MEMORY FULL + elsif (max_participant_addr = MAX_PARTICIPANT_ADDRESS) then + report "Memory Full, Ignoring Participant Data" severity NOTE; + -- Ignore Insertion + mem_stage_next <= IDLE; + addr_res_next <= MAX_ADDRESS; + else + -- Extend Participant Memory Area + -- NOTE: "max_participant_addr" points to the first address of last participant frame + max_participant_addr_next <= tmp; + -- Populate Participant Slot + mem_stage_next <= INSERT_PARTICIPANT; + mem_addr_next <= tmp; + addr_res_next <= tmp; + mem_cnt_next <= 0; + end if; + else + -- Latch last occupied Participant Slot + last_addr_next <= mem_addr_base; + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; -- GUID Prefix 3/3 when 3 => -- Slot Occupied if (mem_read_data /= GUIDPREFIX_UNKNOWN(2)) then - -- Latch last occupied Participant Slot - last_addr_next <= mem_addr_base; - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + if (mem_addr_base = max_participant_addr) then + -- We are in the middle of resetting the MAX Participant Pointer + if (reset_max_pointer = '1') then + -- No Change + mem_stage_next <= IDLE; + -- MEMORY FULL + elsif (max_participant_addr = MAX_PARTICIPANT_ADDRESS) then + report "Memory Full, Ignoring Participant Data" severity NOTE; + -- Ignore Insertion + mem_stage_next <= IDLE; + addr_res_next <= MAX_ADDRESS; + else + -- Extend Participant Memory Area + -- NOTE: "max_participant_addr" points to the first address of last participant frame + max_participant_addr_next <= tmp; + -- Populate Participant Slot + mem_stage_next <= INSERT_PARTICIPANT; + mem_addr_next <= tmp; + addr_res_next <= tmp; + mem_cnt_next <= 0; + end if; + else + -- Latch last occupied Participant Slot + last_addr_next <= mem_addr_base; + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; -- Slot Empty else if (reset_max_pointer = '1') then