From 9cc4907a2fd58e65ff5517f9c5a90aacf1753513 Mon Sep 17 00:00:00 2001 From: Greek Date: Wed, 17 Nov 2021 14:23:53 +0100 Subject: [PATCH] Add complete Level2 System Test Using seperately compiled Libraries we interconnect two systems, and test their communication and interaction. A bug in rtps_builtin_endpoint was fixed (were if only the SUB data was to be sent, it was never actually sent). --- READ.txt | 19 + sim/L2_Type1_test1.do | 100 +++++ sim/modelsim.ini | 1 + src/Tests/Level_2/L2_Testbench_Lib2.vhd | 400 +++++++++++++++++ src/Tests/Level_2/L2_Testbench_Lib3.vhd | 453 +++++++++++++++++++ src/Tests/Level_2/L2_Type1_test1.vhd | 557 ++++++++++++++++++++++++ src/Tests/test_config1.vhd | 6 +- src/Tests/test_config2.vhd | 138 ++++++ src/Tests/test_config3.vhd | 138 ++++++ src/Tests/testbench.pro | 83 +++- src/dds_reader.vhd | 38 +- src/dds_writer.vhd | 17 +- src/rtps_builtin_endpoint.vhd | 10 +- src/rtps_config_package.vhd | 22 +- src/rtps_out.vhd | 3 +- src/rtps_reader.vhd | 17 +- src/rtps_writer.vhd | 27 +- 17 files changed, 1961 insertions(+), 68 deletions(-) create mode 100644 READ.txt create mode 100644 sim/L2_Type1_test1.do create mode 100644 src/Tests/Level_2/L2_Testbench_Lib2.vhd create mode 100644 src/Tests/Level_2/L2_Testbench_Lib3.vhd create mode 100644 src/Tests/Level_2/L2_Type1_test1.vhd create mode 100644 src/Tests/test_config2.vhd create mode 100644 src/Tests/test_config3.vhd diff --git a/READ.txt b/READ.txt new file mode 100644 index 0000000..b51a43b --- /dev/null +++ b/READ.txt @@ -0,0 +1,19 @@ +RUN TESTS +========= + +MANUALLY +-------- + +* Open modelsim +* Change Directory to /sim +* run 'build ../src/Tests/testbench.pro' + +AUTOMATICALLY +------------- + +* Open Terminal in /sim directory +* Run 'vsim -do test_all.do' + +NOTE: After some time the compilation of the simulator gets sluggisly slow. + I noticed that deleting the Libraries and re-creating them re-vitalizes the speed + In order to do so start a simulation (so that the Library is loaded), make sure that you end the current simulation, and type 'RemoveAllLibraries'. After a vsim re-start everything shoudl run faster \ No newline at end of file diff --git a/sim/L2_Type1_test1.do b/sim/L2_Type1_test1.do new file mode 100644 index 0000000..5dabd23 --- /dev/null +++ b/sim/L2_Type1_test1.do @@ -0,0 +1,100 @@ +onerror {resume} +radix define DDS_RETCODE { + "10#0#" "RETCODE_OK", + "10#1#" "RETCODE_ERROR", + "10#2#" "RETCODE_UNSUPPORTED", + "10#3#" "RETCODE_BAD_PARAMETER", + "10#4#" "RETCODE_PRECONDITION_NOT_MET", + "10#5#" "RETCODE_OUT_OF_RESOURCES", + "10#6#" "RETCODE_NOT_ENABLED", + "10#7#" "RETCODE_IMMUTABLE_POLICY", + "10#8#" "RETCODE_INCONSISTENT_POLICY", + "10#9#" "RETCODE_ALREADY_DELETED", + "10#10#" "RETCODE_TIMEOUT", + "10#11#" "RETCODE_NO_DATA", + "10#12#" "RETCODE_ILLEGAL_OPERATION", + -default unsigned +} +radix define SAMPLE_STATE { + "16#00000001#" "READ_SAMPLE_STATE", + "16#00000002#" "NOT_READ_SAMPLE_STATE", + "16#FFFFFFFF#" "ANY_SAMPLE_STATE", + -default binary +} +radix define VIEW_STATE { + "16#00000001#" "NEW_VIEW_STATE", + "16#00000002#" "NOT_NEW_VIEW_STATE", + "16#FFFFFFFF#" "ANY_VIEW_STATE", + -default binary +} +radix define INSTANCE_STATE { + "16#00000001#" "ALIVE_INSTANCE_STATE", + "16#00000002#" "NOT_ALIVE_DISPOSED_INSTANCE_STATE", + "16#00000004#" "NOT_ALIVE_NO_WRITERS_INSTANCE_STATE", + "16#FFFFFFFF#" "ANY_INSTANCE_STATE", + -default binary +} +quietly WaveActivateNextPane {} 0 +add wave -noupdate -divider SYSTEM +add wave -noupdate -radix unsigned /l2_type1_test1/clk +add wave -noupdate -radix unsigned /l2_type1_test1/reset +add wave -noupdate -radix unsigned /l2_type1_test1/time +add wave -noupdate -divider {DDS WRITER} +add wave -noupdate /l2_type1_test1/Lib2_inst/start_user +add wave -noupdate /l2_type1_test1/Lib2_inst/ack_user +add wave -noupdate /l2_type1_test1/Lib2_inst/opcode_user +add wave -noupdate /l2_type1_test1/Lib2_inst/done_user +add wave -noupdate -radix DDS_RETCODE /l2_type1_test1/Lib2_inst/return_code_user +add wave -noupdate /l2_type1_test1/Lib2_inst/dds_writer_w_inst/stage +add wave -noupdate -group Output /l2_type1_test1/Lib2_inst/ready_out_user +add wave -noupdate -group Output /l2_type1_test1/Lib2_inst/valid_out_user +add wave -noupdate -group Output -radix hexadecimal /l2_type1_test1/Lib2_inst/data_out_user +add wave -noupdate -group Output /l2_type1_test1/Lib2_inst/last_word_out_user +add wave -noupdate -divider {RTPS WRITER} +add wave -noupdate /l2_type1_test1/Lib2_inst/rtps_writer_w_inst/stage +add wave -noupdate /l2_type1_test1/Lib2_inst/rtps_writer_w_inst/cnt +add wave -noupdate -expand -group {RTPS Writer} /l2_type1_test1/Lib2_inst/rtps_writer_w_inst/start_hc +add wave -noupdate -expand -group {RTPS Writer} /l2_type1_test1/Lib2_inst/rtps_writer_w_inst/opcode_hc +add wave -noupdate -expand -group {RTPS Writer} /l2_type1_test1/Lib2_inst/rtps_writer_w_inst/ack_hc +add wave -noupdate -expand -group {RTPS Writer} /l2_type1_test1/Lib2_inst/rtps_writer_w_inst/done_hc +add wave -noupdate -expand -group {RTPS Writer} /l2_type1_test1/Lib2_inst/rtps_writer_w_inst/ret_hc +add wave -noupdate -divider {RTPS Builtin Endpoint} +add wave -noupdate -expand -group Lib2 -radix hexadecimal /l2_type1_test1/Lib2_inst/rtps_builtin_endpoint_w_inst/data_in +add wave -noupdate -expand -group Lib2 /l2_type1_test1/Lib2_inst/rtps_builtin_endpoint_w_inst/stage +add wave -noupdate -expand -group Lib2 /l2_type1_test1/Lib2_inst/rtps_builtin_endpoint_w_inst/cnt +add wave -noupdate -group Lib3 -radix hexadecimal /l2_type1_test1/Lib3_inst/rtps_builtin_endpoint_r_inst/data_in +add wave -noupdate -group Lib3 /l2_type1_test1/Lib3_inst/rtps_builtin_endpoint_r_inst/stage +add wave -noupdate -group Lib3 /l2_type1_test1/Lib3_inst/rtps_builtin_endpoint_r_inst/cnt +add wave -noupdate -group Lib3 -radix hexadecimal /l2_type1_test1/Lib3_inst/rtps_builtin_endpoint_r_inst/data_out +add wave -noupdate -divider {DDS READER} +add wave -noupdate /l2_type1_test1/Lib3_inst/start_user +add wave -noupdate /l2_type1_test1/Lib3_inst/ack_user +add wave -noupdate /l2_type1_test1/Lib3_inst/opcode_user +add wave -noupdate /l2_type1_test1/Lib3_inst/done_user +add wave -noupdate -radix DDS_RETCODE /l2_type1_test1/Lib3_inst/return_code_user +add wave -noupdate /l2_type1_test1/Lib3_inst/dds_reader_r_inst/status +add wave -noupdate /l2_type1_test1/Lib3_inst/si_valid_data_user +add wave -noupdate /l2_type1_test1/Lib3_inst/si_valid_user +add wave -noupdate /l2_type1_test1/Lib3_inst/eoc_user +add wave -noupdate /l2_type1_test1/Lib3_inst/get_data_user +add wave -noupdate /l2_type1_test1/Lib3_inst/si_ack_user +add wave -noupdate /l2_type1_test1/Lib3_inst/valid +add wave -noupdate -divider MISC +TreeUpdate [SetDefaultTree] +WaveRestoreCursors {{Cursor 1} {135304292 ps} 0} +quietly wave cursor active 1 +configure wave -namecolwidth 150 +configure wave -valuecolwidth 100 +configure wave -justifyvalue left +configure wave -signalnamewidth 1 +configure wave -snapdistance 10 +configure wave -datasetprefix 0 +configure wave -rowmargin 4 +configure wave -childrowmargin 2 +configure wave -gridoffset 0 +configure wave -gridperiod 1 +configure wave -griddelta 40 +configure wave -timeline 0 +configure wave -timelineunits ns +update +WaveRestoreZoom {134863 ns} {135887 ns} diff --git a/sim/modelsim.ini b/sim/modelsim.ini index 020467f..0610917 100644 --- a/sim/modelsim.ini +++ b/sim/modelsim.ini @@ -24,6 +24,7 @@ Testbench_Lib3 = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/ModelSim-2020.02/Test Testbench_Lib1 = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/ModelSim-2020.02/Testbench_Lib1.lib Lib1 = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/QuestaSim-2021.04/Lib1.lib Lib3 = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/QuestaSim-2021.04/Lib3.lib +Testbench-Lib1 = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/ModelSim-2020.02/Testbench-Lib1.lib [vcom] ; VHDL93 variable selects language version as the default. ; Default is VHDL-2002. diff --git a/src/Tests/Level_2/L2_Testbench_Lib2.vhd b/src/Tests/Level_2/L2_Testbench_Lib2.vhd new file mode 100644 index 0000000..93ce94f --- /dev/null +++ b/src/Tests/Level_2/L2_Testbench_Lib2.vhd @@ -0,0 +1,400 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library Testbench_Lib2; + +use Testbench_Lib2.rtps_package.all; +use Testbench_Lib2.user_config.all; +use Testbench_Lib2.rtps_config_package.all; +use Testbench_Lib2.rtps_test_package.all; +use Testbench_Lib2.Type1_package.all; + +entity L2_Testbench_Lib2 is + port ( + -- SYSTEM + clk : in std_logic; + reset : in std_logic; + time : in TIME_TYPE; + -- INPUT + empty : in std_logic; + rd : out std_logic; + data_in : in std_logic_vector(WORD_WIDTH-1 downto 0); + -- OUTPUT + data_out : out std_logic_vector(WORD_WIDTH-1 downto 0); + wr : out std_logic; + full : in std_logic; + -- TO USER ENTITY + start_user : in std_logic; + ack_user : out std_logic; + opcode_user : in DDS_WRITER_OPCODE_TYPE; + instance_handle_user : in INSTANCE_HANDLE_TYPE; + source_ts_user : in TIME_TYPE; + max_wait_user : in DURATION_TYPE; + done_user : out std_logic; + return_code_user : out std_logic_vector(RETURN_CODE_WIDTH-1 downto 0); + ready_out_user : in std_logic; + valid_out_user : out std_logic; + data_out_user : out std_logic_vector(WORD_WIDTH-1 downto 0); + last_word_out_user : out std_logic; + -- Communication Status + status_user : out std_logic_vector(STATUS_KIND_WIDTH-1 downto 0); + -- ###GENERATED START### + id : in std_logic_vector(CDR_LONG_WIDTH-1 downto 0); + a : in std_logic_vector(CDR_LONG_WIDTH-1 downto 0); + -- ###GENERATED END### + encode_done : out std_logic + ); +end entity; + +architecture arch of L2_Testbench_Lib2 is + + type ENDPOINT_DATA_TYPE is array (0 to NUM_ENDPOINTS) of std_logic_vector(WORD_WIDTH downto 0); + + -- INTERCONNECT + signal start_wr_dds, ack_wr_dds, done_wr_dds, ready_out_wr_dds, valid_out_wr_dds, last_word_out_wr_dds, ready_in_wr_dds, valid_in_wr_dds, last_word_in_wr_dds : std_logic := '0'; + signal opcode_wr_dds : DDS_WRITER_OPCODE_TYPE := NOP; + signal instance_handle_wr_dds : INSTANCE_HANDLE_TYPE := HANDLE_NIL; + signal source_ts_wr_dds : TIME_TYPE := TIME_ZERO; + signal max_wait_wr_dds : DURATION_TYPE := DURATION_ZERO; + signal return_code_wr_dds : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := RETCODE_OK; + signal data_in_wr_dds, data_out_wr_dds : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal status_wr_dds : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := (others => '0'); + signal start_dds_kh, ack_dds_kh, valid_in_dds_kh, ready_in_dds_kh, last_word_in_dds_kh, ready_out_dds_kh, valid_out_dds_kh, last_word_out_dds_kh, abort_dds_kh : std_logic := '0'; + signal opcode_dds_kh : KEY_HOLDER_OPCODE_TYPE := NOP; + signal data_in_dds_kh, data_out_dds_kh : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal start_dds_rtps, ack_dds_rtps, done_dds_rtps, get_data_dds_rtps, valid_out_dds_rtps, ready_out_dds_rtps, last_word_out_dds_rtps, liveliness_assertion_dds_rtps, data_available_dds_rtps : std_logic := '0'; + signal data_out_dds_rtps : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal opcode_dds_rtps : HISTORY_CACHE_OPCODE_TYPE := NOP; + signal ret_dds_rtps : HISTORY_CACHE_RESPONSE_TYPE := OK; + signal seq_nr_dds_rtps : SEQUENCENUMBER_TYPE := SEQUENCENUMBER_UNKNOWN; + signal cc_instance_handle_dds_rtps : INSTANCE_HANDLE_TYPE := HANDLE_NIL; + signal cc_kind_dds_rtps : CACHE_CHANGE_KIND_TYPE := ALIVE; + signal cc_source_timestamp_dds_rtps : TIME_TYPE := TIME_ZERO; + signal cc_seq_nr_dds_rtps : SEQUENCENUMBER_TYPE := SEQUENCENUMBER_UNKNOWN; + + signal empty_rh, full_rh, rd_rh, wr_rh : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + signal data_in_rh, data_out_rh : ENDPOINT_DATA_TYPE := (others => (others => '0')); + + signal empty_rtps, full_rtps, rd_rtps, wr_rtps, alive_sig_rtps : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + signal data_in_rtps, data_out_rtps : ENDPOINT_DATA_TYPE := (others => (others => '0')); + + signal wr_rtps_out, rd_rtps_out, full_rtps_out, empty_rtps_out : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + signal data_out_rtps_out, data_in_rtps_out : ENDPOINT_DATA_TYPE := (others => (others => '0')); + + signal last_word_out_rbe : std_logic := '0'; + signal data_out_rbe : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal last_word_out_rh_s : std_logic := '0'; + signal data_out_rh_s : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal data_rtps_out_s : RTPS_OUT_DATA_TYPE := (others => (others => '0')); + signal last_word_rtps_out_s : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + +begin + + Type1_writer_wrapper_w_inst : entity Testbench_Lib2.Type1_writer_wrapper(arch) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + -- FROM DDS WRITER + start_dds => start_wr_dds, + ack_dds => ack_wr_dds, + opcode_dds => opcode_wr_dds, + instance_handle_dds => instance_handle_wr_dds, + source_ts_dds => source_ts_wr_dds, + max_wait_dds => max_wait_wr_dds, + done_dds => done_wr_dds, + return_code_dds => return_code_wr_dds, + ready_out_dds => ready_out_wr_dds, + valid_out_dds => valid_out_wr_dds, + data_out_dds => data_out_wr_dds, + last_word_out_dds => last_word_out_wr_dds, + ready_in_dds => ready_in_wr_dds, + valid_in_dds => valid_in_wr_dds, + data_in_dds => data_in_wr_dds, + last_word_in_dds => last_word_in_wr_dds, + -- Communication Status + status_dds => status_wr_dds, + -- TO USER ENTITY + start_user => start_user, + ack_user => ack_user, + opcode_user => opcode_user, + instance_handle_user => instance_handle_user, + source_ts_user => source_ts_user, + max_wait_user => max_wait_user, + done_user => done_user, + return_code_user => return_code_user, + ready_out_user => ready_out_user, + valid_out_user => valid_out_user, + data_out_user => data_out_user, + last_word_out_user => last_word_out_user, + -- Communication Status + status_user => status_user, + -- ###GENERATED START### + id => id, + a => a, + -- ###GENERATED END### + encode_done => encode_done + ); + + dds_writer_w_inst : entity Testbench_Lib2.dds_writer(arch) + generic map ( + ID => 0, + PAYLOAD_FRAME_SIZE => MAX_TYPE1_SIZE, + MAX_SAMPLES => int(5,CDR_LONG_WIDTH), + MAX_INSTANCES => int(5,CDR_LONG_WIDTH) + ) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + time => time, + -- TO/FROM RTPS ENDPOINT + start_rtps => start_dds_rtps, + opcode_rtps => opcode_dds_rtps, + ack_rtps => ack_dds_rtps, + done_rtps => done_dds_rtps, + ret_rtps => ret_dds_rtps, + seq_nr_rtps => seq_nr_dds_rtps, + get_data_rtps => get_data_dds_rtps, + data_out_rtps => data_out_dds_rtps, + valid_out_rtps => valid_out_dds_rtps, + ready_out_rtps => ready_out_dds_rtps, + last_word_out_rtps => last_word_out_dds_rtps, + liveliness_assertion => liveliness_assertion_dds_rtps, + data_available => data_available_dds_rtps, + -- Cache Change + cc_instance_handle => cc_instance_handle_dds_rtps, + cc_kind => cc_kind_dds_rtps, + cc_source_timestamp => cc_source_timestamp_dds_rtps, + cc_seq_nr => cc_seq_nr_dds_rtps, + -- TO/FROM KEY_HOLDER + start_kh => start_dds_kh, + opcode_kh => opcode_dds_kh, + ack_kh => ack_dds_kh, + data_in_kh => data_in_dds_kh, + valid_in_kh => valid_in_dds_kh, + ready_in_kh => ready_in_dds_kh, + last_word_in_kh => last_word_in_dds_kh, + data_out_kh => data_out_dds_kh, + valid_out_kh => valid_out_dds_kh, + ready_out_kh => ready_out_dds_kh, + last_word_out_kh => last_word_out_dds_kh, + abort_kh => abort_dds_kh, + -- TO/FROM USER ENTITY + start_dds => start_wr_dds, + ack_dds => ack_wr_dds, + opcode_dds => opcode_wr_dds, + instance_handle_dds => instance_handle_wr_dds, + source_ts_dds => source_ts_wr_dds, + max_wait_dds => max_wait_wr_dds, + done_dds => done_wr_dds, + return_code_dds => return_code_wr_dds, + ready_in_dds => ready_out_wr_dds, + valid_in_dds => valid_out_wr_dds, + data_in_dds => data_out_wr_dds, + last_word_in_dds => last_word_out_wr_dds, + ready_out_dds => ready_in_wr_dds, + valid_out_dds => valid_in_wr_dds, + data_out_dds => data_in_wr_dds, + last_word_out_dds => last_word_in_wr_dds, + -- Communication Status + status => status_wr_dds + ); + + key_holder_Type1_w_inst : entity Testbench_Lib2.key_holder(TYPE1) + port map ( + clk => clk, + reset => reset, + start => start_dds_kh, + opcode => opcode_dds_kh, + ack => ack_dds_kh, + decode_error => open, + abort => abort_dds_kh, + data_in => data_out_dds_kh, + valid_in => valid_out_dds_kh, + ready_in => ready_out_dds_kh, + last_word_in => last_word_out_dds_kh, + data_out => data_in_dds_kh, + valid_out => valid_in_dds_kh, + ready_out => ready_in_dds_kh, + last_word_out => last_word_in_dds_kh + ); + + rtps_writer_w_inst : entity Testbench_Lib2.rtps_writer(arch) + generic map ( + ID => 0, + MAX_REMOTE_ENDPOINTS => 5 + ) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + time => time, + -- FROM RTPS_HANDLER (USER TRAFFIC) + empty_user => empty_rh(0), + rd_user => rd_rh(0), + data_in_user => data_out_rh(0)(WORD_WIDTH-1 downto 0), + last_word_in_user => data_out_rh(0)(WORD_WIDTH), + -- FROM RTPS_BUILTIN_ENDPOINT (META TRAFFIC) + empty_meta => empty_rtps(0), + rd_meta => rd_rtps(0), + data_in_meta => data_out_rtps(0)(WORD_WIDTH-1 downto 0), + last_word_in_meta => data_out_rtps(0)(WORD_WIDTH), + -- TO RTPS_BUILTIN_ENDPOINT (META TRAFFIC) + alive_sig => alive_sig_rtps(0), + -- RTPS OUTPUT + wr_rtps => wr_rtps_out(0), + full_rtps => full_rtps_out(0), + data_out_rtps => data_in_rtps_out(0)(WORD_WIDTH-1 downto 0), + last_word_out_rtps => data_in_rtps_out(0)(WORD_WIDTH), + -- FROM HC + liveliness_assertion => liveliness_assertion_dds_rtps, + data_available => data_available_dds_rtps, + start_hc => start_dds_rtps, + opcode_hc => opcode_dds_rtps, + ack_hc => ack_dds_rtps, + seq_nr_hc => seq_nr_dds_rtps, + done_hc => done_dds_rtps, + ret_hc => ret_dds_rtps, + get_data_hc => get_data_dds_rtps, + data_in_hc => data_out_dds_rtps, + valid_in_hc => valid_out_dds_rtps, + ready_in_hc => ready_out_dds_rtps, + last_word_in_hc => last_word_out_dds_rtps, + cc_instance_handle => cc_instance_handle_dds_rtps, + cc_kind => cc_kind_dds_rtps, + cc_source_timestamp => cc_source_timestamp_dds_rtps, + cc_seq_nr => cc_seq_nr_dds_rtps + ); + + rtps_builtin_endpoint_w_inst : entity Testbench_Lib2.rtps_builtin_endpoint(arch) + generic map ( + MAX_REMOTE_PARTICIPANTS => 5 + ) + port map ( + clk => clk, + reset => reset, + time => time, + -- FROM RTPS HANDLER + empty => empty_rh(NUM_ENDPOINTS), + rd => rd_rh(NUM_ENDPOINTS), + data_in => data_out_rh(NUM_ENDPOINTS)(WORD_WIDTH-1 downto 0), + last_word_in => data_out_rh(NUM_ENDPOINTS)(WORD_WIDTH), + -- TO RTPS ENDPOINTS + endpoint_full => full_rtps(0 to NUM_ENDPOINTS-1), + endpoint_wr => wr_rtps(0 to NUM_ENDPOINTS-1), + alive => alive_sig_rtps(0 to NUM_ENDPOINTS-1), + -- TO RTPS OUT + rtps_full => full_rtps_out(NUM_ENDPOINTS), + rtps_wr => wr_rtps_out(NUM_ENDPOINTS), + last_word_out => last_word_out_rbe, + data_out => data_out_rbe + ); + + data_in_rtps(0 to NUM_ENDPOINTS-1) <= (others => (last_word_out_rbe & data_out_rbe)); + data_in_rtps_out(NUM_ENDPOINTS) <= last_word_out_rbe & data_out_rbe; + + rtps_handler_w_inst : entity Testbench_Lib2.rtps_handler(arch) + port map ( + clk => clk, + reset => reset, + -- INPUT + empty => empty, + rd => rd, + data_in => data_in, + -- TO RTPS BUILTIN ENDPOINT + builtin_full => full_rh(NUM_ENDPOINTS), + builtin_wr => wr_rh(NUM_ENDPOINTS), + -- TO RTPS ENDPOINT + user_full => full_rh(0 to NUM_ENDPOINTS-1), + user_wr => wr_rh(0 to NUM_ENDPOINTS-1), + + last_word_out => last_word_out_rh_s, + data_out => data_out_rh_s + ); + + data_in_rh <= (others => (last_word_out_rh_s & data_out_rh_s)); + + rtps_out_w_inst : entity Testbench_Lib2.rtps_out(arch) + port map ( + clk => clk, + reset => reset, + -- INPUT + data_in => data_rtps_out_s, + last_word_in => last_word_rtps_out_s, + rd => rd_rtps_out, + empty => empty_rtps_out, + -- OUTPUT + data_out => data_out, + wr => wr, + full => full + ); + + rh_fifo_gen : for i in 0 to NUM_ENDPOINTS generate + begin + fifo_inst : entity Testbench_Lib2.FWFT_FIFO(arch) + generic map ( + FIFO_DEPTH => 2, + DATA_WIDTH => WORD_WIDTH+1 + ) + port map + ( + reset => reset, + clk => clk, + data_in => data_in_rh(i), + write => wr_rh(i), + read => rd_rh(i), + data_out => data_out_rh(i), + empty => empty_rh(i), + full => full_rh(i), + free => open + ); + end generate; + + rtps_out_fifo_gen : for i in 0 to NUM_ENDPOINTS generate + begin + fifo_inst : entity Testbench_Lib2.FWFT_FIFO(arch) + generic map ( + FIFO_DEPTH => 2, + DATA_WIDTH => WORD_WIDTH+1 + ) + port map + ( + reset => reset, + clk => clk, + data_in => data_in_rtps_out(i), + write => wr_rtps_out(i), + read => rd_rtps_out(i), + data_out => data_out_rtps_out(i), + empty => empty_rtps_out(i), + full => full_rtps_out(i), + free => open + ); + + data_rtps_out_s(i) <= data_out_rtps_out(i)(WORD_WIDTH-1 downto 0); + last_word_rtps_out_s(i) <= data_out_rtps_out(i)(WORD_WIDTH); + end generate; + + rtps_fifo_gen : for i in 0 to NUM_ENDPOINTS-1 generate + begin + fifo_inst : entity Testbench_Lib2.FWFT_FIFO(arch) + generic map ( + FIFO_DEPTH => 2, + DATA_WIDTH => WORD_WIDTH+1 + ) + port map + ( + reset => reset, + clk => clk, + data_in => data_in_rtps(i), + write => wr_rtps(i), + read => rd_rtps(i), + data_out => data_out_rtps(i), + empty => empty_rtps(i), + full => full_rtps(i), + free => open + ); + end generate; + +end architecture; \ No newline at end of file diff --git a/src/Tests/Level_2/L2_Testbench_Lib3.vhd b/src/Tests/Level_2/L2_Testbench_Lib3.vhd new file mode 100644 index 0000000..affb48c --- /dev/null +++ b/src/Tests/Level_2/L2_Testbench_Lib3.vhd @@ -0,0 +1,453 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library Testbench_Lib3; + +use Testbench_Lib3.rtps_package.all; +use Testbench_Lib3.user_config.all; +use Testbench_Lib3.rtps_config_package.all; +use Testbench_Lib3.rtps_test_package.all; +use Testbench_Lib3.Type1_package.all; + +entity L2_Testbench_Lib3 is + port ( + -- SYSTEM + clk : in std_logic; + reset : in std_logic; + time : in TIME_TYPE; + -- INPUT + empty : in std_logic; + rd : out std_logic; + data_in : in std_logic_vector(WORD_WIDTH-1 downto 0); + -- OUTPUT + data_out : out std_logic_vector(WORD_WIDTH-1 downto 0); + wr : out std_logic; + full : in std_logic; + + -- TO USER ENTITY + start_user : in std_logic; + ack_user : out std_logic; + opcode_user : in DDS_READER_OPCODE_TYPE; + instance_state_user : in std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); + view_state_user : in std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); + sample_state_user : in std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0); + instance_handle_user : in INSTANCE_HANDLE_TYPE; + max_samples_user : in std_logic_vector(MAX_SAMPLES_WIDTH-1 downto 0); + get_data_user : in std_logic; + done_user : out std_logic; + return_code_user : out std_logic_vector(RETURN_CODE_WIDTH-1 downto 0); + -- Sample Info + si_sample_state_user : out std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0); + si_view_state_user : out std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); + si_instance_state_user : out std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); + si_source_timestamp_user : out TIME_TYPE; + si_instance_handle_user : out INSTANCE_HANDLE_TYPE; + si_publication_handle_user : out PUBLICATION_HANDLE_TYPE; + si_disposed_generation_count_user : out std_logic_vector(DISPOSED_GENERATION_COUNT_WIDTH-1 downto 0); + si_no_writers_generation_count_user : out std_logic_vector(NO_WRITERS_GENERATION_COUNT_WIDTH-1 downto 0); + si_sample_rank_user : out std_logic_vector(SAMPLE_RANK_WIDTH-1 downto 0); + si_generation_rank_user : out std_logic_vector(GENERATION_RANK_WIDTH-1 downto 0); + si_absolute_generation_rank_user : out std_logic_vector(ABSOLUTE_GENERATION_COUNT_WIDTH-1 downto 0); + si_valid_data_user : out std_logic; + si_valid_user : out std_logic; + si_ack_user : in std_logic; + eoc_user : out std_logic; + -- Communication Status + status_user : out std_logic_vector(STATUS_KIND_WIDTH-1 downto 0); + decode_error : out std_logic; + + -- ###GENERATED START### + id : out std_logic_vector(CDR_LONG_WIDTH-1 downto 0); + a : out std_logic_vector(CDR_LONG_WIDTH-1 downto 0); + -- ###GENERATED END### + valid : out std_logic + ); +end entity; + +architecture arch of L2_Testbench_Lib3 is + + type ENDPOINT_DATA_TYPE is array (0 to NUM_ENDPOINTS) of std_logic_vector(WORD_WIDTH downto 0); + + -- INTERCONNECT + signal start_wr_dds, ack_wr_dds, get_data_wr_dds, done_wr_dds, ready_in_wr_dds, valid_in_wr_dds, last_word_in_wr_dds, si_valid_data_wr_dds, si_valid_wr_dds, si_ack_wr_dds, eoc_wr_dds : std_logic := '0'; + signal opcode_wr_dds : DDS_READER_OPCODE_TYPE := NOP; + signal instance_state_wr_dds, si_instance_state_wr_dds : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0) := ANY_INSTANCE_STATE; + signal view_state_wr_dds, si_view_state_wr_dds : std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0) := ANY_VIEW_STATE; + signal sample_state_wr_dds, si_sample_state_wr_dds : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := ANY_SAMPLE_STATE; + signal instance_handle_wr_dds, si_instance_handle_wr_dds : INSTANCE_HANDLE_TYPE := HANDLE_NIL; + signal max_samples_wr_dds : std_logic_vector(MAX_SAMPLES_WIDTH-1 downto 0) := (others => '0'); + signal return_code_wr_dds : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := RETCODE_OK; + signal data_in_wr_dds : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal si_source_timestamp_wr_dds : TIME_TYPE := TIME_ZERO; + signal si_publication_handle_wr_dds : PUBLICATION_HANDLE_TYPE := GUID_UNKNOWN; + signal si_disposed_generation_count_wr_dds : std_logic_vector(DISPOSED_GENERATION_COUNT_WIDTH-1 downto 0) := (others => '0'); + signal si_no_writers_generation_count_wr_dds : std_logic_vector(NO_WRITERS_GENERATION_COUNT_WIDTH-1 downto 0) := (others => '0'); + signal si_sample_rank_wr_dds : std_logic_vector(SAMPLE_RANK_WIDTH-1 downto 0) := (others => '0'); + signal si_generation_rank_wr_dds : std_logic_vector(GENERATION_RANK_WIDTH-1 downto 0) := (others => '0'); + signal si_absolute_generation_rank_wr_dds : std_logic_vector(ABSOLUTE_GENERATION_COUNT_WIDTH-1 downto 0) := (others => '0'); + signal status_wr_dds : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := (others => '0'); + + signal start_dds_rtps, ack_dds_rtps, done_dds_rtps, valid_in_dds_rtps, ready_in_dds_rtps, last_word_in_dds_rtps : std_logic := '0'; + signal opcode_dds_rtps : HISTORY_CACHE_OPCODE_TYPE := NOP; + signal ret_dds_rtps : HISTORY_CACHE_RESPONSE_TYPE := OK; + signal data_in_dds_rtps : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + + signal start_dds_kh, ack_dds_kh, valid_in_dds_kh, ready_in_dds_kh, last_word_in_dds_kh, ready_out_dds_kh, valid_out_dds_kh, last_word_out_dds_kh, abort_dds_kh : std_logic := '0'; + signal opcode_dds_kh : KEY_HOLDER_OPCODE_TYPE := NOP; + signal data_in_dds_kh, data_out_dds_kh : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + -- + signal empty_rh, full_rh, rd_rh, wr_rh : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + signal data_in_rh, data_out_rh : ENDPOINT_DATA_TYPE := (others => (others => '0')); + + signal empty_rtps, full_rtps, rd_rtps, wr_rtps, alive_sig_rtps : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + signal data_in_rtps, data_out_rtps : ENDPOINT_DATA_TYPE := (others => (others => '0')); + + signal wr_rtps_out, rd_rtps_out, full_rtps_out, empty_rtps_out : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + signal data_out_rtps_out, data_in_rtps_out : ENDPOINT_DATA_TYPE := (others => (others => '0')); + + signal last_word_out_rbe : std_logic := '0'; + signal data_out_rbe : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal last_word_out_rh_s : std_logic := '0'; + signal data_out_rh_s : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal data_rtps_out_s : RTPS_OUT_DATA_TYPE := (others => (others => '0')); + signal last_word_rtps_out_s : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + + + +begin + + Type1_reader_wrapper_r_inst : entity Testbench_Lib3.Type1_reader_wrapper(arch) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + -- FROM DDS READER + start_dds => start_wr_dds, + ack_dds => ack_wr_dds, + opcode_dds => opcode_wr_dds, + instance_state_dds => instance_state_wr_dds, + view_state_dds => view_state_wr_dds, + sample_state_dds => sample_state_wr_dds, + instance_handle_dds => instance_handle_wr_dds, + max_samples_dds => max_samples_wr_dds, + get_data_dds => get_data_wr_dds, + done_dds => done_wr_dds, + return_code_dds => return_code_wr_dds, + ready_in_dds => ready_in_wr_dds, + valid_in_dds => valid_in_wr_dds, + data_in_dds => data_in_wr_dds, + last_word_in_dds => last_word_in_wr_dds, + -- Sample Info + si_sample_state_dds => si_sample_state_wr_dds, + si_view_state_dds => si_view_state_wr_dds, + si_instance_state_dds => si_instance_state_wr_dds, + si_source_timestamp_dds => si_source_timestamp_wr_dds, + si_instance_handle_dds => si_instance_handle_wr_dds, + si_publication_handle_dds => si_publication_handle_wr_dds, + si_disposed_generation_count_dds => si_disposed_generation_count_wr_dds, + si_no_writers_generation_count_dds => si_no_writers_generation_count_wr_dds, + si_sample_rank_dds => si_sample_rank_wr_dds, + si_generation_rank_dds => si_generation_rank_wr_dds, + si_absolute_generation_rank_dds => si_absolute_generation_rank_wr_dds, + si_valid_data_dds => si_valid_data_wr_dds, + si_valid_dds => si_valid_wr_dds, + si_ack_dds => si_ack_wr_dds, + eoc_dds => eoc_wr_dds, + -- Communication Status + status_dds => status_wr_dds, + -- TO USER ENTITY + start_user => start_user, + ack_user => ack_user, + opcode_user => opcode_user, + instance_state_user => instance_state_user, + view_state_user => view_state_user, + sample_state_user => sample_state_user, + instance_handle_user => instance_handle_user, + max_samples_user => max_samples_user, + get_data_user => get_data_user, + done_user => done_user, + return_code_user => return_code_user, + -- Sample Info + si_sample_state_user => si_sample_state_user, + si_view_state_user => si_view_state_user, + si_instance_state_user => si_instance_state_user, + si_source_timestamp_user => si_source_timestamp_user, + si_instance_handle_user => si_instance_handle_user, + si_publication_handle_user => si_publication_handle_user, + si_disposed_generation_count_user => si_disposed_generation_count_user, + si_no_writers_generation_count_user => si_no_writers_generation_count_user, + si_sample_rank_user => si_sample_rank_user, + si_generation_rank_user => si_generation_rank_user, + si_absolute_generation_rank_user => si_absolute_generation_rank_user, + si_valid_data_user => si_valid_data_user, + si_valid_user => si_valid_user, + si_ack_user => si_ack_user, + eoc_user => eoc_user, + -- Communication Status + status_user => status_user, + decode_error => open, + -- ###GENERATED START### + id => id, + a => a, + -- ###GENERATED END### + valid => valid + ); + + dds_reader_r_inst : entity Testbench_Lib3.dds_reader(arch) + generic map ( + ID => 0, + PAYLOAD_FRAME_SIZE => MAX_TYPE1_SIZE, + MAX_SAMPLES => int(5,CDR_LONG_WIDTH), + MAX_INSTANCES => int(5,CDR_LONG_WIDTH) + ) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + time => time, + -- FROM RTPS ENDPOINT + start_rtps => start_dds_rtps, + opcode_rtps => opcode_dds_rtps, + ack_rtps => ack_dds_rtps, + done_rtps => done_dds_rtps, + ret_rtps => ret_dds_rtps, + data_in_rtps => data_in_dds_rtps, + valid_in_rtps => valid_in_dds_rtps, + ready_in_rtps => ready_in_dds_rtps, + last_word_in_rtps => last_word_in_dds_rtps, + -- TO/FROM KEY_HOLDER + start_kh => start_dds_kh, + opcode_kh => opcode_dds_kh, + ack_kh => ack_dds_kh, + data_in_kh => data_in_dds_kh, + valid_in_kh => valid_in_dds_kh, + ready_in_kh => ready_in_dds_kh, + last_word_in_kh => last_word_in_dds_kh, + data_out_kh => data_out_dds_kh, + valid_out_kh => valid_out_dds_kh, + ready_out_kh => ready_out_dds_kh, + last_word_out_kh => last_word_out_dds_kh, + abort_kh => abort_dds_kh, + -- TO USER ENTITY + start_dds => start_wr_dds, + ack_dds => ack_wr_dds, + opcode_dds => opcode_wr_dds, + instance_state_dds => instance_state_wr_dds, + view_state_dds => view_state_wr_dds, + sample_state_dds => sample_state_wr_dds, + instance_handle_dds => instance_handle_wr_dds, + max_samples_dds => max_samples_wr_dds, + get_data_dds => get_data_wr_dds, + done_dds => done_wr_dds, + return_code_dds => return_code_wr_dds, + ready_out_dds => ready_in_wr_dds, + valid_out_dds => valid_in_wr_dds, + data_out_dds => data_in_wr_dds, + last_word_out_dds => last_word_in_wr_dds, + -- Sample Info + si_sample_state => si_sample_rank_wr_dds, + si_view_state => si_view_state_wr_dds, + si_instance_state => si_instance_state_wr_dds, + si_source_timestamp => si_source_timestamp_wr_dds, + si_instance_handle => si_instance_handle_wr_dds, + si_publication_handle => si_publication_handle_wr_dds, + si_disposed_generation_count => si_disposed_generation_count_wr_dds, + si_no_writers_generation_count => si_no_writers_generation_count_wr_dds, + si_sample_rank => si_sample_rank_wr_dds, + si_generation_rank => si_generation_rank_wr_dds, + si_absolute_generation_rank => si_absolute_generation_rank_wr_dds, + si_valid_data => si_valid_data_wr_dds, + si_valid => si_valid_wr_dds, + si_ack => si_ack_wr_dds, + eoc => eoc_wr_dds, + -- Communication Status + status => status_wr_dds + ); + + key_holder_Type1_r_inst : entity Testbench_Lib3.key_holder(TYPE1) + port map ( + clk => clk, + reset => reset, + start => start_dds_kh, + opcode => opcode_dds_kh, + ack => ack_dds_kh, + decode_error => open, + abort => abort_dds_kh, + data_in => data_out_dds_kh, + valid_in => valid_out_dds_kh, + ready_in => ready_out_dds_kh, + last_word_in => last_word_out_dds_kh, + data_out => data_in_dds_kh, + valid_out => valid_in_dds_kh, + ready_out => ready_in_dds_kh, + last_word_out => last_word_in_dds_kh + ); + + rtps_reader_r_inst : entity Testbench_Lib3.rtps_reader(arch) + generic map ( + ID => 0, + MAX_REMOTE_ENDPOINTS => 5 + ) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + time => time, + -- FROM RTPS_HANDLER (USER TRAFFIC) + empty_user => empty_rh(0), + rd_user => rd_rh(0), + data_in_user => data_out_rh(0)(WORD_WIDTH-1 downto 0), + last_word_in_user => data_out_rh(0)(WORD_WIDTH), + -- FROM RTPS_BUILTIN_ENDPOINT (META TRAFFIC) + empty_meta => empty_rtps(0), + rd_meta => rd_rtps(0), + data_in_meta => data_out_rtps(0)(WORD_WIDTH-1 downto 0), + last_word_in_meta => data_out_rtps(0)(WORD_WIDTH), + -- RTPS OUTPUT + wr_rtps => wr_rtps_out(0), + full_rtps => full_rtps_out(0), + data_out_rtps => data_in_rtps_out(0)(WORD_WIDTH-1 downto 0), + last_word_out_rtps => data_in_rtps_out(0)(WORD_WIDTH), + -- TO HISTORY CACHE + start_hc => start_dds_rtps, + opcode_hc => opcode_dds_rtps, + ack_hc => ack_dds_rtps, + done_hc => done_dds_rtps, + ret_hc => ret_dds_rtps, + data_out_hc => data_in_dds_rtps, + valid_out_hc => valid_in_dds_rtps, + ready_out_hc => ready_in_dds_rtps, + last_word_out_hc => last_word_in_dds_rtps + ); + + rtps_builtin_endpoint_r_inst : entity Testbench_Lib3.rtps_builtin_endpoint(arch) + generic map ( + MAX_REMOTE_PARTICIPANTS => 5 + ) + port map ( + clk => clk, + reset => reset, + time => time, + -- FROM RTPS HANDLER + empty => empty_rh(NUM_ENDPOINTS), + rd => rd_rh(NUM_ENDPOINTS), + data_in => data_out_rh(NUM_ENDPOINTS)(WORD_WIDTH-1 downto 0), + last_word_in => data_out_rh(NUM_ENDPOINTS)(WORD_WIDTH), + -- TO RTPS ENDPOINTS + endpoint_full => full_rtps(0 to NUM_ENDPOINTS-1), + endpoint_wr => wr_rtps(0 to NUM_ENDPOINTS-1), + alive => alive_sig_rtps(0 to NUM_ENDPOINTS-1), + -- TO RTPS OUT + rtps_full => full_rtps_out(NUM_ENDPOINTS), + rtps_wr => wr_rtps_out(NUM_ENDPOINTS), + last_word_out => last_word_out_rbe, + data_out => data_out_rbe + ); + + data_in_rtps(0 to NUM_ENDPOINTS-1) <= (others => (last_word_out_rbe & data_out_rbe)); + data_in_rtps_out(NUM_ENDPOINTS) <= last_word_out_rbe & data_out_rbe; + + rtps_handler_r_inst : entity Testbench_Lib3.rtps_handler(arch) + port map ( + clk => clk, + reset => reset, + -- INPUT + empty => empty, + rd => rd, + data_in => data_in, + -- TO RTPS BUILTIN ENDPOINT + builtin_full => full_rh(NUM_ENDPOINTS), + builtin_wr => wr_rh(NUM_ENDPOINTS), + -- TO RTPS ENDPOINT + user_full => full_rh(0 to NUM_ENDPOINTS-1), + user_wr => wr_rh(0 to NUM_ENDPOINTS-1), + + last_word_out => last_word_out_rh_s, + data_out => data_out_rh_s + ); + + data_in_rh <= (others => (last_word_out_rh_s & data_out_rh_s)); + + rtps_out_r_inst : entity Testbench_Lib3.rtps_out(arch) + port map ( + clk => clk, + reset => reset, + -- INPUT + data_in => data_rtps_out_s, + last_word_in => last_word_rtps_out_s, + rd => rd_rtps_out, + empty => empty_rtps_out, + -- OUTPUT + data_out => data_out, + wr => wr, + full => full + ); + + rh_fifo_gen : for i in 0 to NUM_ENDPOINTS generate + begin + fifo_inst : entity Testbench_Lib3.FWFT_FIFO(arch) + generic map ( + FIFO_DEPTH => 2, + DATA_WIDTH => WORD_WIDTH+1 + ) + port map + ( + reset => reset, + clk => clk, + data_in => data_in_rh(i), + write => wr_rh(i), + read => rd_rh(i), + data_out => data_out_rh(i), + empty => empty_rh(i), + full => full_rh(i), + free => open + ); + end generate; + + rtps_out_fifo_gen : for i in 0 to NUM_ENDPOINTS generate + begin + fifo_inst : entity Testbench_Lib3.FWFT_FIFO(arch) + generic map ( + FIFO_DEPTH => 2, + DATA_WIDTH => WORD_WIDTH+1 + ) + port map + ( + reset => reset, + clk => clk, + data_in => data_in_rtps_out(i), + write => wr_rtps_out(i), + read => rd_rtps_out(i), + data_out => data_out_rtps_out(i), + empty => empty_rtps_out(i), + full => full_rtps_out(i), + free => open + ); + + data_rtps_out_s(i) <= data_out_rtps_out(i)(WORD_WIDTH-1 downto 0); + last_word_rtps_out_s(i) <= data_out_rtps_out(i)(WORD_WIDTH); + end generate; + + rtps_fifo_gen : for i in 0 to NUM_ENDPOINTS-1 generate + begin + fifo_inst : entity Testbench_Lib3.FWFT_FIFO(arch) + generic map ( + FIFO_DEPTH => 2, + DATA_WIDTH => WORD_WIDTH+1 + ) + port map + ( + reset => reset, + clk => clk, + data_in => data_in_rtps(i), + write => wr_rtps(i), + read => rd_rtps(i), + data_out => data_out_rtps(i), + empty => empty_rtps(i), + full => full_rtps(i), + free => open + ); + end generate; + +end architecture; \ No newline at end of file diff --git a/src/Tests/Level_2/L2_Type1_test1.vhd b/src/Tests/Level_2/L2_Type1_test1.vhd new file mode 100644 index 0000000..4e1371d --- /dev/null +++ b/src/Tests/Level_2/L2_Type1_test1.vhd @@ -0,0 +1,557 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library osvvm; -- Utility Library +context osvvm.OsvvmContext; + +library Testbench_Lib2; +library Testbench_Lib3; + +use work.rtps_package.all; +use work.user_config.all; +use work.rtps_config_package.all; +use work.rtps_test_package.all; +use work.Type1_package.all; + +-- This testbench tests the general system operation by interconnecting a complete system with a single writer with a complete sysetm with a single reader. +-- Libraries are used to allow to use systems with different configurations. Testbench_Lib2 contains a single endpoint writer (Type1), and Testbench_Lib3 contains a single endpoint reader (Type1). +-- Both Libraries have compatible settings for matching. +-- The testbench first registers 2 instances, and writes 2 samples for each instance (once using the instance handle, and onc using HANDLE_NIL). This initial 4 writes are done before +-- the two systems have discovered each other (due to the initial Participant Announcement happening at 50k ns), and are thus considered historical data (Data that will be sent to the +-- Reader immediately on matching due to trasient local durability setting). +-- After data has arrived on the reader side, the data is read out and compared to the original. +-- Afterwards another sample on an unknown instance is written, and the instance handle is fetched via a register lookup operation. After the sample has arrived at the reader side the data is again +-- compared to the original. + +entity L2_Type1_test1 is +end entity; + +architecture testbench of L2_Type1_test1 is + + signal clk, reset : std_logic := '0'; + signal time : TIME_TYPE := TIME_ZERO; + -- INPUT + signal start_w, ack_w, done_w, ready_out_w, valid_out_w, last_word_out_w, encode_done_w, empty_rtps_w, full_rtps_w, rd_rtps_w, wr_rtps_w : std_logic := '0'; + --signal opcode_w : Testbench_Lib2.rtps_config_package.DDS_WRITER_OPCODE_TYPE := Testbench_Lib2.rtps_config_package.DDS_WRITER_OPCODE_TYPE'(NOP); + signal opcode_w : DDS_WRITER_OPCODE_TYPE; + signal instance_handle_w : INSTANCE_HANDLE_TYPE := HANDLE_NIL; + signal source_ts_w : TIME_TYPE := TIME_INVALID; + signal max_wait_w : DURATION_TYPE := DURATION_ZERO; + signal return_code_w : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := RETCODE_OK; + signal data_out_w, data_in_rtps_w, data_out_rtps_w : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal status_w : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := (others => '0'); + signal id_w, a_w : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := (others => '0'); + + signal start_r, ack_r, get_data_r, done_r, empty_rtps_r, full_rtps_r, rd_rtps_r, wr_rtps_r, si_valid_data_r, si_valid_r, si_ack_r, eoc_r, valid_r : std_logic := '0'; + signal opcode_r : DDS_READER_OPCODE_TYPE; + signal data_in_rtps_r, data_out_rtps_r : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal instance_state_r, si_instance_state_r : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0) := ANY_INSTANCE_STATE; + signal view_state_r, si_view_state_r : std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0) := ANY_VIEW_STATE; + signal sample_state_r, si_sample_state_r : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := ANY_SAMPLE_STATE; + signal instance_handle_r : INSTANCE_HANDLE_TYPE := HANDLE_NIL; + signal si_instance_handle_r : Testbench_Lib3.rtps_package.INSTANCE_HANDLE_TYPE := Testbench_Lib3.rtps_package.HANDLE_NIL; + signal max_samples_r : std_logic_vector(MAX_SAMPLES_WIDTH-1 downto 0) := (others => '0'); + signal return_code_r : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := RETCODE_OK; + signal si_source_timestamp_r : Testbench_Lib3.rtps_package.TIME_TYPE := Testbench_Lib3.rtps_package.TIME_INVALID; + signal si_publication_handle_r : Testbench_Lib3.rtps_package.PUBLICATION_HANDLE_TYPE := Testbench_Lib3.rtps_package.GUID_UNKNOWN; + signal si_disposed_generation_count_r : std_logic_vector(DISPOSED_GENERATION_COUNT_WIDTH-1 downto 0) := (others => '0'); + signal si_no_writers_generation_count_r : std_logic_vector(NO_WRITERS_GENERATION_COUNT_WIDTH-1 downto 0) := (others => '0'); + signal si_sample_rank_r : std_logic_vector(SAMPLE_RANK_WIDTH-1 downto 0) := (others => '0'); + signal si_generation_rank_r : std_logic_vector(GENERATION_RANK_WIDTH-1 downto 0) := (others => '0'); + signal si_absolute_generation_rank_r : std_logic_vector(ABSOLUTE_GENERATION_COUNT_WIDTH-1 downto 0) := (others => '0'); + signal status_r : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := (others => '0'); + signal id_r, a_r : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := (others => '0'); + + signal id1, id2, id3, a1, a2, a3 : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := (others => '0'); + signal inst1, inst2, inst3 : INSTANCE_HANDLE_TYPE := HANDLE_NIL; + + -- HACK: For some reason (possibly Modelsim/Questasim Bug) I cannot declare the opcode signals from their respective Library sources, + -- because I cannot use a qualified expression to define an enumeration literal (and direct type casting cannot be done because + -- the types are not closely related). So I have to do define explicit type conversions between the types... + + function to_Lib2(input : DDS_WRITER_OPCODE_TYPE) return Testbench_Lib2.rtps_config_package.DDS_WRITER_OPCODE_TYPE is + begin + return Testbench_Lib2.rtps_config_package.DDS_WRITER_OPCODE_TYPE'VAL(DDS_WRITER_OPCODE_TYPE'POS(input)); + end function; + + function to_Lib3(input : DDS_READER_OPCODE_TYPE) return Testbench_Lib3.rtps_config_package.DDS_READER_OPCODE_TYPE is + begin + return Testbench_Lib3.rtps_config_package.DDS_READER_OPCODE_TYPE'VAL(DDS_READER_OPCODE_TYPE'POS(input)); + end function; + +begin + + Lib2_inst : entity work.L2_Testbench_Lib2(arch) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + time => Testbench_Lib2.rtps_package.TIME_TYPE(time), + -- INPUT + empty => empty_rtps_w, + rd => rd_rtps_w, + data_in => data_in_rtps_w, + -- OUTPUT + data_out => data_out_rtps_w, + wr => wr_rtps_w, + full => full_rtps_w, + -- TO USER ENTITY + start_user => start_w, + ack_user => ack_w, + opcode_user => to_Lib2(opcode_w), + instance_handle_user => Testbench_Lib2.rtps_package.INSTANCE_HANDLE_TYPE(instance_handle_w), + source_ts_user => Testbench_Lib2.rtps_package.TIME_TYPE(source_ts_w), + max_wait_user => Testbench_Lib2.rtps_package.DURATION_TYPE(max_wait_w), + done_user => done_w, + return_code_user => return_code_w, + ready_out_user => ready_out_w, + valid_out_user => valid_out_w, + data_out_user => data_out_w, + last_word_out_user => last_word_out_w, + -- Communication Status + status_user => status_w, + -- ###GENERATED START### + id => id_w, + a => a_w, + -- ###GENERATED END### + encode_done => encode_done_w + ); + + fifo_r_w_inst : entity work.FWFT_FIFO(arch) + generic map ( + FIFO_DEPTH => 65536, + DATA_WIDTH => WORD_WIDTH + ) + port map + ( + reset => reset, + clk => clk, + data_in => data_out_rtps_r, + write => wr_rtps_r, + read => rd_rtps_w, + data_out => data_in_rtps_w, + empty => empty_rtps_w, + full => full_rtps_r, + free => open + ); + + fifo_w_r_inst : entity work.FWFT_FIFO(arch) + generic map ( + FIFO_DEPTH => 65536, + DATA_WIDTH => WORD_WIDTH + ) + port map + ( + reset => reset, + clk => clk, + data_in => data_out_rtps_w, + write => wr_rtps_w, + read => rd_rtps_r, + data_out => data_in_rtps_r, + empty => empty_rtps_r, + full => full_rtps_w, + free => open + ); + + Lib3_inst : entity work.L2_Testbench_Lib3(arch) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + time => Testbench_Lib3.rtps_package.TIME_TYPE(time), + -- INPUT + empty => empty_rtps_r, + rd => rd_rtps_r, + data_in => data_in_rtps_r, + -- OUTPUT + data_out => data_out_rtps_r, + wr => wr_rtps_r, + full => full_rtps_r, + -- TO USER ENTITY + start_user => start_r, + ack_user => ack_r, + opcode_user => to_Lib3(opcode_r), + instance_state_user => instance_state_r, + view_state_user => view_state_r, + sample_state_user => sample_state_r, + instance_handle_user => Testbench_Lib3.rtps_package.INSTANCE_HANDLE_TYPE(instance_handle_r), + max_samples_user => max_samples_r, + get_data_user => get_data_r, + done_user => done_r, + return_code_user => return_code_r, + -- Sample Info + si_sample_state_user => si_sample_state_r, + si_view_state_user => si_view_state_r, + si_instance_state_user => si_instance_state_r, + si_source_timestamp_user => si_source_timestamp_r, + si_instance_handle_user => si_instance_handle_r, + si_publication_handle_user => si_publication_handle_r, + si_disposed_generation_count_user => si_disposed_generation_count_r, + si_no_writers_generation_count_user => si_no_writers_generation_count_r, + si_sample_rank_user => si_sample_rank_r, + si_generation_rank_user => si_generation_rank_r, + si_absolute_generation_rank_user => si_absolute_generation_rank_r, + si_valid_data_user => si_valid_data_r, + si_valid_user => si_valid_r, + si_ack_user => si_ack_r, + eoc_user => eoc_r, + -- Communication Status + status_user => status_r, + decode_error => open, + + -- ###GENERATED START### + id => id_r, + a => a_r, + -- ###GENERATED END### + valid => valid_r + ); + + stimulus_prc : process + variable RV : RandomPType; + + -- Waits until signal toggles high for at least 1 ps + procedure wait_on_sig(signal sig : std_logic) is + begin + loop + if (sig /= '1') then + wait on sig until sig = '1'; + end if; + -- Prevent triggering on glitches + wait for 1 ps; + if (sig = '1') then + exit; + end if; + end loop; + end procedure; + + procedure wait_on_data(signal sig : std_logic_vector) is + begin + assert (sig'length = STATUS_KIND_WIDTH) severity FAILURE; + + if ((sig and DATA_AVAILABLE_STATUS) = (sig'reverse_range => '0')) then + wait on sig until ((sig and DATA_AVAILABLE_STATUS) = DATA_AVAILABLE_STATUS); + end if; + end procedure; + + procedure get_instance(signal inst : inout INSTANCE_HANDLE_TYPE; signal ready_in : out std_logic; signal valid_in : in std_logic; signal data_in : in std_logic_vector; signal last_word_in : in std_logic ) is + variable cnt : natural := 0; + begin + while (cnt < 4) loop + ready_in <= '1'; + wait_on_sig(valid_in); + wait for 1 ps; -- Make sure all signals stable + inst(cnt) <= data_in; + if (cnt = 3) then + AlertIf(last_word_in /= '1', "last_word not high", ERROR); + end if; + wait until rising_edge(clk); + cnt := cnt + 1; + ready_in <= '0'; + end loop; + end procedure; + begin + + SetAlertLogName("System - Level 2 - (Type1) - General"); + SetAlertEnable(FAILURE, TRUE); + SetAlertEnable(ERROR, TRUE); + SetAlertEnable(WARNING, TRUE); + SetLogEnable(DEBUG, FALSE); + SetLogEnable(PASSED, FALSE); + SetLogEnable(INFO, TRUE); + RV.InitSeed(RV'instance_name); + + id1 <= RV.RandSlv(CDR_LONG_WIDTH); + id2 <= RV.RandSlv(CDR_LONG_WIDTH); + id3 <= RV.RandSlv(CDR_LONG_WIDTH); + a1 <= RV.RandSlv(CDR_LONG_WIDTH); + a2 <= RV.RandSlv(CDR_LONG_WIDTH); + a3 <= RV.RandSlv(CDR_LONG_WIDTH); + + Log("Initial Reset", INFO); + reset <= '1'; + wait until rising_edge(clk); + wait until rising_edge(clk); + reset <= '0'; + + Log("Register Instance 1", INFO); + start_w <= '1'; + opcode_w <= REGISTER_INSTANCE; + id_w <= id1; + a_w <= (others => '0'); + wait_on_sig(ack_w); + wait until rising_edge(clk); + start_w <= '0'; + get_instance(inst1, ready_out_w, valid_out_w, data_out_w, last_word_out_w); + + Log("Register Instance 2", INFO); + start_w <= '1'; + opcode_w <= REGISTER_INSTANCE; + id_w <= id2; + a_w <= (others => '0'); + wait_on_sig(ack_w); + wait until rising_edge(clk); + start_w <= '0'; + get_instance(inst2, ready_out_w, valid_out_w, data_out_w, last_word_out_w); + + Log("Write Instance 1 Sample 1 (Historical)", INFO); + start_w <= '1'; + opcode_w <= WRITE; + source_ts_w <= TIME_INVALID; + instance_handle_w <= inst1; + id_w <= id1; + a_w <= a1; + wait_on_sig(ack_w); + wait until rising_edge(clk); + start_w <= '0'; + wait_on_sig(done_w); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_w /= RETCODE_OK, "DDS Write Operation Failed", ERROR); + wait until rising_edge(clk); + + Log("Write Instance 2 Sample 1 (Historical)", INFO); + start_w <= '1'; + opcode_w <= WRITE; + source_ts_w <= TIME_INVALID; + instance_handle_w <= inst2; + id_w <= id2; + a_w <= a1; + wait_on_sig(ack_w); + wait until rising_edge(clk); + start_w <= '0'; + wait_on_sig(done_w); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_w /= RETCODE_OK, "DDS Write Operation Failed", ERROR); + wait until rising_edge(clk); + + Log("Write Instance 1 Sample 2 (Historical)", INFO); + start_w <= '1'; + opcode_w <= WRITE; + source_ts_w <= TIME_INVALID; + instance_handle_w <= HANDLE_NIL; + id_w <= id1; + a_w <= a2; + wait_on_sig(ack_w); + wait until rising_edge(clk); + start_w <= '0'; + wait_on_sig(done_w); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_w /= RETCODE_OK, "DDS Write Operation Failed", ERROR); + wait until rising_edge(clk); + + Log("Write Instance 1 Sample 1 (Historical)", INFO); + start_w <= '1'; + opcode_w <= WRITE; + source_ts_w <= TIME_INVALID; + instance_handle_w <= HANDLE_NIL; + id_w <= id2; + a_w <= a2; + wait_on_sig(ack_w); + wait until rising_edge(clk); + start_w <= '0'; + wait_on_sig(done_w); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_w /= RETCODE_OK, "DDS Write Operation Failed", ERROR); + wait until rising_edge(clk); + + -- NOTE: Because the Participant Announcement has not yet happened, the data written is considered historical + -- and will be sent immediately on Endpoint matching. + + Log("Wait on Data Arrival", INFO); + wait_on_data(status_r); + wait until rising_edge(clk); + + Log("Read Sample (Instance 1 Sample 1)", INFO); + start_r <= '1'; + opcode_r <= TAKE_NEXT_SAMPLE; + wait_on_sig(ack_r); + wait until rising_edge(clk); + start_r <= '0'; + wait_on_sig(done_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_r /= RETCODE_OK, "DDS Read Operation Failed", ERROR); + wait until rising_edge(clk); + wait_on_sig(si_valid_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(si_valid_data_r /= '1', "Reader returned no Data", ERROR); + AffirmIfEqual(to_unsigned(INSTANCE_HANDLE_TYPE(si_instance_handle_r)), to_unsigned(inst1)); + si_ack_r <= '1'; + get_data_r <= '1'; + wait until rising_edge(clk); + si_ack_r <= '0'; + get_data_r <= '0'; + wait_on_sig(valid_r); + wait for 1 ps; -- Make sure all signals stable + AffirmIfEqual(id_r, id1); + AffirmIfEqual(a_r, a1); + wait_on_sig(eoc_r); + wait until rising_edge(clk); + + Log("Read Sample (Instance 2 Sample 1)", INFO); + start_r <= '1'; + opcode_r <= TAKE_NEXT_SAMPLE; + wait_on_sig(ack_r); + wait until rising_edge(clk); + start_r <= '0'; + wait_on_sig(done_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_r /= RETCODE_OK, "DDS Read Operation Failed", ERROR); + wait until rising_edge(clk); + wait_on_sig(si_valid_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(si_valid_data_r /= '1', "Reader returned no Data", ERROR); + AffirmIfEqual(to_unsigned(INSTANCE_HANDLE_TYPE(si_instance_handle_r)), to_unsigned(inst2)); + si_ack_r <= '1'; + get_data_r <= '1'; + wait until rising_edge(clk); + si_ack_r <= '0'; + get_data_r <= '0'; + wait_on_sig(valid_r); + wait for 1 ps; -- Make sure all signals stable + AffirmIfEqual(id_r, id2); + AffirmIfEqual(a_r, a1); + wait_on_sig(eoc_r); + wait until rising_edge(clk); + + Log("Read Sample (Instance 1 Sample 2)", INFO); + start_r <= '1'; + opcode_r <= TAKE_NEXT_SAMPLE; + wait_on_sig(ack_r); + wait until rising_edge(clk); + start_r <= '0'; + wait_on_sig(done_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_r /= RETCODE_OK, "DDS Read Operation Failed", ERROR); + wait until rising_edge(clk); + wait_on_sig(si_valid_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(si_valid_data_r /= '1', "Reader returned no Data", ERROR); + AffirmIfEqual(to_unsigned(INSTANCE_HANDLE_TYPE(si_instance_handle_r)), to_unsigned(inst1)); + si_ack_r <= '1'; + get_data_r <= '1'; + wait until rising_edge(clk); + si_ack_r <= '0'; + get_data_r <= '0'; + wait_on_sig(valid_r); + wait for 1 ps; -- Make sure all signals stable + AffirmIfEqual(id_r, id1); + AffirmIfEqual(a_r, a2); + wait_on_sig(eoc_r); + wait until rising_edge(clk); + + Log("Read Sample (Instance 2 Sample 2)", INFO); + start_r <= '1'; + opcode_r <= TAKE_NEXT_SAMPLE; + wait_on_sig(ack_r); + wait until rising_edge(clk); + start_r <= '0'; + wait_on_sig(done_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_r /= RETCODE_OK, "DDS Read Operation Failed", ERROR); + wait until rising_edge(clk); + wait_on_sig(si_valid_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(si_valid_data_r /= '1', "Reader returned no Data", ERROR); + AffirmIfEqual(to_unsigned(INSTANCE_HANDLE_TYPE(si_instance_handle_r)), to_unsigned(inst2)); + si_ack_r <= '1'; + get_data_r <= '1'; + wait until rising_edge(clk); + si_ack_r <= '0'; + get_data_r <= '0'; + wait_on_sig(valid_r); + wait for 1 ps; -- Make sure all signals stable + AffirmIfEqual(id_r, id2); + AffirmIfEqual(a_r, a2); + wait_on_sig(eoc_r); + wait until rising_edge(clk); + + Log("Write Instance 3 Sample 1", INFO); + start_w <= '1'; + opcode_w <= WRITE; + source_ts_w <= TIME_INVALID; + instance_handle_w <= HANDLE_NIL; + id_w <= id3; + a_w <= a3; + wait_on_sig(ack_w); + wait until rising_edge(clk); + start_w <= '0'; + wait_on_sig(done_w); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_w /= RETCODE_OK, "DDS Write Operation Failed", ERROR); + wait until rising_edge(clk); + + Log("Lookup Instance 3", INFO); + start_w <= '1'; + opcode_w <= LOOKUP_INSTANCE; + id_w <= id3; + a_w <= a1; + wait_on_sig(ack_w); + wait until rising_edge(clk); + start_w <= '0'; + get_instance(inst3, ready_out_w, valid_out_w, data_out_w, last_word_out_w); + + Log("Wait on Data Arrival", INFO); + wait_on_data(status_r); + wait until rising_edge(clk); + + Log("Read Sample (Instance 3 Sample 1)", INFO); + start_r <= '1'; + opcode_r <= TAKE_NEXT_SAMPLE; + wait_on_sig(ack_r); + wait until rising_edge(clk); + start_r <= '0'; + wait_on_sig(done_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(return_code_r /= RETCODE_OK, "DDS Read Operation Failed", ERROR); + wait until rising_edge(clk); + wait_on_sig(si_valid_r); + wait for 1 ps; -- Make sure all signals stable + AlertIf(si_valid_data_r /= '1', "Reader returned no Data", ERROR); + AffirmIfEqual(to_unsigned(INSTANCE_HANDLE_TYPE(si_instance_handle_r)), to_unsigned(inst3)); + si_ack_r <= '1'; + get_data_r <= '1'; + wait until rising_edge(clk); + si_ack_r <= '0'; + get_data_r <= '0'; + wait_on_sig(valid_r); + wait for 1 ps; -- Make sure all signals stable + AffirmIfEqual(id_r, id3); + AffirmIfEqual(a_r, a3); + wait_on_sig(eoc_r); + wait until rising_edge(clk); + + TranscriptOpen(RESULTS_FILE, APPEND_MODE); + SetTranscriptMirror; + ReportAlerts; + TranscriptClose; + std.env.stop; + wait; + end process; + + clock_prc : process + begin + clk <= '0'; + wait for TEST_CLOCK_PERIOD/2; + clk <= '1'; + wait for TEST_CLOCK_PERIOD/2; + end process; + + time_prc : process(clk) + begin + if rising_edge(clk) then + if (reset = '1') then + time <= TIME_ZERO; + else + time <= time + gen_duration(0,50); -- 50 ns + end if; + end if; + end process; + + watchdog : process + begin + wait for 1 ms; + Alert("Test timeout", FAILURE); + std.env.stop; + end process; + +end architecture; \ No newline at end of file diff --git a/src/Tests/test_config1.vhd b/src/Tests/test_config1.vhd index 37bca1e..066f074 100644 --- a/src/Tests/test_config1.vhd +++ b/src/Tests/test_config1.vhd @@ -41,7 +41,11 @@ package user_config is --***RTPS ENDPOINTS*** -- Array denoting if Endpoints use Keyed Topics - constant ENDPOINT_WITH_KEY : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => FALSE); + constant ENDPOINT_WITH_KEY : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => FALSE); + + -- Array denoting which mode the Endpoints are operating with + constant ENDPOINT_PUSH_MODE : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => FALSE); + -- Array mapping Topic Names to Endpoints constant ENDPOINT_TOPIC_STRING : USER_STRING_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( 2 => "TOPIC_2" & (8 to 256 => NUL), diff --git a/src/Tests/test_config2.vhd b/src/Tests/test_config2.vhd new file mode 100644 index 0000000..40ec355 --- /dev/null +++ b/src/Tests/test_config2.vhd @@ -0,0 +1,138 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.rtps_package.all; + +package user_config is + + --*****USER CONFIG***** + + -- NOTE: All strings have to be padded to 256 characters + + -- Unicast IPv4 Address used by all RTPS Entities [Default 192.168.0.81] + constant DEFAULT_IPv4_ADDRESS : std_logic_vector(IPv4_ADDRESS_WIDTH-1 downto 0) := x"C0A80081"; + -- Number of RTPS Writer Endpoints + constant NUM_WRITERS : natural := 1; + -- Number of RTPS Reader Endpoints + constant NUM_READERS : natural := 0; + -- Number of RTPS Endpoints (Do not modify) + constant NUM_ENDPOINTS : natural := NUM_READERS+NUM_WRITERS; + -- PB Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_PB : natural := 7400; + -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_DG : natural := 250; + -- PG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_PG : natural := 2; + -- D0 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D0 : natural := 0; + -- D1 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D1 : natural := 10; + -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D2 : natural := 1; + -- D3 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D3 : natural := 11; + -- MAC Address of underlying network stack (Used to generate GUIDs) + constant MAC_ADDRESS : std_logic_vector(47 downto 0) := x"FDE2470828BD"; + -- Domain ID + constant USER_DOMAIN_ID : natural := 1; + -- Domain TAG + constant USER_DOMAIN_TAG : USER_STRING_TYPE := "TEST_DOMAIN" & (12 to 256 => NUL); + + --***RTPS ENDPOINTS*** + -- Array denoting if Endpoints use Keyed Topics + constant ENDPOINT_WITH_KEY : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( + 0 => TRUE + ); + + -- Array denoting which mode the Endpoints are operating with + constant ENDPOINT_PUSH_MODE : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( + 0 => TRUE + ); + + -- Array mapping Topic Names to Endpoints + constant ENDPOINT_TOPIC_STRING : USER_STRING_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( + 0 => "Topic1" & (7 to 256 => NUL) + ); + -- Array mapping Type Names to Endpoints + constant ENDPOINT_TYPE_STRING : USER_STRING_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( + 0 => "Type1" & (6 to 256 => NUL) + ); + -- *TIMING CHARACTERISTICS* + -- Timing Characteristics for Participant + constant PARTICIPANT_ANNOUNCEMENT_PERIOD : DURATION_TYPE := gen_duration(0,50000); -- 50k ns + constant PARTICIPANT_LEASE_DURATION : DURATION_TYPE := DEFAULT_PARTICIPANT_LEASE_DURATION; + -- Denotes how much faster then the deadline/period we schedule in order to account for transport delay. + constant DURATION_DELTA : DURATION_TYPE := gen_duration(0, 100); -- 100 ns + -- Timing Characteristics for built-in Endpoints + constant PARTICIPANT_HEARTBEAT_PERIOD : DURATION_TYPE := gen_duration(0,40000); -- 40k ns + constant PARTICIPANT_HEARTBEAT_RESPONSE_DELAY : DURATION_TYPE := gen_duration(0,500); -- 500 ns + constant PARTICIPANT_HEARTBEAT_SUPPRESSION_DELAY : DURATION_TYPE := gen_duration(0,100); -- 100 ns + constant PARTICIPANT_ACKNACK_RESPONSE_DELAY : DURATION_TYPE := gen_duration(0,500); -- 500 ns + constant PARTICIPANT_ACKNACK_SUPPRESSION_DELAY : DURATION_TYPE := gen_duration(0,100); -- 100 ns + -- Array mapping Timing Characteristics to Endpoints + constant ENDPOINT_HEARTBEAT_PERIOD : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,10000)); -- 10k ns + constant ENDPOINT_HEARTBEAT_RESPONSE_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,500)); -- 500 ns + constant ENDPOINT_HEARTBEAT_SUPPRESSION_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,100)); -- 100 ns + constant ENDPOINT_ACKNACK_RESPONSE_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,500)); -- 500 ns + constant ENDPOINT_ACKNACK_SUPPRESSION_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,100)); -- 100 ns + + + --***ENDPOINT DDS QOS*** + -- Array mapping DURABILITY QoS to Endpoints + constant ENDPOINT_DURABILITY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => TRANSIENT_LOCAL_DURABILITY_QOS); + constant ENDPOINT_DURABILITY_SERVICE_CLEANUP_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_CLEANUP_DELAY); + constant ENDPOINT_DURABILITY_SERVICE_HISTORY : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_HISTORY); + constant ENDPOINT_DURABILITY_SERVICE_HISTORY_DEPTH : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_HISTORY_DEPTH); + constant ENDPOINT_DURABILITY_SERVICE_MAX_SAMPLES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES); + constant ENDPOINT_DURABILITY_SERVICE_MAX_INSTANCES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_INSTANCES); + constant ENDPOINT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE); + -- Array mapping PRESENTATION QoS to Endpoints + constant ENDPOINT_PRESENTATION_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_PRESENTATION_QOS); + constant ENDPOINT_COHERENT_ACCESS : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_COHERENT_ACCESS); + constant ENDPOINT_ORDERED_ACCESS : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_ORDERED_ACCESS); + -- Array mapping DEADLINE QoS to Endpoints + constant ENDPOINT_DEADLINE_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DEADLINE_QOS); + -- Array mapping LATENCY_BUDGET QoS to Endpoints + constant ENDPOINT_LATENCY_BUDGET_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LATENCY_BUDGET_QOS); + -- Array mapping OWNERSHIP QoS to Endpoints + constant ENDPOINT_OWNERSHIP_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_OWNERSHIP_QOS); + -- Array mapping OWNERSHIP_STRENGTH QoS to Endpoints (Only relevant to Writers) + constant ENDPOINT_OWNERSHIP_STRENGTH_QOS : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_OWNERSHIP_STRENGTH_QOS); + -- Array mapping LIVELINESS QoS to Endpoints + constant ENDPOINT_LIVELINESS_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LIVELINESS_QOS); + constant ENDPOINT_LEASE_DURATION : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LEASE_DURATION); + -- Array mapping TIME_BASED_FILTER QoS to Endpoints (Only relevant to Readers) + constant ENDPOINT_TIME_BASED_FILTER_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_TIME_BASED_FILTER_QOS); + -- XXX: PARTITION QoS Ignored + -- Array mapping RELIABILITY QoS to Endpoints + constant ENDPOINT_RELIABILITY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_RELIABILITY_QOS); + -- (Only relevant to Writers) + constant ENDPOINT_MAX_BLOCKING_TIME : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_BLOCKING_TIME); + -- Array mapping TRANSPORT_PRIORITY QoS to Endpoints (Only relevant to Writers) + constant ENDPOINT_TRANSPORT_PRIORITY_QOS : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_TRANSPORT_PRIORITY_QOS); + -- Array mapping LIFESPAN QoS to Endpoints (Only relevant to Writers) + constant ENDPOINT_LIFESPAN_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LIFESPAN_QOS); + -- Array mapping DESTINATION_ORDER QoS to Endpoints + constant ENDPOINT_DESTINATION_ORDER_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DESTINATION_ORDER_QOS); + -- Array mapping HISTORY QoS to Endpoints + constant ENDPOINT_HISTORY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_HISTORY_QOS); + constant ENDPOINT_HISTORY_DEPTH : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_HISTORY_DEPTH); + -- Array mapping RESOURCE_LIMITS QoS to Endpoints + constant ENDPOINT_MAX_SAMPLES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_SAMPLES); + constant ENDPOINT_MAX_INSTANCES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_INSTANCES); + constant ENDPOINT_MAX_SAMPLES_PER_INSTANCE : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_SAMPLES_PER_INSTANCE); + -- XXX: ENTITY_FACTORY QoS Ignored + -- Array mapping WRITER_DATA_LIFECYCLE QoS to Endpoints (Only relevant to Writers) + constant ENDPOINT_AUTODISPOSE_UNREGISTERED_INSTANCES : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTODISPOSE_UNREGISTERED_INSTANCES); + -- Array mapping Reader_DATA_LIFECYCLE QoS to Endpoints (Only relevant to Readers) + constant ENDPOINT_AUTOPURGE_NOWRITER_SAMPLES_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTOPURGE_NOWRITER_SAMPLES_DELAY); + constant ENDPOINT_AUTOPURGE_DISPOSED_SAMPLES_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTOPURGE_DISPOSED_SAMPLES_DELAY); + + -- TESTING PARAMETERS + constant TEST_STRING : string := "TEST_CONFIG_2"; + + -- Set to TRUE for Simulation Testing (Extra Code generated) + constant SIMULATION_FLAG : boolean := TRUE; + +end package; \ No newline at end of file diff --git a/src/Tests/test_config3.vhd b/src/Tests/test_config3.vhd new file mode 100644 index 0000000..34dcb4a --- /dev/null +++ b/src/Tests/test_config3.vhd @@ -0,0 +1,138 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.rtps_package.all; + +package user_config is + + --*****USER CONFIG***** + + -- NOTE: All strings have to be padded to 256 characters + + -- Unicast IPv4 Address used by all RTPS Entities [Default 192.168.0.82] + constant DEFAULT_IPv4_ADDRESS : std_logic_vector(IPv4_ADDRESS_WIDTH-1 downto 0) := x"C0A80082"; + -- Number of RTPS Writer Endpoints + constant NUM_WRITERS : natural := 0; + -- Number of RTPS Reader Endpoints + constant NUM_READERS : natural := 1; + -- Number of RTPS Endpoints (Do not modify) + constant NUM_ENDPOINTS : natural := NUM_READERS+NUM_WRITERS; + -- PB Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_PB : natural := 7400; + -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_DG : natural := 250; + -- PG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_PG : natural := 2; + -- D0 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D0 : natural := 0; + -- D1 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D1 : natural := 10; + -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D2 : natural := 1; + -- D3 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D3 : natural := 11; + -- MAC Address of underlying network stack (Used to generate GUIDs) + constant MAC_ADDRESS : std_logic_vector(47 downto 0) := x"A83BB50DF75E"; + -- Domain ID + constant USER_DOMAIN_ID : natural := 1; + -- Domain TAG + constant USER_DOMAIN_TAG : USER_STRING_TYPE := "TEST_DOMAIN" & (12 to 256 => NUL); + + --***RTPS ENDPOINTS*** + -- Array denoting if Endpoints use Keyed Topics + constant ENDPOINT_WITH_KEY : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( + 0 => TRUE + ); + + -- Array denoting which mode the Endpoints are operating with + constant ENDPOINT_PUSH_MODE : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( + 0 => TRUE + ); + + -- Array mapping Topic Names to Endpoints + constant ENDPOINT_TOPIC_STRING : USER_STRING_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( + 0 => "Topic1" & (7 to 256 => NUL) + ); + -- Array mapping Type Names to Endpoints + constant ENDPOINT_TYPE_STRING : USER_STRING_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := ( + 0 => "Type1" & (6 to 256 => NUL) + ); + -- *TIMING CHARACTERISTICS* + -- Timing Characteristics for Participant + constant PARTICIPANT_ANNOUNCEMENT_PERIOD : DURATION_TYPE := gen_duration(0,50000); -- 50k ns + constant PARTICIPANT_LEASE_DURATION : DURATION_TYPE := DEFAULT_PARTICIPANT_LEASE_DURATION; + -- Denotes how much faster then the deadline/period we schedule in order to account for transport delay. + constant DURATION_DELTA : DURATION_TYPE := gen_duration(0, 100); -- 100 ns + -- Timing Characteristics for built-in Endpoints + constant PARTICIPANT_HEARTBEAT_PERIOD : DURATION_TYPE := gen_duration(0,40000); -- 40k ns + constant PARTICIPANT_HEARTBEAT_RESPONSE_DELAY : DURATION_TYPE := gen_duration(0,500); -- 500 ns + constant PARTICIPANT_HEARTBEAT_SUPPRESSION_DELAY : DURATION_TYPE := gen_duration(0,100); -- 100 ns + constant PARTICIPANT_ACKNACK_RESPONSE_DELAY : DURATION_TYPE := gen_duration(0,500); -- 500 ns + constant PARTICIPANT_ACKNACK_SUPPRESSION_DELAY : DURATION_TYPE := gen_duration(0,100); -- 100 ns + -- Array mapping Timing Characteristics to Endpoints + constant ENDPOINT_HEARTBEAT_PERIOD : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,10000)); -- 10k ns + constant ENDPOINT_HEARTBEAT_RESPONSE_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,500)); -- 500 ns + constant ENDPOINT_HEARTBEAT_SUPPRESSION_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,100)); -- 100 ns + constant ENDPOINT_ACKNACK_RESPONSE_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,500)); -- 500 ns + constant ENDPOINT_ACKNACK_SUPPRESSION_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,100)); -- 100 ns + + + --***ENDPOINT DDS QOS*** + -- Array mapping DURABILITY QoS to Endpoints + constant ENDPOINT_DURABILITY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => TRANSIENT_LOCAL_DURABILITY_QOS); + constant ENDPOINT_DURABILITY_SERVICE_CLEANUP_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_CLEANUP_DELAY); + constant ENDPOINT_DURABILITY_SERVICE_HISTORY : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_HISTORY); + constant ENDPOINT_DURABILITY_SERVICE_HISTORY_DEPTH : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_HISTORY_DEPTH); + constant ENDPOINT_DURABILITY_SERVICE_MAX_SAMPLES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES); + constant ENDPOINT_DURABILITY_SERVICE_MAX_INSTANCES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_INSTANCES); + constant ENDPOINT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE); + -- Array mapping PRESENTATION QoS to Endpoints + constant ENDPOINT_PRESENTATION_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_PRESENTATION_QOS); + constant ENDPOINT_COHERENT_ACCESS : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_COHERENT_ACCESS); + constant ENDPOINT_ORDERED_ACCESS : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_ORDERED_ACCESS); + -- Array mapping DEADLINE QoS to Endpoints + constant ENDPOINT_DEADLINE_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DEADLINE_QOS); + -- Array mapping LATENCY_BUDGET QoS to Endpoints + constant ENDPOINT_LATENCY_BUDGET_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LATENCY_BUDGET_QOS); + -- Array mapping OWNERSHIP QoS to Endpoints + constant ENDPOINT_OWNERSHIP_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_OWNERSHIP_QOS); + -- Array mapping OWNERSHIP_STRENGTH QoS to Endpoints (Only relevant to Writers) + constant ENDPOINT_OWNERSHIP_STRENGTH_QOS : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_OWNERSHIP_STRENGTH_QOS); + -- Array mapping LIVELINESS QoS to Endpoints + constant ENDPOINT_LIVELINESS_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LIVELINESS_QOS); + constant ENDPOINT_LEASE_DURATION : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LEASE_DURATION); + -- Array mapping TIME_BASED_FILTER QoS to Endpoints (Only relevant to Readers) + constant ENDPOINT_TIME_BASED_FILTER_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_TIME_BASED_FILTER_QOS); + -- XXX: PARTITION QoS Ignored + -- Array mapping RELIABILITY QoS to Endpoints + constant ENDPOINT_RELIABILITY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_RELIABILITY_QOS); + -- (Only relevant to Writers) + constant ENDPOINT_MAX_BLOCKING_TIME : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_BLOCKING_TIME); + -- Array mapping TRANSPORT_PRIORITY QoS to Endpoints (Only relevant to Writers) + constant ENDPOINT_TRANSPORT_PRIORITY_QOS : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_TRANSPORT_PRIORITY_QOS); + -- Array mapping LIFESPAN QoS to Endpoints (Only relevant to Writers) + constant ENDPOINT_LIFESPAN_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LIFESPAN_QOS); + -- Array mapping DESTINATION_ORDER QoS to Endpoints + constant ENDPOINT_DESTINATION_ORDER_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DESTINATION_ORDER_QOS); + -- Array mapping HISTORY QoS to Endpoints + constant ENDPOINT_HISTORY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_HISTORY_QOS); + constant ENDPOINT_HISTORY_DEPTH : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_HISTORY_DEPTH); + -- Array mapping RESOURCE_LIMITS QoS to Endpoints + constant ENDPOINT_MAX_SAMPLES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_SAMPLES); + constant ENDPOINT_MAX_INSTANCES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_INSTANCES); + constant ENDPOINT_MAX_SAMPLES_PER_INSTANCE : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_SAMPLES_PER_INSTANCE); + -- XXX: ENTITY_FACTORY QoS Ignored + -- Array mapping WRITER_DATA_LIFECYCLE QoS to Endpoints (Only relevant to Writers) + constant ENDPOINT_AUTODISPOSE_UNREGISTERED_INSTANCES : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTODISPOSE_UNREGISTERED_INSTANCES); + -- Array mapping Reader_DATA_LIFECYCLE QoS to Endpoints (Only relevant to Readers) + constant ENDPOINT_AUTOPURGE_NOWRITER_SAMPLES_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTOPURGE_NOWRITER_SAMPLES_DELAY); + constant ENDPOINT_AUTOPURGE_DISPOSED_SAMPLES_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTOPURGE_DISPOSED_SAMPLES_DELAY); + + -- TESTING PARAMETERS + constant TEST_STRING : string := "TEST_CONFIG_2"; + + -- Set to TRUE for Simulation Testing (Extra Code generated) + constant SIMULATION_FLAG : boolean := TRUE; + +end package; \ No newline at end of file diff --git a/src/Tests/testbench.pro b/src/Tests/testbench.pro index 8522a57..bdd4352 100644 --- a/src/Tests/testbench.pro +++ b/src/Tests/testbench.pro @@ -1,8 +1,57 @@ # Compile OSVVM Library include ../OSVVM/osvvm.pro +library Testbench_Lib2 +analyze ../math_pkg.vhd +analyze ../rtps_package.vhd +analyze test_config2.vhd +analyze ../rtps_config_package.vhd +analyze ../rtps_test_package.vhd +analyze test_ram.vhd +analyze ../FWFT_FIFO.vhd +analyze ../mem_ctrl.vhd +analyze ../rtps_handler.vhd +analyze ../rtps_builtin_endpoint.vhd +analyze ../rtps_out.vhd +analyze ../rtps_reader.vhd +analyze ../rtps_writer.vhd +analyze ../dds_writer.vhd +analyze ../dds_reader.vhd +analyze ../key_holder.vhd +analyze ../key_hash_generator.vhd +analyze test_key_hash_generator.vhd +analyze Type1_package.vhd +analyze Type1_reader_wrapper.vhd +analyze Type1_writer_wrapper.vhd +analyze Type1_key_holder.vhd + +library Testbench_Lib3 +analyze ../math_pkg.vhd +analyze ../rtps_package.vhd +analyze test_config3.vhd +analyze ../rtps_config_package.vhd +analyze ../rtps_test_package.vhd +analyze test_ram.vhd +analyze ../FWFT_FIFO.vhd +analyze ../mem_ctrl.vhd +analyze ../rtps_handler.vhd +analyze ../rtps_builtin_endpoint.vhd +analyze ../rtps_out.vhd +analyze ../rtps_reader.vhd +analyze ../rtps_writer.vhd +analyze ../dds_writer.vhd +analyze ../dds_reader.vhd +analyze ../key_holder.vhd +analyze ../key_hash_generator.vhd +analyze test_key_hash_generator.vhd +analyze Type1_package.vhd +analyze Type1_reader_wrapper.vhd +analyze Type1_writer_wrapper.vhd +analyze Type1_key_holder.vhd + + # Compile -library Testbench-Lib1 +library Testbench_Lib1 analyze ../math_pkg.vhd analyze ../rtps_package.vhd analyze test_config1.vhd @@ -11,8 +60,6 @@ analyze ../rtps_test_package.vhd analyze test_ram.vhd analyze ../FWFT_FIFO.vhd analyze ../mem_ctrl.vhd -analyze ScoreBoard_test_memory.vhd -analyze ScoreBoard_builtin_endpoint.vhd analyze ../rtps_handler.vhd analyze ../rtps_builtin_endpoint.vhd analyze ../rtps_out.vhd @@ -20,6 +67,19 @@ analyze ../rtps_reader.vhd analyze ../rtps_writer.vhd analyze ../dds_writer.vhd analyze ../dds_reader.vhd +analyze ../key_holder.vhd +analyze ../key_hash_generator.vhd +analyze test_key_hash_generator.vhd +analyze Type1_package.vhd +analyze Type1_reader_wrapper.vhd +analyze Type1_writer_wrapper.vhd +analyze Type1_key_holder.vhd +analyze Type2_package.vhd +analyze Type2_reader_wrapper.vhd +analyze Type2_writer_wrapper.vhd +analyze Type2_key_holder.vhd +analyze ScoreBoard_test_memory.vhd +analyze ScoreBoard_builtin_endpoint.vhd analyze Level_0/L0_rtps_handler_test1.vhd analyze Level_0/L0_rtps_handler_test2.vhd analyze Level_0/L0_rtps_builtin_endpoint_test1.vhd @@ -81,17 +141,6 @@ analyze Level_0/L0_dds_reader_test4_arznriu.vhd analyze Level_0/L0_dds_reader_test5_arzkriu.vhd analyze Level_0/L0_dds_reader_test6_arzkriu.vhd analyze Level_0/L0_dds_reader_test7_arzkriu.vhd -analyze ../key_holder.vhd -analyze ../key_hash_generator.vhd -analyze test_key_hash_generator.vhd -analyze Type1_package.vhd -analyze Type1_reader_wrapper.vhd -analyze Type1_writer_wrapper.vhd -analyze Type1_key_holder.vhd -analyze Type2_package.vhd -analyze Type2_reader_wrapper.vhd -analyze Type2_writer_wrapper.vhd -analyze Type2_key_holder.vhd analyze Level_1/L1_Type1_wrapper_test1.vhd analyze Level_1/L1_Type1_wrapper_test2.vhd analyze Level_1/L1_Type1_key_holder_test1.vhd @@ -100,6 +149,9 @@ analyze Level_1/L1_Type2_wrapper_test1.vhd analyze Level_1/L1_Type2_wrapper_test2.vhd analyze Level_1/L1_Type2_key_holder_test1.vhd analyze Level_1/L1_Type2_key_holder_test2.vhd +analyze Level_2/L2_Testbench_Lib2.vhd +analyze Level_2/L2_Testbench_Lib3.vhd +analyze Level_2/L2_Type1_test1.vhd simulate L0_rtps_handler_test1 simulate L0_rtps_handler_test2 @@ -169,4 +221,5 @@ simulate L1_Type1_key_holder_test2 simulate L1_Type2_wrapper_test1 simulate L1_Type2_wrapper_test2 simulate L1_Type2_key_holder_test1 -simulate L1_Type2_key_holder_test2 \ No newline at end of file +simulate L1_Type2_key_holder_test2 +simulate L2_Type1_test1 diff --git a/src/dds_reader.vhd b/src/dds_reader.vhd index 189432c..5a569ab 100644 --- a/src/dds_reader.vhd +++ b/src/dds_reader.vhd @@ -11,18 +11,19 @@ use work.rtps_config_package.all; entity dds_reader is generic ( - TIME_BASED_FILTER_QOS : DURATION_TYPE; - DEADLINE_QOS : DURATION_TYPE; - MAX_INSTANCES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); - MAX_SAMPLES_PER_INSTANCE : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); - MAX_SAMPLES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); - HISTORY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); - RELIABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); - PRESENTATION_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); - DESTINATION_ORDER_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); - COHERENT_ACCESS : boolean; - ORDERED_ACCESS : boolean; - WITH_KEY : boolean; + ID : ID_TYPE := 0; + TIME_BASED_FILTER_QOS : DURATION_TYPE := ENDPOINT_TIME_BASED_FILTER_QOS(ID); + DEADLINE_QOS : DURATION_TYPE := ENDPOINT_DEADLINE_QOS(ID); + MAX_INSTANCES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := ENDPOINT_MAX_INSTANCES(ID); + MAX_SAMPLES_PER_INSTANCE : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := ENDPOINT_MAX_SAMPLES_PER_INSTANCE(ID); + MAX_SAMPLES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := ENDPOINT_MAX_SAMPLES(ID); + HISTORY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_HISTORY_QOS(ID); + RELIABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_RELIABILITY_QOS(ID); + PRESENTATION_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_PRESENTATION_QOS(ID); + DESTINATION_ORDER_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_DESTINATION_ORDER_QOS(ID); + COHERENT_ACCESS : boolean := ENDPOINT_COHERENT_ACCESS(ID); + ORDERED_ACCESS : boolean := ENDPOINT_ORDERED_ACCESS(ID); + WITH_KEY : boolean := ENDPOINT_WITH_KEY(ID); PAYLOAD_FRAME_SIZE : natural; MAX_REMOTE_ENDPOINTS : natural := 50 ); @@ -465,6 +466,7 @@ architecture arch of dds_reader is signal si_absolute_generation_rank_sig, si_absolute_generation_rank_sig_next : unsigned(ABSOLUTE_GENERATION_COUNT_WIDTH-1 downto 0) := (others => '0'); signal si_valid_data_sig, si_valid_data_sig_next : std_logic := '0'; signal si_valid_sig, si_valid_sig_next : std_logic := '0'; + signal eoc_sig, eoc_sig_next : std_logic := '0'; -- *INSTANCE MEMORY PROCESS* -- Instance Memory FSM state @@ -633,6 +635,7 @@ begin si_absolute_generation_rank <= std_logic_vector(si_absolute_generation_rank_sig); si_valid_data <= si_valid_data_sig; si_valid <= si_valid_sig; + eoc <= eoc_sig; status <= status_sig; -- *Main State Machine* @@ -714,6 +717,7 @@ begin si_absolute_generation_rank_sig_next <= si_absolute_generation_rank_sig; si_valid_data_sig_next <= si_valid_data_sig; si_valid_sig_next <= si_valid_sig; + eoc_sig_next <= eoc_sig; sample_state_next <= sample_state; view_state_next <= view_state; instance_state_next <= instance_state; @@ -784,7 +788,6 @@ begin valid_out_dds <= '0'; last_word_out_dds <= '0'; idle_sig <= '0'; - eoc <= '0'; data_out_dds <= (others => '0'); data_out_kh <= (others => '0'); writer_bitmap <= ZERO_WRITER_BITMAP_ARRAY; @@ -993,6 +996,7 @@ begin si_generation_rank_sig_next <= (others => '0'); si_valid_data_sig_next <= '0'; si_valid_sig_next <= '0'; + eoc_sig_next <= '0'; si_absolute_generation_rank_sig_next <= (others => '0'); si_disposed_generation_count_sig_next <= (others => '0'); si_no_writers_generation_count_sig_next <= (others => '0'); @@ -3635,8 +3639,8 @@ begin end if; else -- Mark End of Collection - eoc <= '1'; - stage_next <= IDLE; + eoc_sig_next <= '1'; + stage_next <= IDLE; -- Consecutive Instance Sample Order of multiple Instances if ((not ORDERED_ACCESS or PRESENTATION_QOS = INSTANCE_PRESENTATION_QOS) and single_instance = '0') then -- Unmark Instances @@ -4029,7 +4033,7 @@ begin -- End of Collection if (collection_cnt = max_samples_latch or (sample_p1 = SAMPLE_MEMORY_MAX_ADDRESS and sample_p2 = SAMPLE_MEMORY_MAX_ADDRESS) or (si_sample_rank_sig = 0 and single_instance = '1')) then -- Mark End of Collection - eoc <= '1'; + eoc_sig_next <= '1'; -- Consecutive Instance Sample Order of multiple Instances if ((not ORDERED_ACCESS or PRESENTATION_QOS = INSTANCE_PRESENTATION_QOS) and single_instance = '0') then -- Unmark Instances @@ -6589,6 +6593,7 @@ begin remove_oldest_inst_sample <= '0'; si_valid_data_sig <= '0'; si_valid_sig <= '0'; + eoc_sig <= '0'; is_take <= '0'; single_instance <= '0'; unmark_instances_flag <= '0'; @@ -6676,6 +6681,7 @@ begin remove_oldest_inst_sample <= remove_oldest_inst_sample_next; si_valid_data_sig <= si_valid_data_sig_next; si_valid_sig <= si_valid_sig_next; + eoc_sig <= eoc_sig_next; is_take <= is_take_next; single_instance <= single_instance_next; unmark_instances_flag <= unmark_instances_flag_next; diff --git a/src/dds_writer.vhd b/src/dds_writer.vhd index 33fbb99..982b728 100644 --- a/src/dds_writer.vhd +++ b/src/dds_writer.vhd @@ -11,14 +11,15 @@ use work.rtps_config_package.all; entity dds_writer is generic ( - HISTORY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); - DEADLINE_QOS : DURATION_TYPE; - LIFESPAN_QOS : DURATION_TYPE; - LEASE_DURATION : DURATION_TYPE; - WITH_KEY : boolean; - MAX_SAMPLES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); - MAX_INSTANCES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); - MAX_SAMPLES_PER_INSTANCE : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); + ID : ID_TYPE := 0; + HISTORY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_HISTORY_QOS(ID); + DEADLINE_QOS : DURATION_TYPE := ENDPOINT_DEADLINE_QOS(ID); + LIFESPAN_QOS : DURATION_TYPE := ENDPOINT_LIFESPAN_QOS(ID); + LEASE_DURATION : DURATION_TYPE := ENDPOINT_LEASE_DURATION(ID); + WITH_KEY : boolean := ENDPOINT_WITH_KEY(ID); + MAX_SAMPLES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := ENDPOINT_MAX_SAMPLES(ID); + MAX_INSTANCES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := ENDPOINT_MAX_INSTANCES(ID); + MAX_SAMPLES_PER_INSTANCE : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := ENDPOINT_MAX_SAMPLES_PER_INSTANCE(ID); PAYLOAD_FRAME_SIZE : natural ); port ( diff --git a/src/rtps_builtin_endpoint.vhd b/src/rtps_builtin_endpoint.vhd index f2a2380..15efffb 100644 --- a/src/rtps_builtin_endpoint.vhd +++ b/src/rtps_builtin_endpoint.vhd @@ -32,7 +32,7 @@ end entity; architecture arch of rtps_builtin_endpoint is --*****CONSTANT DECLARATION***** - -- Max Serialized Payload Size in a UDP Stream (Bytes) [MAX_PAYLAOD(65536) - IPv4_HEADER(20) - UDP_HEADER(8) - RTPS_HEADER(20) - DATA_HEADER(24)] + -- Max Serialized Payload Size in a UDP Stream (Bytes) [MAX_PAYLOAD(65536) - IPv4_HEADER(20) - UDP_HEADER(8) - RTPS_HEADER(20) - DATA_HEADER(24)] constant UDP_MAX_SIZE_SERIALIZED : natural := 65464; -- Highest Sequence Number of Publisher Data constant PUB_SEQUENCENUMBER : SEQUENCENUMBER_TYPE := to_double_word(to_unsigned(NUM_WRITERS, 64)); @@ -1463,10 +1463,11 @@ begin end if; when PROCESS_GAP_SEQUENCE_NUMBERS => -- Precondition: participant_data set (PMF_PUB_SEQ_NR_FLAG/PMF_SUB_SEQ_NR_FLAG/PMF_MES_SEQ_NR_FLAG) - assert_sn; -- Wait for Sequence Number to be fetched from buffer if (mem_op_done = '1') then + assert_sn; + -- DEFAULT stage_next <= SKIP_PACKET; @@ -2768,10 +2769,11 @@ begin end if; when PARTICIPANT_MATCH_STAGE => -- Precondition: participant_data set (PMF_SPDP_SEQ_NR_FLAG/PMF_PUB_SEQ_NR_FLAG/PMF_SUB_SEQ_NR_FLAG/PMF_MES_SEQ_NR_FLAG) - assert_sn; -- Wait for Participant Search to finish if (mem_op_done = '1') then + assert_sn; + -- Participant not in Buffer if (mem_addr_base = PARTICIPANT_MEMORY_MAX_ADDRESS) then -- Participant Match @@ -3371,7 +3373,7 @@ begin assert check_mask(current_pmf, PMF_EXTRA_FLAGS_FLAG) severity FAILURE; -- If Subscriber Data not scheduled for response or no Readers available, skip - if (not check_mask(participant_data.extra_flags, EF_PUB_DATA_FLAG) or NUM_READERS = 0) then + if (not check_mask(participant_data.extra_flags, EF_SUB_DATA_FLAG) or NUM_READERS = 0) then stage_next <= SEND_MES_MAN_LIVE; cnt_next <= 0; -- Output FIFO Guard diff --git a/src/rtps_config_package.vhd b/src/rtps_config_package.vhd index 0562bbf..37a657a 100644 --- a/src/rtps_config_package.vhd +++ b/src/rtps_config_package.vhd @@ -10,6 +10,7 @@ use work.user_config.all; package rtps_config_package is + subtype ID_TYPE is natural range 0 to NUM_ENDPOINTS-1; constant VENDORID : std_logic_vector(VENDORID_WIDTH-1 downto 0) := VENDORID_UNKNOWN; constant GUIDPREFIX : GUIDPREFIX_TYPE; -- Deferred to Package Body type ENTITYID_TYPE is array (0 to NUM_ENDPOINTS-1) of std_logic_vector(ENTITYID_WIDTH-1 downto 0); @@ -76,7 +77,7 @@ package rtps_config_package is constant DEFAULT_IS_BEST_EFFORT_FLAG : std_logic := '0'; -- Marks the Reader Endpoint in the Endpoint Array - constant ENDPOINT_READERS : std_logic_vector(0 to NUM_ENDPOINTS-1) := (0 to NUM_READERS-1 => '1', others => '0'); + constant ENDPOINT_READERS : std_logic_vector(0 to NUM_ENDPOINTS-1); --Deferred to package body -- Marks the writers with AUTOMATIC Liveliness Qos constant AUTOMATIC_LIVELINESS_WRITERS : std_logic_vector(0 to NUM_ENDPOINTS-1); --Deferred to package body @@ -210,6 +211,17 @@ package body rtps_config_package is end loop; end procedure; + + function gen_endpoint_readers return std_logic_vector is + variable ret : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0'); + begin + ret := (others => '0'); + ret(0 to NUM_READERS-1) := (others => '1'); + return ret; + end function; + + constant ENDPOINT_READERS : std_logic_vector(0 to NUM_ENDPOINTS-1) := gen_endpoint_readers; + function boolean_to_std_logic(input : boolean) return std_logic is variable ret : std_logic := '0'; begin @@ -742,7 +754,13 @@ package body rtps_config_package is variable ind : natural := 0; variable tmp : natural := 0; begin - assert (id >= NUM_READERS) report "Inline Qos can only be generated for Writer Endpoints" severity FAILURE; + -- NOTE: We cannot fail, because the default values of some generics may attempt to generate invalid values before overwritten. + --assert (id >= NUM_READERS) report "Inline Qos can only be generated for Writer Endpoints" severity FAILURE; + if (id < NUM_READERS) then + report "Inline Qos can only be generated for Writer Endpoints (Attempted on ID " & integer'image(id) & ")" severity WARNING; + return ret; + end if; + -- TOPIC NAME tmp := string_len(ENDPOINT_TOPIC(id)); diff --git a/src/rtps_out.vhd b/src/rtps_out.vhd index a974a8b..a01b1be 100644 --- a/src/rtps_out.vhd +++ b/src/rtps_out.vhd @@ -8,7 +8,8 @@ use work.rtps_config_package.all; entity rtps_out is generic ( - MAX_BUFFER_SIZE : natural := 65508/4 + -- Max Serialized Payload Size in a UDP Stream (Bytes) [MAX_PAYLOAD(65536) - IPv4_HEADER(20) - UDP_HEADER(8) + FORMAT_HEADER(16)] + MAX_BUFFER_SIZE : natural := 65524/4 ); port ( clk : in std_logic; diff --git a/src/rtps_reader.vhd b/src/rtps_reader.vhd index 804f9f4..5e21cb0 100644 --- a/src/rtps_reader.vhd +++ b/src/rtps_reader.vhd @@ -12,14 +12,15 @@ use work.rtps_config_package.all; entity rtps_reader is generic ( - ENTITYID : std_logic_vector(ENTITYID_WIDTH-1 downto 0); - RELIABILITY_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; + ID : ID_TYPE := 0; + ENTITYID : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := ENTITYID(ID); + RELIABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_RELIABILITY_QOS(ID); + LIVELINESS_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_LIVELINESS_QOS(ID); + DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_DURABILITY_QOS(ID); + HEARTBEAT_RESPONSE_DELAY : DURATION_TYPE := ENDPOINT_HEARTBEAT_RESPONSE_DELAY(ID); + HEARTBEAT_SUPPRESSION_DELAY : DURATION_TYPE := ENDPOINT_HEARTBEAT_SUPPRESSION_DELAY(ID); + LEASE_DURATION : DURATION_TYPE := ENDPOINT_LEASE_DURATION(ID); + WITH_KEY : boolean := ENDPOINT_WITH_KEY(ID); MAX_REMOTE_ENDPOINTS : natural := 50 ); port ( diff --git a/src/rtps_writer.vhd b/src/rtps_writer.vhd index bd82d47..ae8027e 100644 --- a/src/rtps_writer.vhd +++ b/src/rtps_writer.vhd @@ -11,18 +11,19 @@ use work.rtps_config_package.all; entity rtps_writer is generic ( - RELIABILITY_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); - DESTINATION_ORDER_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); - ACKNACK_RESPONSE_DELAY : DURATION_TYPE; - ACKNACK_SUPPRESSION_DELAY : DURATION_TYPE; - LEASE_DURATION : DURATION_TYPE; - HEARTBEAT_PERIOD : DURATION_TYPE; - ENTITYID : std_logic_vector(ENTITYID_WIDTH-1 downto 0); - WITH_KEY : boolean; - PUSH_MODE : boolean; - INLINE_QOS : OUTPUT_DATA_TYPE; + ID : ID_TYPE := 0; + RELIABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_RELIABILITY_QOS(ID); + LIVELINESS_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_LIVELINESS_QOS(ID); + DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_DURABILITY_QOS(ID); + DESTINATION_ORDER_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := ENDPOINT_DESTINATION_ORDER_QOS(ID); + ACKNACK_RESPONSE_DELAY : DURATION_TYPE := ENDPOINT_ACKNACK_RESPONSE_DELAY(ID); + ACKNACK_SUPPRESSION_DELAY : DURATION_TYPE := ENDPOINT_ACKNACK_SUPPRESSION_DELAY(ID); + LEASE_DURATION : DURATION_TYPE := ENDPOINT_LEASE_DURATION(ID); + HEARTBEAT_PERIOD : DURATION_TYPE := ENDPOINT_HEARTBEAT_PERIOD(ID); + ENTITYID : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := ENTITYID(ID); + WITH_KEY : boolean := ENDPOINT_WITH_KEY(ID); + PUSH_MODE : boolean := ENDPOINT_PUSH_MODE(ID); + INLINE_QOS : OUTPUT_DATA_TYPE := gen_inline_qos(ID); MAX_REMOTE_ENDPOINTS : natural := 50 ); port ( @@ -1613,7 +1614,7 @@ begin end if; -- Pre-Check when 4 => - -- No Cache CHanges Available + -- No Cache Changes Available if (min_sn = SEQUENCENUMBER_UNKNOWN) then -- Reset historical_push_next <= '0';