diff --git a/src/rtps_package.vhd b/src/rtps_package.vhd index b1de52a..d6309d4 100644 --- a/src/rtps_package.vhd +++ b/src/rtps_package.vhd @@ -485,6 +485,7 @@ package rtps_package is function "-" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; function min(L, R : DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; function max(L, R : DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; + function to_integer(dw : DOUBLE_WORD_ARRAY) return integer; end package; package body rtps_package is @@ -673,4 +674,9 @@ package body rtps_package is return ret; end function; + function to_integer(dw : DOUBLE_WORD_ARRAY) return integer is + begin + return to_integer(dw(0)); + end function; + end package body; diff --git a/src/rtps_reader.vhd b/src/rtps_reader.vhd index f9704a4..04d5496 100644 --- a/src/rtps_reader.vhd +++ b/src/rtps_reader.vhd @@ -2,6 +2,7 @@ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; +use work.math_pkg.all; use work.rtps_package.all; use work.user_config.all; use work.rtps_config_package.all; @@ -11,14 +12,15 @@ use work.rtps_config_package.all; entity rtps_reader is generic ( - RELIABILTY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := DEFAULT_RELIABILTY_QOS; - LIVELINESS_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := DEFAULT_LIVELINESS_QOS; - DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := DEFAULT_DURABILITY_QOS; - HEARTBEAT_RESPONSE_DELAY : DURATION_TYPE := TODO; - HEARTBEAT_SUPPRESSION_DELAY : DURATION_TYPE := TODO; - LEASE_DURATION : DURATION_TYPE := DEFAULT_LEASE_DURATION; - ENTITYID : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := ENTITYID_UNKNOWN; - WITH_KEY : boolean := FALSE -- TODO: Default + ENTITYID : std_logic_vector(ENTITYID_WIDTH-1 downto 0); + RELIABILTY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); + LIVELINESS_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); + DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); + HEARTBEAT_RESPONSE_DELAY : DURATION_TYPE; + HEARTBEAT_SUPPRESSION_DELAY : DURATION_TYPE; + LEASE_DURATION : DURATION_TYPE; + WITH_KEY : boolean; + MAX_REMOTE_ENDPOINTS : natural := 50 ); port ( -- SYSTEM @@ -45,7 +47,7 @@ entity rtps_reader is opcode_hc : out HISTORY_CACHE_OPCODE_TYPE; ack_hc : in std_logic; done_hc : in std_logic; - ret_hc : in HISTORY_CACHE_RESPOSNE_TYPE; + ret_hc : in HISTORY_CACHE_RESPONSE_TYPE; data_out_hc : out std_logic_vector(WORD_WIDTH-1 downto 0); valid_out_hc : out std_logic; ready_out_hc : in std_logic; @@ -57,8 +59,16 @@ architecture arch of rtps_reader is --*****CONSTANT DECLARATION***** -- *ENDPOINT MEMORY* + -- 4-Byte Word Size of a Participant Entry in Memory + function gen_frame_size(qos : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0)) return natural is + variable ret : natural := 0; + begin + ret := 12 when (qos = RELIABLE_RELIABILITY_QOS) else 8; + return ret; + end function; + constant ENDPOINT_FRAME_SIZE : natural := gen_frame_size(RELIABILTY_QOS); -- Endpoint Memory Size in 4-Byte Words - constant ENDPOINT_MEMORY_SIZE : natural := TODO; + constant ENDPOINT_MEMORY_SIZE : natural := MAX_REMOTE_ENDPOINTS * ENDPOINT_FRAME_SIZE; -- Endpoint Memory Address Width constant ENDPOINT_MEMORY_ADDR_WIDTH : natural := log2c(ENDPOINT_MEMORY_SIZE); -- Highest Endpoint Memory Address @@ -71,13 +81,13 @@ architecture arch of rtps_reader is -- *ENDPOINT MEMORY FORMAT FORMAT FLAGS* -- Flags mapping to the respective Endpoint Memory Frame Fields constant EMF_FLAG_WIDTH : natural := 7; - constant EMF_ENTITYID_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (0 => 1, others => '0'); - constant EMF_GUIDPREFIX_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (1 => 1, others => '0'); - constant EMF_IPV4_ADDR_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (2 => 1, others => '0'); - constant EMF_UDP_PORT_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (3 => 1, others => '0'); - constant EMF_NEXT_SEQ_NR_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (4 => 1, others => '0'); - constant EMF_LEASE_DEADLINE_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (5 => 1, others => '0'); - constant EMF_RES_TIME_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (6 => 1, others => '0'); + constant EMF_ENTITYID_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (0 => '1', others => '0'); + constant EMF_GUIDPREFIX_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (1 => '1', others => '0'); + constant EMF_IPV4_ADDR_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (2 => '1', others => '0'); + constant EMF_UDP_PORT_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (3 => '1', others => '0'); + constant EMF_NEXT_SEQ_NR_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (4 => '1', others => '0'); + constant EMF_LEASE_DEADLINE_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (5 => '1', others => '0'); + constant EMF_RES_TIME_FLAG : std_logic_vector(0 to EMF_FLAG_WIDTH-1) := (6 => '1', others => '0'); -- *ENDPOINT MEMORY FRAME FORMAT* -- 4-Byte Word Offsets to Beginning of Respective Fields in the Endpoint Memory Frame @@ -85,7 +95,13 @@ architecture arch of rtps_reader is constant EMF_GUIDPREFIX_OFFSET : natural := 1; constant EMF_IPV4_ADDR_OFFSET : natural := 4; constant EMF_UDP_PORT_OFFSET : natural := 5; - constant EMF_NEXT_SEQ_NR_OFFSET : natural := 6 when (RELIABILTY_QOS = RELIABLE_RELIABILITY_QOS) else EMF_GUIDPREFIX_OFFSET + 3; + function gen_emf_udp_port_offset(qos : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0)) return natural is + variable ret : natural := 0; + begin + ret := 6 when (qos = RELIABLE_RELIABILITY_QOS) else EMF_GUIDPREFIX_OFFSET + 3; + return ret; + end function; + constant EMF_NEXT_SEQ_NR_OFFSET : natural := gen_emf_udp_port_offset(RELIABILTY_QOS); constant EMF_LEASE_DEADLINE_OFFSET : natural := EMF_NEXT_SEQ_NR_OFFSET + 2; constant EMF_RES_TIME_OFFSET : natural := EMF_LEASE_DEADLINE_OFFSET + 2; @@ -156,6 +172,8 @@ architecture arch of rtps_reader is signal stage, stage_next : STAGE_TYPE := IDLE; -- FSM state latch. Used to transition dynamically to different states from the same state. signal return_stage, return_stage_next : STAGE_TYPE := IDLE; + -- Intermediate input read signal. (Read from output port not allowed) + signal rd_sig : std_logic := '0'; -- Signal used to reset the word counter signal reset_read_cnt : std_logic; -- Word (4-Byte) counter (Counts words read from input fifo) @@ -163,7 +181,7 @@ architecture arch of rtps_reader is -- Word aligned End of Parameter signal parameter_end, parameter_end_next : unsigned(PARAMETER_LENGTH_WIDTH-1 downto 0) := (others => '0'); -- General Purpose Counter - signal cnt, cnt_next : natural range TODO := 0; + signal cnt, cnt_next : natural range 0 to 9 := 0; -- Packet Opcode Latch (RTPS Message ID) signal opcode, opcode_next : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := (others => '0'); -- Metatraffic Opcode Latch @@ -241,13 +259,13 @@ architecture arch of rtps_reader is -- Highest Endpoint Memory Address (Points to first Address of last occupied Endpoint Frame) signal max_endpoint_addr, max_endpoint_addr_next : unsigned(ENDPOINT_MEMORY_ADDR_WIDTH-1 downto 0) := (others => '0'); -- General Purpose Couter - signal mem_cnt, mem_cnt_next : natural range TODO := 0; + signal mem_cnt, mem_cnt_next : natural range 0 to 23 := 0; -- Latch for Endpoint Data from Memory signal mem_endpoint_data, mem_endpoint_data_next : ENDPOINT_DATA_TYPE := ZERO_ENDPOINT_DATA; -- Latch for Endpoint Data from main process signal mem_endpoint_latch_data, mem_endpoint_latch_data_next : ENDPOINT_LATCH_DATA_TYPE := ZERO_ENDPOINT_LATCH_DATA; -- Position (In Endpoint Memory Frame Granularity) of current relevant Endpoint - signal mem_pos, mem_pos_next : natural range TODO := 0; + signal mem_pos, mem_pos_next : natural range 0 to MAX_REMOTE_ENDPOINTS-1 := 0; -- Signifies an abort of the currently initiated read transaction signal abort_read : std_logic := '0'; @@ -328,6 +346,7 @@ begin -- Big Endian Representation data_in_swapped <= endian_swap(endian_flag, data_in_user); + rd_user <= rd_sig; -- *Main State Machine* -- STATE DESCRIPTION @@ -402,9 +421,12 @@ begin start_hc <= '0'; valid_out_hc <= '0'; last_word_out_hc <= '0'; + wr_rtps <= '0'; + last_word_out_rtps <= '0'; rd_guard := '0'; mem_field_flags <= (others => '0'); data_out_hc <= (others => '0'); + data_out_rtps <= (others => '0'); @@ -413,7 +435,7 @@ begin last_word_in_latch_next <= '1'; end if; - case (meta_stage) is + case (stage) is when IDLE => -- RESET lifespan_next <= TIME_INVALID; @@ -524,13 +546,15 @@ begin else stage_next <= LATCH_ENTITYID; end if; + when others => + null; end case; end if; when LATCH_ENTITYID => -- Input FIFO Guard if ((is_meta = '1' and empty_meta = '0') or (is_meta = '0' and empty_user = '0')) then if (is_meta = '1') then - assert (meta_opcode /= OPCODE_ENDPOINT_UNMATCH or (meta_opcode = OPCODE_ENDPOINT_UNMATCH and last_word_in_meta = '1')) "last_word_in_meta not set" severity FAILURE; + assert (meta_opcode /= OPCODE_ENDPOINT_UNMATCH or (meta_opcode = OPCODE_ENDPOINT_UNMATCH and last_word_in_meta = '1')) report "last_word_in_meta not set" severity FAILURE; rd_meta <= '1'; guid_next(3) <= data_in_meta; -- Memory Operation Guard @@ -619,7 +643,7 @@ begin when 1 => assert (last_word_in_meta = '1') report "last_word_in_meta not set" severity FAILURE; - portn_next <= data_in_meta(WORD_WIDTH-1 downto WORD_WIDTH-UDP_PORT_WIDTH-1); + portn_next <= data_in_meta(WORD_WIDTH-1 downto WORD_WIDTH-UDP_PORT_WIDTH); stage_next <= METATRAFFIC_OPERATION; when others => @@ -639,7 +663,7 @@ begin -- Update the Endpoint Data -- NOTE: The Lease Duration is NOT updated in case of an update. That is the responsibility of the Liveliness Update mem_op_start <= '1'; - mem_opcode <= UDPATE_ENDPOINT; + mem_opcode <= UPDATE_ENDPOINT; mem_field_flags <= EMF_IPV4_ADDR_FLAG or EMF_UDP_PORT_FLAG; end if; -- DONE @@ -726,7 +750,7 @@ begin if (guid(0) = mem_endpoint_data.guid(0) and guid(1) = mem_endpoint_data.guid(1) and guid(2) = mem_endpoint_data.guid(2)) then -- Renew Lease of Remote Endpoint mem_op_start <= '1'; - mem_opcode <= UDPATE_ENDPOINT; + mem_opcode <= UPDATE_ENDPOINT; mem_field_flags <= EMF_LEASE_DEADLINE_FLAG; if (LEASE_DURATION /= DURATION_INFINITE) then lease_deadline <= time + LEASE_DURATION; @@ -904,7 +928,7 @@ begin next_seq_nr_next <= first_seq_nr; mem_op_start <= '1'; mem_opcode <= UPDATE_ENDPOINT; - tmp_flags <= tmp_flags or EMF_NEXT_SEQ_NR_FLAG; + tmp_flags := tmp_flags or EMF_NEXT_SEQ_NR_FLAG; end if; end if; @@ -1200,7 +1224,7 @@ begin -- Timestamp 1/2 when 1 => valid_out_hc <= '1'; - data_out_hc <= ts(0); + data_out_hc <= std_logic_vector(ts(0)); -- Output Guard if (ready_out_hc = '1') then cnt_next <= cnt + 1; @@ -1208,7 +1232,7 @@ begin -- Timestamp 2/2 when 2 => valid_out_hc <= '1'; - data_out_hc <= ts(1); + data_out_hc <= std_logic_vector(ts(1)); -- Output Guard if (ready_out_hc = '1') then cnt_next <= cnt + 1; @@ -1216,7 +1240,7 @@ begin -- Lifespan Deadline 1/2 when 3 => valid_out_hc <= '1'; - data_out_hc <= lifespan(0); + data_out_hc <= std_logic_vector(lifespan(0)); -- Output Guard if (ready_out_hc = '1') then cnt_next <= cnt + 1; @@ -1224,7 +1248,7 @@ begin -- Lifespan Deadline 2/2 when 4 => valid_out_hc <= '1'; - data_out_hc <= lifespan(1); + data_out_hc <= std_logic_vector(lifespan(1)); -- Output Guard if (ready_out_hc = '1') then -- Skip Key Hash, if not received @@ -1378,7 +1402,7 @@ begin mem_op_start <= '1'; mem_opcode <= UPDATE_ENDPOINT; res_time <= TIME_INVALID; - mem_field_flags <= RES_TIME_FLAG; + mem_field_flags <= EMF_RES_TIME_FLAG; -- Continue Search cnt_next <= 0; -- If Response Delay Passed @@ -1425,8 +1449,8 @@ begin res_time <= TIME_INVALID; end if; mem_op_start <= '1'; - mem_opcode <= UPDATE_PARTICIPANT; - mem_field_flags <= RES_TIME_FLAG; + mem_opcode <= UPDATE_ENDPOINT; + mem_field_flags <= EMF_RES_TIME_FLAG; -- Send ACKNACK -- Increment Acknack Counter @@ -1444,7 +1468,7 @@ begin if (RELIABILTY_QOS = RELIABLE_RELIABILITY_QOS) then -- Output FIFO Guard if (full_rtps = '0') then - wr_sig <= '1'; + wr_rtps <= '1'; cnt_next <= cnt + 1; case (cnt) is @@ -1482,7 +1506,7 @@ begin if (RELIABILTY_QOS = RELIABLE_RELIABILITY_QOS) then -- Output FIFO Guard if (full_rtps = '0') then - wr_sig <= '1'; + wr_rtps <= '1'; cnt_next <= cnt + 1; case (cnt) is @@ -1542,7 +1566,7 @@ begin elsif ((read_cnt & "00" ) >= parameter_end) then -- Parse Next Parameter -- NOTE: data_in_user is already showing the next parameter - stage_next <= PROCESS_PL; + stage_next <= PROCESS_INLINE_QOS; -- Reset Parameter End parameter_end_next <= (others => '1'); -- Input FIFO Guard @@ -1630,7 +1654,6 @@ begin last_addr_next <= last_addr; mem_addr_latch_next <= mem_addr_latch; mem_endpoint_data_next <= mem_endpoint_data; - mem_guidprefix_next <= mem_guidprefix; max_endpoint_addr_next <= max_endpoint_addr; mem_endpoint_latch_data_next <= mem_endpoint_latch_data; mem_pos_next <= mem_pos; @@ -1673,15 +1696,15 @@ begin mem_cnt_next <= 0; when UPDATE_ENDPOINT => mem_stage_next <= UPDATE_ENDPOINT; - if (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags.field_flag,EMF_IPV4_ADDR_FLAG)) then + if (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags,EMF_IPV4_ADDR_FLAG)) then mem_cnt_next <= 0; - elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags.field_flag,EMF_UDP_PORT_FLAG)) then + elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags,EMF_UDP_PORT_FLAG)) then mem_cnt_next <= 1; - elsif check_mask(mem_field_flags.field_flag,EMF_NEXT_SEQ_NR_FLAG) then + elsif check_mask(mem_field_flags,EMF_NEXT_SEQ_NR_FLAG) then mem_cnt_next <= 2; - elsif check_mask(mem_field_flags.field_flag,EMF_LEASE_DEADLINE_FLAG) then + elsif check_mask(mem_field_flags,EMF_LEASE_DEADLINE_FLAG) then mem_cnt_next <= 4; - elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags.field_flag,EMF_RES_TIME_FLAG)) then + elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags,EMF_RES_TIME_FLAG)) then mem_cnt_next <= 6; else -- DONE @@ -1710,19 +1733,19 @@ begin -- Fetch Endpoint Data mem_stage_next <= GET_ENDPOINT_DATA; mem_endpoint_data_next <= ZERO_ENDPOINT_DATA; - if check_mask(mem_field_flags.field_flag,EMF_ENTITYID_FLAG) then + if check_mask(mem_field_flags,EMF_ENTITYID_FLAG) then mem_cnt_next <= 0; - elsif check_mask(mem_field_flags.field_flag,EMF_GUIDPREFIX_FLAG) then + elsif check_mask(mem_field_flags,EMF_GUIDPREFIX_FLAG) then mem_cnt_next <= 1; - elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags.field_flag,EMF_IPV4_ADDR_FLAG)) then + elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags,EMF_IPV4_ADDR_FLAG)) then mem_cnt_next <= 4; - elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags.field_flag,EMF_UDP_PORT_FLAG)) then + elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags,EMF_UDP_PORT_FLAG)) then mem_cnt_next <= 5; - elsif check_mask(mem_field_flags.field_flag,EMF_NEXT_SEQ_NR_FLAG) then + elsif check_mask(mem_field_flags,EMF_NEXT_SEQ_NR_FLAG) then mem_cnt_next <= 6; - elsif check_mask(mem_field_flags.field_flag,EMF_LEASE_DEADLINE_FLAG) then + elsif check_mask(mem_field_flags,EMF_LEASE_DEADLINE_FLAG) then mem_cnt_next <= 8; - elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags.field_flag,EMF_RES_TIME_FLAG)) then + elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_field_flags,EMF_RES_TIME_FLAG)) then mem_cnt_next <= 10; else -- DONE @@ -1971,7 +1994,7 @@ begin mem_cnt_next <= 6; elsif check_mask(mem_endpoint_latch_data.field_flag,EMF_LEASE_DEADLINE_FLAG) then mem_cnt_next <= 8; - elsif (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS) and check_mask(mem_endpoint_latch_data.field_flag,EMF_RES_TIME_FLAG)) then + elsif ((RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS) and check_mask(mem_endpoint_latch_data.field_flag,EMF_RES_TIME_FLAG)) then mem_cnt_next <= 10; else if check_mask(mem_endpoint_latch_data.field_flag,EMF_ENTITYID_FLAG) then @@ -2212,7 +2235,7 @@ begin mem_ready_out <= '1'; -- Memory Flow Control Guard if (mem_valid_out = '1') then - mem_endpoint_data_next.portn <= mem_read_data; + mem_endpoint_data_next.portn <= mem_read_data(WORD_WIDTH-1 downto WORD_WIDTH-UDP_PORT_WIDTH); if check_mask(mem_endpoint_latch_data.field_flag,EMF_NEXT_SEQ_NR_FLAG) then mem_cnt_next <= 18; @@ -2231,7 +2254,7 @@ begin mem_ready_out <= '1'; -- Memory Flow Control Guard if (mem_valid_out = '1') then - mem_endpoint_data_next.next_seq_nr(0) <= mem_read_data; + mem_endpoint_data_next.next_seq_nr(0) <= unsigned(mem_read_data); mem_cnt_next <= mem_cnt + 1; end if; @@ -2240,7 +2263,7 @@ begin mem_ready_out <= '1'; -- Memory Flow Control Guard if (mem_valid_out = '1') then - mem_endpoint_data_next.next_seq_nr(1) <= mem_read_data; + mem_endpoint_data_next.next_seq_nr(1) <= unsigned(mem_read_data); if check_mask(mem_endpoint_latch_data.field_flag,EMF_LEASE_DEADLINE_FLAG) then mem_cnt_next <= 20; @@ -2256,7 +2279,7 @@ begin mem_ready_out <= '1'; -- Memory Flow Control Guard if (mem_valid_out = '1') then - mem_endpoint_data_next.lease_deadline(0) <= mem_read_data; + mem_endpoint_data_next.lease_deadline(0) <= unsigned(mem_read_data); mem_cnt_next <= mem_cnt + 1; end if; @@ -2265,7 +2288,7 @@ begin mem_ready_out <= '1'; -- Memory Flow Control Guard if (mem_valid_out = '1') then - mem_endpoint_data_next.addr <= mem_read_data; + mem_endpoint_data_next.lease_deadline(1) <= unsigned(mem_read_data); if (RELIABILTY_QOS /= RELIABLE_RELIABILITY_QOS and check_mask(mem_endpoint_latch_data.field_flag,EMF_RES_TIME_FLAG)) then mem_cnt_next <= 22; @@ -2281,7 +2304,7 @@ begin mem_ready_out <= '1'; -- Memory Flow Control Guard if (mem_valid_out = '1') then - mem_endpoint_data_next.res_time(0) <= mem_read_data; + mem_endpoint_data_next.res_time(0) <= unsigned(mem_read_data); mem_cnt_next <= mem_cnt + 1; end if; @@ -2293,7 +2316,7 @@ begin mem_ready_out <= '1'; -- Memory Flow Control Guard if (mem_valid_out = '1') then - mem_endpoint_data_next.res_time(1) <= mem_read_data; + mem_endpoint_data_next.res_time(1) <= unsigned(mem_read_data); -- DONE mem_stage_next <= IDLE; @@ -2362,7 +2385,7 @@ begin when 6 => mem_valid_in <= '1'; mem_addr <= mem_addr_base + EMF_NEXT_SEQ_NR_OFFSET; - mem_write_data <= SEQUENCENUMBER_UNKNOWN(0) when (DURABILITY_QOS = VOLATILE_DURABILITY_QOS) else FIRST_SEQUENCENUMBER(0); + mem_write_data <= std_logic_vector(SEQUENCENUMBER_UNKNOWN(0)) when (DURABILITY_QOS = VOLATILE_DURABILITY_QOS) else std_logic_vector(FIRST_SEQUENCENUMBER(0)); if (mem_ready_in = '1') then mem_cnt_next <= mem_cnt + 1; end if; @@ -2371,7 +2394,7 @@ begin mem_write_data <= (others => '0'); mem_valid_in <= '1'; mem_addr <= mem_addr_base + EMF_NEXT_SEQ_NR_OFFSET + 1; - mem_write_data <= SEQUENCENUMBER_UNKNOWN(1) when (DURABILITY_QOS = VOLATILE_DURABILITY_QOS) else FIRST_SEQUENCENUMBER(1); + mem_write_data <= std_logic_vector(SEQUENCENUMBER_UNKNOWN(1)) when (DURABILITY_QOS = VOLATILE_DURABILITY_QOS) else std_logic_vector(FIRST_SEQUENCENUMBER(1)); if (mem_ready_in = '1') then mem_cnt_next <= mem_cnt + 1; end if; @@ -2475,7 +2498,7 @@ begin mem_addr <= mem_addr_base + EMF_NEXT_SEQ_NR_OFFSET; mem_write_data <= std_logic_vector(mem_endpoint_latch_data.next_seq_nr(0)); -- Memory Flow Control Guard - if (mem_ready_in = '1') + if (mem_ready_in = '1') then mem_cnt_next <= mem_cnt + 1; end if; -- Next Sequence Number 2/2 @@ -2548,7 +2571,7 @@ begin when others => null; end case; - when REMOVE_ENDPOINT => + when REMOVE_ENDPOINT => -- Mark with ENTITYID_UNKNOWN to mark slot empty_user mem_valid_in <= '1'; mem_addr <= mem_addr_base + EMF_ENTITYID_OFFSET; @@ -2781,4 +2804,80 @@ begin end if; end process; + sync_prc : process(clk) + begin + if rising_edge(clk) then + if (reset = '1') then + stage <= IDLE; + return_stage <= IDLE; + mem_stage <= RESET_MEMORY; + seq_nr <= SEQUENCENUMBER_UNKNOWN; + sn_latch_1 <= SEQUENCENUMBER_UNKNOWN; + sn_latch_2 <= SEQUENCENUMBER_UNKNOWN; + sn_latch_3 <= SEQUENCENUMBER_UNKNOWN; + ts <= TIME_INVALID; + check_time <= TIME_INVALID; + lifespan <= TIME_INVALID; + guid <= GUID_UNKNOWN; + addr <= IPv4_ADDRESS_INVALID; + portn <= UDP_PORT_INVALID; + mem_endpoint_data <= ZERO_ENDPOINT_DATA; + mem_endpoint_latch_data <= ZERO_ENDPOINT_LATCH_DATA; + cnt <= 0; + cnt2 <= 0; + bitmap_pos <= 0; + mem_cnt <= 0; + mem_pos <= 0; + is_meta <= '0'; + key_hash_rcvd <= '0'; + last_word_in_latch <= '0'; + stale_check <= '0'; + meta_opcode <= (others => '0'); + status_info <= (others => '0'); + mem_addr_base <= (others => '0'); + last_addr <= (others => '0'); + mem_addr_latch <= (others => '0'); + max_endpoint_addr <= (others => '0'); + flags <= (others => '0'); + opcode <= (others => '0'); + count <= (others => '0'); + key_hash <= (others => (others => '0')); + else + stage <= stage_next; + return_stage <= return_stage_next; + mem_stage <= mem_stage_next; + seq_nr <= seq_nr_next; + sn_latch_1 <= sn_latch_1_next; + sn_latch_2 <= sn_latch_2_next; + sn_latch_3 <= sn_latch_3_next; + ts <= ts_next; + check_time <= check_time_next; + lifespan <= lifespan_next; + guid <= guid_next; + addr <= addr_next; + portn <= portn_next; + mem_endpoint_data <= mem_endpoint_data_next; + mem_endpoint_latch_data <= mem_endpoint_latch_data_next; + cnt <= cnt_next; + cnt2 <= cnt2_next; + bitmap_pos <= bitmap_pos_next; + mem_cnt <= mem_cnt_next; + mem_pos <= mem_pos_next; + is_meta <= is_meta_next; + key_hash_rcvd <= key_hash_rcvd_next; + last_word_in_latch <= last_word_in_latch_next; + stale_check <= stale_check_next; + meta_opcode <= meta_opcode_next; + status_info <= status_info_next; + mem_addr_base <= mem_addr_base_next; + last_addr <= last_addr_next; + mem_addr_latch <= mem_addr_latch_next; + max_endpoint_addr <= max_endpoint_addr_next; + flags <= flags_next; + opcode <= opcode_next; + count <= count_next; + key_hash <= key_hash_next; + end if; + end if; + end process; end architecture; \ No newline at end of file