diff --git a/src/rtps_handler.vhd b/src/rtps_handler.vhd index f368d02..c4a4fde 100644 --- a/src/rtps_handler.vhd +++ b/src/rtps_handler.vhd @@ -174,20 +174,6 @@ architecture arch of rtps_handler is return tmp; end function; - -- Compares argument 'ref' with every element of 'ar', and returns the index of the last match. - -- If no match is found, array length is returned. - function match_id_endpoint (ref : std_logic_vector(ENTITYID_WIDTH-1 downto 0); ar : ENTITYID_TYPE) return natural is - variable id : natural := 0; - begin - id := ar'length; - for i in 0 to ar'length-1 loop - if(ref = ar(i)) then - id := i; - end if; - end loop; - return id; - end function; - begin -- ALIAS SUBSTITUTION @@ -279,8 +265,7 @@ begin -- SKIP_SUB Skip rest of Submessage -- SKIP_PACKET Skip rest of UDP Packet parse_prc: process(all) - variable tmp : natural range 0 to MAX_ENDPOINTS := 0; - variable tmp_length : std_logic_vector(15 downto 0) := (others => '0'); + variable tmp : std_logic_vector(0 to MAX_ENDPOINTS-1) := (others => '0'); variable dest : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0'); begin --DEFAULT Registered @@ -893,17 +878,27 @@ begin builtin_endpoint_next <= '1'; -- Match User Entity ID elsif (is_metatraffic = '0') then - tmp := match_id_endpoint(dest, ENTITYID); + + tmp := (others => '0'); + + for i in 0 to ENTITYID'length-1 loop + if (dest = ENTITYID(i)) then + tmp(i) := '1'; + end if; + end loop; + -- Entity non existent, skip Submessage - if (tmp = MAX_ENDPOINTS) then + if (tmp = (tmp'range => '0')) then stage_next <= SKIP_SUB; -- Entity ID Match else -- SANITY CHECK: Allow only Reader-Writer Communication - if ((src_is_reader xor ENDPOINT_READERS(tmp)) = '0') then - user_endpoint_next(tmp) <= '1'; + if (src_is_reader = '1') then + -- Mark only Writers + user_endpoint_next <= tmp and (not ENDPOINT_READERS); else - stage_next <= SKIP_SUB; + -- Mark only Readers + user_endpoint_next <= tmp and ENDPOINT_READERS; end if; end if; -- Destination Unreachable, skip Submessage diff --git a/syn/DE10-Nano/top.qsf b/syn/DE10-Nano/top.qsf index 17cebf9..25d2544 100644 --- a/syn/DE10-Nano/top.qsf +++ b/syn/DE10-Nano/top.qsf @@ -38,7 +38,7 @@ set_global_assignment -name FAMILY "Cyclone V" set_global_assignment -name DEVICE 5CSEBA6U23I7 -set_global_assignment -name TOP_LEVEL_ENTITY test +set_global_assignment -name TOP_LEVEL_ENTITY rtps_handler set_global_assignment -name ORIGINAL_QUARTUS_VERSION 18.1.0 set_global_assignment -name PROJECT_CREATION_TIME_DATE "12:05:11 MAY 29, 2020" set_global_assignment -name LAST_QUARTUS_VERSION "18.1.0 Lite Edition"