From a9eb56d6e58b7000a860c37f4cc016d73e1f4161 Mon Sep 17 00:00:00 2001 From: Greek Date: Tue, 2 Mar 2021 13:57:22 +0100 Subject: [PATCH] Change HC Operation Handshake Behaviour --- .../Level_0/L0_rtps_reader_test1_vbk.vhd | 43 +++++++++++------ .../Level_0/L0_rtps_reader_test1_vrk.vhd | 47 ++++++++++++------- .../Level_0/L0_rtps_reader_test2_tbk.vhd | 37 ++++++++------- .../Level_0/L0_rtps_reader_test2_trk.vhd | 37 ++++++++------- .../Level_0/L0_rtps_reader_test2_vbk.vhd | 37 ++++++++------- .../Level_0/L0_rtps_reader_test2_vrk.vhd | 37 ++++++++------- .../Level_0/L0_rtps_reader_test2_vrn.vhd | 37 ++++++++------- src/Tests/Level_0/L0_rtps_reader_test3_a.vhd | 37 ++++++++------- src/Tests/Level_0/L0_rtps_reader_test3_m.vhd | 37 ++++++++------- src/rtps_reader.vhd | 5 -- 10 files changed, 200 insertions(+), 154 deletions(-) diff --git a/src/Tests/Level_0/L0_rtps_reader_test1_vbk.vhd b/src/Tests/Level_0/L0_rtps_reader_test1_vbk.vhd index cf13214..0d3384d 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test1_vbk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test1_vbk.vhd @@ -30,6 +30,7 @@ architecture testbench of L0_rtps_reader_test1_vbk is -- *TYPE DECLARATION* type TEST_STAGE_TYPE is (IDLE, BUSY); + type CHECK_STAGE_TYPE is (IDLE, RESPONSE); type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_B)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); -- *SIGNAL DECLARATION* @@ -40,6 +41,7 @@ architecture testbench of L0_rtps_reader_test1_vbk is signal opcode_hc : HISTORY_CACHE_OPCODE_TYPE := NOP; signal ret_hc : HISTORY_CACHE_RESPONSE_TYPE := OK; signal stim_stage : TEST_STAGE_TYPE := IDLE; + signal check_stage : CHECK_STAGE_TYPE := IDLE; shared variable stimulus, reference : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; signal packet_sent : std_logic := '0'; signal cnt_stim : natural := 0; @@ -424,21 +426,34 @@ begin out_check_prc : process(all) begin if rising_edge(clk) then - done_hc <= done_hc_delay; - if (start_hc = '1') then - ack_hc <= '1'; - done_hc_delay <= '1'; - case (opcode_hc) is - when REMOVE_WRITER => - SB_out.check(data_out_hc); - when others => - Alert("Unexpected HC Opcode", ERROR); - end case; - else - ack_hc <= '0'; - done_hc_delay <= '0'; - end if; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + case (opcode_hc) is + when REMOVE_WRITER => + SB_out.check(data_out_hc); + when others => + Alert("Unexpected HC Opcode", ERROR); + end case; + check_stage <= RESPONSE; + end if; + when RESPONSE => + check_stage <= IDLE; + end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when RESPONSE => + done_hc <= '1'; + ret_hc <= OK; + end case; end process; mem_check_prc : process diff --git a/src/Tests/Level_0/L0_rtps_reader_test1_vrk.vhd b/src/Tests/Level_0/L0_rtps_reader_test1_vrk.vhd index 9358c7c..8c24ea5 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test1_vrk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test1_vrk.vhd @@ -29,7 +29,8 @@ architecture testbench of L0_rtps_reader_test1_vrk is constant MAX_REMOTE_ENDPOINTS : natural := 3; -- *TYPE DECLARATION* - type TEST_STAGE_TYPE is (IDLE, BUSY); + type SEND_STAGE_TYPE is (IDLE, BUSY); + type CHECK_STAGE_TYPE is (IDLE, RESPONSE); type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_A)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); -- *SIGNAL DECLARATION* @@ -39,7 +40,8 @@ architecture testbench of L0_rtps_reader_test1_vrk is signal start_hc, ack_hc, done_hc, done_hc_delay : std_logic := '0'; signal opcode_hc : HISTORY_CACHE_OPCODE_TYPE := NOP; signal ret_hc : HISTORY_CACHE_RESPONSE_TYPE := OK; - signal stim_stage : TEST_STAGE_TYPE := IDLE; + signal stim_stage : SEND_STAGE_TYPE := IDLE; + signal check_stage : CHECK_STAGE_TYPE := IDLE; shared variable stimulus, reference : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; signal packet_sent : std_logic := '0'; signal cnt_stim : natural := 0; @@ -424,21 +426,34 @@ begin out_check_prc : process(all) begin if rising_edge(clk) then - done_hc <= done_hc_delay; - if (start_hc = '1') then - ack_hc <= '1'; - done_hc_delay <= '1'; - case (opcode_hc) is - when REMOVE_WRITER => - SB_out.check(data_out_hc); - when others => - Alert("Unexpected HC Opcode", ERROR); - end case; - else - ack_hc <= '0'; - done_hc_delay <= '0'; - end if; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + case (opcode_hc) is + when REMOVE_WRITER => + SB_out.check(data_out_hc); + when others => + Alert("Unexpected HC Opcode", ERROR); + end case; + check_stage <= RESPONSE; + end if; + when RESPONSE => + check_stage <= IDLE; + end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when RESPONSE => + done_hc <= '1'; + ret_hc <= OK; + end case; end process; mem_check_prc : process diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_tbk.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_tbk.vhd index 8d28936..ea3c82f 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_tbk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_tbk.vhd @@ -1296,13 +1296,8 @@ begin if rising_edge(clk) then case (check_stage) is when IDLE => - ack_hc <= '0'; - done_hc <= '0'; - ready_out_hc <= '0'; - ret_hc <= ERROR; out_check_done <= '0'; if (start_hc = '1') then - ack_hc <= '1'; check_stage <= CHECK; case (opcode_hc) is when ADD_CACHE_CHANGE => @@ -1313,30 +1308,38 @@ begin end case; end if; when CHECK => - ack_hc <= '0'; - ready_out_hc <= '1'; - out_check_done <= '0'; if (valid_out_hc = '1') then SB_out.Check(last_word_out_hc & data_out_hc); if (last_word_out_hc = '1') then - ready_out_hc <= '0'; check_stage <= RESPONSE; end if; end if; when RESPONSE => - ack_hc <= '0'; - ready_out_hc <= '0'; - done_hc <= '1'; - if (accept = ACCEPT_RES) then - ret_hc <= OK; - else - ret_hc <= REJECTED; - end if; check_stage <= IDLE; out_check_done <= '1'; end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + ready_out_hc <= '0'; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when CHECK => + ready_out_hc <= '1'; + when RESPONSE => + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + end case; end process; watchdog : process diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_trk.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_trk.vhd index fbefaf0..35a5213 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_trk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_trk.vhd @@ -1305,13 +1305,8 @@ begin if rising_edge(clk) then case (check_stage) is when IDLE => - ack_hc <= '0'; - done_hc <= '0'; - ready_out_hc <= '0'; - ret_hc <= ERROR; out_check_done <= '0'; if (start_hc = '1') then - ack_hc <= '1'; check_stage <= CHECK; case (opcode_hc) is when ADD_CACHE_CHANGE => @@ -1322,30 +1317,38 @@ begin end case; end if; when CHECK => - ack_hc <= '0'; - ready_out_hc <= '1'; - out_check_done <= '0'; if (valid_out_hc = '1') then SB_out.Check(last_word_out_hc & data_out_hc); if (last_word_out_hc = '1') then - ready_out_hc <= '0'; check_stage <= RESPONSE; end if; end if; when RESPONSE => - ack_hc <= '0'; - ready_out_hc <= '0'; - done_hc <= '1'; - if (accept = ACCEPT_RES) then - ret_hc <= OK; - else - ret_hc <= REJECTED; - end if; check_stage <= IDLE; out_check_done <= '1'; end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + ready_out_hc <= '0'; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when CHECK => + ready_out_hc <= '1'; + when RESPONSE => + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + end case; end process; watchdog : process diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_vbk.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_vbk.vhd index 673f285..24e3c9b 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_vbk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_vbk.vhd @@ -1277,13 +1277,8 @@ begin if rising_edge(clk) then case (check_stage) is when IDLE => - ack_hc <= '0'; - done_hc <= '0'; - ready_out_hc <= '0'; - ret_hc <= ERROR; out_check_done <= '0'; if (start_hc = '1') then - ack_hc <= '1'; check_stage <= CHECK; case (opcode_hc) is when ADD_CACHE_CHANGE => @@ -1294,30 +1289,38 @@ begin end case; end if; when CHECK => - ack_hc <= '0'; - ready_out_hc <= '1'; - out_check_done <= '0'; if (valid_out_hc = '1') then SB_out.Check(last_word_out_hc & data_out_hc); if (last_word_out_hc = '1') then - ready_out_hc <= '0'; check_stage <= RESPONSE; end if; end if; when RESPONSE => - ack_hc <= '0'; - ready_out_hc <= '0'; - done_hc <= '1'; - if (accept = ACCEPT_RES) then - ret_hc <= OK; - else - ret_hc <= REJECTED; - end if; check_stage <= IDLE; out_check_done <= '1'; end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + ready_out_hc <= '0'; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when CHECK => + ready_out_hc <= '1'; + when RESPONSE => + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + end case; end process; watchdog : process diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_vrk.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_vrk.vhd index ae3a53f..f2480c4 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_vrk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_vrk.vhd @@ -1291,13 +1291,8 @@ begin if rising_edge(clk) then case (check_stage) is when IDLE => - ack_hc <= '0'; - done_hc <= '0'; - ready_out_hc <= '0'; - ret_hc <= ERROR; out_check_done <= '0'; if (start_hc = '1') then - ack_hc <= '1'; check_stage <= CHECK; case (opcode_hc) is when ADD_CACHE_CHANGE => @@ -1308,30 +1303,38 @@ begin end case; end if; when CHECK => - ack_hc <= '0'; - ready_out_hc <= '1'; - out_check_done <= '0'; if (valid_out_hc = '1') then SB_out.Check(last_word_out_hc & data_out_hc); if (last_word_out_hc = '1') then - ready_out_hc <= '0'; check_stage <= RESPONSE; end if; end if; when RESPONSE => - ack_hc <= '0'; - ready_out_hc <= '0'; - done_hc <= '1'; - if (accept = ACCEPT_RES) then - ret_hc <= OK; - else - ret_hc <= REJECTED; - end if; check_stage <= IDLE; out_check_done <= '1'; end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + ready_out_hc <= '0'; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when CHECK => + ready_out_hc <= '1'; + when RESPONSE => + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + end case; end process; watchdog : process diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_vrn.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_vrn.vhd index 57b9112..15359e4 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_vrn.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_vrn.vhd @@ -1301,13 +1301,8 @@ begin if rising_edge(clk) then case (check_stage) is when IDLE => - ack_hc <= '0'; - done_hc <= '0'; - ready_out_hc <= '0'; - ret_hc <= ERROR; out_check_done <= '0'; if (start_hc = '1') then - ack_hc <= '1'; check_stage <= CHECK; case (opcode_hc) is when ADD_CACHE_CHANGE => @@ -1318,30 +1313,38 @@ begin end case; end if; when CHECK => - ack_hc <= '0'; - ready_out_hc <= '1'; - out_check_done <= '0'; if (valid_out_hc = '1') then SB_out.Check(last_word_out_hc & data_out_hc); if (last_word_out_hc = '1') then - ready_out_hc <= '0'; check_stage <= RESPONSE; end if; end if; when RESPONSE => - ack_hc <= '0'; - ready_out_hc <= '0'; - done_hc <= '1'; - if (accept = ACCEPT_RES) then - ret_hc <= OK; - else - ret_hc <= REJECTED; - end if; check_stage <= IDLE; out_check_done <= '1'; end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + ready_out_hc <= '0'; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when CHECK => + ready_out_hc <= '1'; + when RESPONSE => + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + end case; end process; watchdog : process diff --git a/src/Tests/Level_0/L0_rtps_reader_test3_a.vhd b/src/Tests/Level_0/L0_rtps_reader_test3_a.vhd index f16b090..a870521 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test3_a.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test3_a.vhd @@ -550,13 +550,8 @@ begin if rising_edge(clk) then case (check_stage) is when IDLE => - ack_hc <= '0'; - done_hc <= '0'; - ready_out_hc <= '0'; - ret_hc <= ERROR; out_check_done <= '0'; if (start_hc = '1') then - ack_hc <= '1'; check_stage <= CHECK; case (opcode_hc) is when REMOVE_WRITER => @@ -571,30 +566,38 @@ begin end case; end if; when CHECK => - ack_hc <= '0'; - ready_out_hc <= '1'; - out_check_done <= '0'; if (valid_out_hc = '1') then SB_out.Check(last_word_out_hc & data_out_hc); if (last_word_out_hc = '1') then - ready_out_hc <= '0'; check_stage <= RESPONSE; end if; end if; when RESPONSE => - ack_hc <= '0'; - ready_out_hc <= '0'; - done_hc <= '1'; - if (accept = ACCEPT_RES) then - ret_hc <= OK; - else - ret_hc <= REJECTED; - end if; check_stage <= IDLE; out_check_done <= '1'; end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + ready_out_hc <= '0'; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when CHECK => + ready_out_hc <= '1'; + when RESPONSE => + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + end case; end process; mem_check_prc : process diff --git a/src/Tests/Level_0/L0_rtps_reader_test3_m.vhd b/src/Tests/Level_0/L0_rtps_reader_test3_m.vhd index 8b4b05e..af63e17 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test3_m.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test3_m.vhd @@ -571,13 +571,8 @@ begin if rising_edge(clk) then case (check_stage) is when IDLE => - ack_hc <= '0'; - done_hc <= '0'; - ready_out_hc <= '0'; - ret_hc <= ERROR; out_check_done <= '0'; if (start_hc = '1') then - ack_hc <= '1'; check_stage <= CHECK; case (opcode_hc) is when REMOVE_WRITER => @@ -592,30 +587,38 @@ begin end case; end if; when CHECK => - ack_hc <= '0'; - ready_out_hc <= '1'; - out_check_done <= '0'; if (valid_out_hc = '1') then SB_out.Check(last_word_out_hc & data_out_hc); if (last_word_out_hc = '1') then - ready_out_hc <= '0'; check_stage <= RESPONSE; end if; end if; when RESPONSE => - ack_hc <= '0'; - ready_out_hc <= '0'; - done_hc <= '1'; - if (accept = ACCEPT_RES) then - ret_hc <= OK; - else - ret_hc <= REJECTED; - end if; check_stage <= IDLE; out_check_done <= '1'; end case; end if; + -- DEFAULT + ack_hc <= '0'; + done_hc <= '0'; + ret_hc <= ERROR; + ready_out_hc <= '0'; + case (check_stage) is + when IDLE => + if (start_hc = '1') then + ack_hc <= '1'; + end if; + when CHECK => + ready_out_hc <= '1'; + when RESPONSE => + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + end case; end process; mem_check_prc : process diff --git a/src/rtps_reader.vhd b/src/rtps_reader.vhd index 6c81807..e6a6e7f 100644 --- a/src/rtps_reader.vhd +++ b/src/rtps_reader.vhd @@ -706,7 +706,6 @@ begin data_out_hc <= std_logic_vector(to_unsigned(mem_pos, WORD_WIDTH)); -- Wait for Operation Acknowledgement if (ack_hc = '1') then - start_hc <= '0'; -- Remove Unmatched Remote Endpoint mem_op_start <= '1'; mem_opcode <= REMOVE_ENDPOINT; @@ -730,7 +729,6 @@ begin data_out_hc <= std_logic_vector(to_unsigned(mem_pos, WORD_WIDTH)); -- Wait for Operation Acknowledgement if (ack_hc = '1') then - start_hc <= '0'; -- Remove Unmatched Remote Endpoint mem_op_start <= '1'; mem_opcode <= REMOVE_ENDPOINT; @@ -1225,7 +1223,6 @@ begin opcode_hc <= ADD_CACHE_CHANGE; -- Wait until History Cache acknowledges request if (ack_hc = '1') then - start_hc <= '0'; stage_next <= ADD_CACHE_CHANGE; cnt_next <= 0; end if; @@ -1423,7 +1420,6 @@ begin data_out_hc <= std_logic_vector(to_unsigned(mem_pos, WORD_WIDTH)); -- Wait for Operation Acknowledgement if (ack_hc = '1') then - start_hc <= '0'; -- Remove Endpoint mem_op_start <= '1'; mem_opcode <= REMOVE_ENDPOINT; @@ -2873,7 +2869,6 @@ begin bitmap_pos <= 0; mem_cnt <= 0; mem_pos <= 0; - is_meta <= '0'; key_hash_rcvd <= '0'; last_word_in_latch <= '0';