* Add new DEFAULT values in packages

* Add test RAM (Used for testbenches)
* Add Data Structures and functions to check memory contents
* Add rtps_builtin_endpoint_test1
	- Compiles and Passes
* Various bug fixes in rtps_builtin_endpoint to Pass testbench
This commit is contained in:
Greek 2020-11-23 12:20:05 +01:00
parent 16bd4558de
commit 521e2466f5
11 changed files with 1138 additions and 309 deletions

View File

@ -0,0 +1,68 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -divider SYSTEM
add wave -noupdate /rtps_builtin_endpoint_test1/uut/clk
add wave -noupdate /rtps_builtin_endpoint_test1/uut/reset
add wave -noupdate -divider INPUT
add wave -noupdate /rtps_builtin_endpoint_test1/uut/empty
add wave -noupdate /rtps_builtin_endpoint_test1/uut/rd
add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test1/uut/data_in
add wave -noupdate /rtps_builtin_endpoint_test1/uut/last_word_in
add wave -noupdate /rtps_builtin_endpoint_test1/uut/last_word_in_latch
add wave -noupdate -divider TESTBENCH
add wave -noupdate /rtps_builtin_endpoint_test1/start
add wave -noupdate /rtps_builtin_endpoint_test1/stim_stage
add wave -noupdate /rtps_builtin_endpoint_test1/stimulus.length
add wave -noupdate /rtps_builtin_endpoint_test1/cnt_stim
add wave -noupdate /rtps_builtin_endpoint_test1/packet_sent
add wave -noupdate /rtps_builtin_endpoint_test1/SB.ItemNumberVar
add wave -noupdate -divider {MAIN FSM}
add wave -noupdate /rtps_builtin_endpoint_test1/uut/stage
add wave -noupdate /rtps_builtin_endpoint_test1/uut/stage_next
add wave -noupdate /rtps_builtin_endpoint_test1/uut/cnt
add wave -noupdate /rtps_builtin_endpoint_test1/uut/endpoint_mask
add wave -noupdate /rtps_builtin_endpoint_test1/uut/participant_match
add wave -noupdate -divider {MEM FSM}
add wave -noupdate /rtps_builtin_endpoint_test1/uut/mem_opcode
add wave -noupdate /rtps_builtin_endpoint_test1/uut/mem_op_start
add wave -noupdate /rtps_builtin_endpoint_test1/uut/mem_op_done
add wave -noupdate /rtps_builtin_endpoint_test1/uut/mem_stage
add wave -noupdate /rtps_builtin_endpoint_test1/uut/mem_stage_next
add wave -noupdate /rtps_builtin_endpoint_test1/uut/mem_cnt
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/mem_addr_base
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/addr_res
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/last_addr
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/max_participant_addr
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/max_endpoint_addr
add wave -noupdate -divider GUARD
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/read_cnt
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/parameter_end
add wave -noupdate /rtps_builtin_endpoint_test1/uut/parse_prc/rd_guard
add wave -noupdate -divider MEMORY
add wave -noupdate -group MEMORY -radix unsigned /rtps_builtin_endpoint_test1/uut/ram_inst/addr
add wave -noupdate -group MEMORY /rtps_builtin_endpoint_test1/uut/ram_inst/wen
add wave -noupdate -group MEMORY /rtps_builtin_endpoint_test1/uut/ram_inst/ren
add wave -noupdate -group MEMORY -radix hexadecimal /rtps_builtin_endpoint_test1/uut/ram_inst/wr_data
add wave -noupdate -group MEMORY -radix hexadecimal /rtps_builtin_endpoint_test1/uut/ram_inst/rd_data
add wave -noupdate -divider MISC
add wave -noupdate /rtps_builtin_endpoint_test1/uut/update_participant_flags
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/mem_seq_nr
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/seq_nr
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {15299092 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 149
configure wave -valuecolwidth 144
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 ps
update
WaveRestoreZoom {14808192 ps} {15956534 ps}

View File

@ -175,51 +175,51 @@ PARTICICPANT DATA
31............24..............16..............8...............0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-------------------------------------------------------------+
01| |
00| |
+ +
02| GUIDPREFIX |
01| GUIDPREFIX |
+ +
03| |
02| |
+-------------------------------------------------------------+
04| META_IPv4_ADDRESS |
03| META_IPv4_ADDRESS |
+-------------------------------------------------------------+
05| DEFAULT_IPv4_ADDRESS |
04| DEFAULT_IPv4_ADDRESS |
+-------------------------------------------------------------+
06| META_UDP_PORT | DEFAULT_UDP_PORT |
05| META_UDP_PORT | DEFAULT_UDP_PORT |
+-------------------------------------------------------------+
07| |
06| |
+ SPDP_SEQ_NR +
07| |
+-------------------------------------------------------------+
08| |
+-------------------------------------------------------------+
09| |
+ LEASE_DURATION +
09| |
+-------------------------------------------------------------+
10| |
+-------------------------------------------------------------+
11| |
+ LEASE_DEADLINE +
12| |
11| |
+-------------------------------------------------------------+
13| UNUSED |P|S|M|Q|
12| UNUSED |P|S|M|Q|
+-------------------------------------------------------------+
14| |
13| |
+ ACKNACK_RES_TIME +
14| |
+-------------------------------------------------------------+
15| |
+-------------------------------------------------------------+
16| |
+ HEARTBEAT_RES_TIME +
16| |
+-------------------------------------------------------------+
17| |
+-------------------------------------------------------------+
18| |
+ PUBLICATION_SEQ_NR +
18| |
+-------------------------------------------------------------+
19| |
+-------------------------------------------------------------+
20| |
+ SUBSCRIPTION_SEQ_NR +
21| |
20| |
+-------------------------------------------------------------+
22| |
21| |
+ MESSAGE_SEQ_NR +
23| |
22| |
+-------------------------------------------------------------+
ENDPOINT DATA

View File

@ -0,0 +1,593 @@
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library osvvm; -- Utility Library
context osvvm.OsvvmContext;
use work.rtps_package.all;
use work.user_config.all;
use work.rtps_config_package.all;
use work.rtps_test_package.all;
entity rtps_builtin_endpoint_test1 is
end entity;
architecture testbench of rtps_builtin_endpoint_test1 is
-- *COMPONENT DECLARATION*
component rtps_builtin_endpoint is
port (
clk : in std_logic;
reset : in std_logic;
empty : in std_logic;
rd : out std_logic;
data_in : in std_logic_vector(WORD_WIDTH-1 downto 0);
data_out : out std_logic_vector(WORD_WIDTH-1 downto 0);
last_word_in : in std_logic;
time : in TIME_TYPE;
endpoint_full : in std_logic_vector(0 to NUM_ENDPOINTS-1);
endpoint_wr : out std_logic_vector(0 to NUM_ENDPOINTS-1);
rtps_wr : out std_logic;
rtps_full : in std_logic;
last_word_out : out std_logic;
alive : in std_logic_vector(0 to NUM_ENDPOINTS-1)
);
end component;
-- *TYPE DECLARATION*
type TEST_STAGE_TYPE is (IDLE, BUSY);
-- *SIGNAL DECLARATION*
signal clk, in_empty, rd_sig, last_word_in, last_word_out: std_logic := '0';
signal reset : std_logic := '1'; --TODO: Do that in all testbenches
signal data_in, data_out : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0');
signal stim_stage : TEST_STAGE_TYPE := IDLE;
shared variable stimulus : TEST_PACKET_TYPE := EMPTY_TEST_PACKET;
signal packet_sent : std_logic := '0';
signal cnt_stim : natural := 0;
signal start : std_logic := '0';
shared variable SB : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType;
-- *FUNCTION DECLARATION*
procedure wait_on_complete is
begin
wait until rising_edge(packet_sent);
end procedure;
begin
-- Unit Under Test
uut : rtps_builtin_endpoint
port map (
clk => clk,
reset => reset,
empty => in_empty or packet_sent,
rd => rd_sig,
data_in => data_in,
data_out => data_out,
last_word_in => last_word_in,
time => TIME_ZERO,
endpoint_full => (others => '0'),
endpoint_wr => open,
rtps_wr => open,
rtps_full => '0',
last_word_out => last_word_out,
alive => (others => '0')
);
stimulus_prc : process
variable rtps_sub : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE;
variable check_cnt : natural := 0;
variable RV : RandomPType;
variable participant : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA;
variable p0, p1, p2 : GUIDPREFIX_TYPE;
-- Wrapper to use procedure as function
impure function gen_rand_loc_2 return LOCATOR_TYPE is
variable ret : LOCATOR_TYPE := EMPTY_LOCATOR;
begin
gen_rand_loc(RV, ret);
return ret;
end function;
impure function gen_rand_guid_prefix return GUIDPREFIX_TYPE is
variable ret : GUIDPREFIX_TYPE;
begin
ret := (0 => RV.RandSlv(WORD_WIDTH), 1 => RV.RandSlv(WORD_WIDTH), 2 => RV.RandSlv(WORD_WIDTH));
return ret;
end function;
procedure start_test is
begin
start <= '1';
wait until rising_edge(clk);
start <= '0';
wait until rising_edge(clk);
end procedure;
begin
SetAlertLogName("L0-rtps_builtin_endpoint-participant_matching");
SetAlertEnable(FAILURE, TRUE);
SetAlertEnable(ERROR, TRUE);
SetAlertEnable(WARNING, TRUE);
SetLogEnable(DEBUG, FALSE);
SetLogEnable(PASSED, FALSE);
SetLogEnable(INFO, TRUE);
RV.InitSeed(RV'instance_name);
-- NOTE: A single incremented Sequence Number is used for all the Participants. This should not be a problem for
-- the best effort participant data, as long as it is monotonically increasing.
rtps_sub := DEFAULT_RTPS_SUBMESSAGE;
rtps_sub.submessageID := SID_DATA;
rtps_sub.writerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_ANNOUNCER;
rtps_sub.readerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_DETECTOR;
rtps_sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
p0 := gen_rand_guid_prefix;
p1 := gen_rand_guid_prefix;
p2 := gen_rand_guid_prefix;
Log("Initiating Test", INFO);
start <= '0';
reset <= '1';
wait until rising_edge(clk);
wait until rising_edge(clk);
reset <= '0';
Log("Match Participant 0 [Compatible]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p0;
participant.nr := 0;
participant.match := MATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,0,0]
Log("Match Participant 1 [Compatible, Little Endian]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p1;
participant.nr := 1;
participant.littleEndian := '1';
participant.match := MATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,p1,0]
Log("Ignore Participant 2 [Incompatible Domain ID]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p2;
participant.nr := 2;
participant.domainId := int(2, DOMAIN_ID_WIDTH);
participant.match := UNMATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,p1,0]
Log("Unmatch Participant 0 [Incompatible Domain ID]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p0;
participant.nr := 0;
participant.domainId := int(2, DOMAIN_ID_WIDTH);
participant.match := UNMATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [0,p1,0]
Log("Ignore Participant 2 [Incompatible Domain TAG]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p2;
participant.nr := 2;
participant.domainTag := DEFAULT_DOMAIN_TAG;
participant.match := UNMATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [0,p1,0]
Log("Unmatch Participant 1 [Incompatible Domain TAG]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p1;
participant.nr := 1;
participant.domainTag := DEFAULT_DOMAIN_TAG;
participant.match := UNMATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [0,0,0]
Log("Match Participant 0 [+Unicast Metatraffic Locator]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p0;
participant.nr := 0;
participant.match := MATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.metatrafficUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,0,0]
Log("Match Participant 1 [ALL Values Set non default]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p1;
participant.nr := 1;
participant.vendorId := RV.RandSlv(VENDORID_WIDTH);
participant.expectsInlineQoS(0) := '1';
participant.leaseDuration := gen_duration(5,500);
participant.manualLivelinessCount := int(6, CDR_LONG_WIDTH);
participant.builtinEndpointQoS(0) := '1';
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.defaultMulticastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.metatrafficUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.metatrafficMulticastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.match := MATCH;
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,p1,0]
Log("Ignore Participant 2 [Incompatible Protocol Version]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p2;
participant.nr := 2;
participant.protocolVersion := PROTOCOLVERSION_1_0;
participant.match := UNMATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,p1,0]
Log("Unmatch Participant 0 [Incompatible Protocol Version]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p0;
participant.nr := 0;
participant.protocolVersion := PROTOCOLVERSION_1_0;
participant.match := UNMATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [0,p1,0]
Log("Match Participant 0 [Compatible, Only Subscribers]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p0;
participant.nr := 0;
participant.match := MATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,p1,0]
Log("Match Participant 2 [Compatible, Only Publishers]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p2;
participant.nr := 2;
participant.match := MATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,p1,p2]
Log("Update Participant 1 [Valid/Invalid Default/Metatraffic Locators]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p1;
participant.nr := 1;
participant.match := MATCH;
participant.defaultUnicastLocatorList := (numLocators => int(4,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, 1 => gen_rand_loc_2, 2 => gen_rand_loc_2, 3 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.defaultUnicastLocatorList.locator(1).kind := LOCATOR_KIND_UDPv6;
participant.defaultUnicastLocatorList.locator(2).addr := (others => '0');
participant.defaultUnicastLocatorList.locator(3).portn := (others => '0');
participant.defaultMulticastLocatorList := (numLocators => int(4,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, 1 => gen_rand_loc_2, 2 => gen_rand_loc_2, 3 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.defaultMulticastLocatorList.locator(1).kind := LOCATOR_KIND_UDPv6;
participant.defaultMulticastLocatorList.locator(2).portn := (others => '0');
participant.defaultMulticastLocatorList.locator(3).addr := (others => '0');
participant.metatrafficUnicastLocatorList := (numLocators => int(4,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, 1 => gen_rand_loc_2, 2 => gen_rand_loc_2, 3 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.metatrafficUnicastLocatorList.locator(1).kind := LOCATOR_KIND_UDPv6;
participant.metatrafficUnicastLocatorList.locator(2).addr := (others => '0');
participant.metatrafficUnicastLocatorList.locator(3).portn := (others => '0');
participant.metatrafficMulticastLocatorList := (numLocators => int(4,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, 1 => gen_rand_loc_2, 2 => gen_rand_loc_2, 3 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.metatrafficMulticastLocatorList.locator(1).kind := LOCATOR_KIND_UDPv6;
participant.metatrafficMulticastLocatorList.locator(2).portn := (others => '0');
participant.metatrafficMulticastLocatorList.locator(3).addr := (others => '0');
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,p1,p2]
Log("Unmatch Participant 2 [No Endpoints]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p2;
participant.nr := 2;
participant.match := UNMATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [p0,p1,0]
Log("Unmatch Participant 0 [Incompatible Built-in Endpoints]", INFO);
participant := DEFAULT_PARTICIPANT_DATA;
participant.guidPrefix := p0;
participant.nr := 0;
participant.match := UNMATCH;
participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
participant.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
gen_participant_data(participant, rtps_sub.data);
gen_sentinel(rtps_sub.data);
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, participant.guidPrefix, stimulus);
SB.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_complete;
check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length;
stimulus := EMPTY_TEST_PACKET;
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.writerSN := rtps_sub.writerSN + 1;
-- MEMORY STATE [0,p1,0]
-- LAST PACKET
-- Mark Packet as non-standard Payload, in order to trigger the packet to be skipped (as early as possible)
rtps_sub.data := EMPTY_TEST_PACKET;
rtps_sub.flags(SUBMESSAGE_NON_STANDARD_PAYLOAD_FLAG_POS):= '1';
gen_rtps_handler_out(rtps_sub, gen_rand_loc_2, TRUE, TIME_INVALID, p0, stimulus);
start_test;
wait_on_complete;
AlertIf(GetAffirmCount < check_cnt, "Incomplete test run");
ReportAlerts;
wait; --TODO: Remove
std.env.stop;
wait;
end process;
clock_prc : process
begin
clk <= '0';
wait for 25 ns;
clk <= '1';
wait for 25 ns;
end process;
fifo_ctl_prc : process
begin
in_empty <= '0';
wait; --TODO: Remove
wait until rising_edge(clk);
in_empty <= '1';
wait until rising_edge(clk);
end process;
alert_prc : process(all)
begin
if rising_edge(clk) then
alertif(in_empty = '1' and rd_sig = '1', "Input FIFO read signal high while empty signal high", ERROR);
end if;
end process;
input_prc : process(all)
begin
data_in <= stimulus.data(cnt_stim);
last_word_in <= stimulus.last(cnt_stim);
case (stim_stage) is
when IDLE =>
packet_sent <= '1';
when BUSY =>
packet_sent <= '0';
end case;
if rising_edge(clk) then
if (reset = '1') then
cnt_stim <= 0;
stim_stage <= IDLE;
else
case (stim_stage) is
when IDLE =>
if (start = '1') then
stim_stage <= BUSY;
cnt_stim <= 0;
end if;
when BUSY =>
if (cnt_stim = stimulus.length) then
stim_stage <= IDLE;
elsif (rd_sig = '1') then
cnt_stim <= cnt_stim + 1;
end if;
end case;
end if;
end if;
end process;
output_prc : process
alias mem is <<signal uut.ram_inst.mem : TEST_RAM_TYPE>>;
alias mem_op_done is <<signal uut.mem_op_done : std_logic>>;
variable reference : TEST_PARTICIPANT_MEMORY_FRAME_TYPE;
begin
-- SAFEGUARD: (Prevent Fall-through Behavior)
if (reset /= '0') then
wait until reset = '0';
end if;
-- NOTE: The first read after the packet is sent signifies that the State Machine has begun processing the next packet.
-- The memory operation that could still be in progress is the last one concerning the last sent packet.
wait until packet_sent = '1';
if (rd_sig /= '1') then
wait until rd_sig = '1';
end if;
if (mem_op_done /= '1') then
wait until mem_op_done = '1';
end if;
if (not SB.empty) then
SB.Pop(reference);
for i in 0 to reference'length-1 loop
AffirmIf(?? (mem(reference(i).addr) ?= reference(i).data), "Address: " & integer'image(reference(i).addr) & " Received: " & to_hstring(mem(reference(i).addr)) & " Expected: " & to_hstring(reference(i).data));
end loop;
end if;
end process;
watchdog : process
begin
wait for 5 ms;
Alert("Test timeout", FAILURE);
std.env.stop;
end process;
end architecture;

View File

@ -0,0 +1,17 @@
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library osvvm; -- Utility Library
context osvvm.OsvvmContext;
use work.rtps_test_package.all;
package ScoreBoardPkg_MemoryTest is new osvvm.ScoreboardGenericPkg
generic map (
ExpectedType => TEST_MEMORY_TYPE,
ActualType => TEST_MEMORY_TYPE,
Match => test_memory_match,
expected_to_string => to_string,
actual_to_string => to_string
);

View File

@ -37,7 +37,7 @@ package user_config is
-- Domain ID
constant USER_DOMAIN_ID : natural := 1;
-- Domain TAG
constant USER_DOMAIN_TAG : string(1 to 256) := (others => NUL); --""
constant USER_DOMAIN_TAG : USER_STRING_TYPE := "TEST_DOMAIN" & (12 to 256 => NUL);
--***RTPS ENDPOINTS***
-- Array denoting if Endpoints use Keyed Topics

51
src/Tests/test_ram.vhd Normal file
View File

@ -0,0 +1,51 @@
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.rtps_test_package.all;
entity single_port_ram is
generic (
ADDR_WIDTH : natural := 8;
DATA_WIDTH : natural := 12;
MEMORY_DEPTH : natural := 256
);
port (
clk : in std_logic;
addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
wen : in std_logic;
ren : in std_logic;
wr_data : in std_logic_vector(DATA_WIDTH-1 downto 0);
rd_data : out std_logic_vector(DATA_WIDTH-1 downto 0)
);
end entity;
architecture arch of single_port_ram is
signal mem : TEST_RAM_TYPE := (others => (others => '0'));
begin
assert (TEST_RAM_TYPE'length = MEMORY_DEPTH) report "TEST_RAM_TYPE does not respect Memory Depth" severity FAILURE;
ram_prc : process(all)
begin
if rising_edge(clk) then
rd_data <= (others => '0');
if (wen = '1') then
mem(to_integer(unsigned(addr))) <= wr_data;
end if;
if (ren = '1') then
if (wen = '1') then
rd_data <= wr_data;
else
rd_data <= mem(to_integer(unsigned(addr)));
end if;
end if;
end if;
end process;
end architecture;

View File

@ -9,8 +9,13 @@ analyze test_config.vhd
analyze ../rtps_config_package.vhd
analyze ../rtps_test_package.vhd
analyze ../rtps_handler.vhd
analyze ../rtps_builtin_endpoint.vhd
analyze test_ram.vhd
analyze ScoreBoard_test_memory.vhd
analyze Level_0/rtps_handler_test1.vhd
analyze Level_0/rtps_handler_test2.vhd
analyze Level_0/rtps_builtin_endpoint_test1.vhd
simulate rtps_handler_test1
simulate rtps_handler_test2
#simulate rtps_handler_test1
#simulate rtps_handler_test2
simulate rtps_builtin_endpoint_test1

File diff suppressed because it is too large Load Diff

View File

@ -69,12 +69,14 @@ package rtps_config_package is
type STRING_WORD_ARRAY_TYPE is array (0 to (256/(WORD_WIDTH/8))-1) of std_logic_vector(WORD_WIDTH-1 downto 0);
type ENDPOINT_STRING_TYPE is array (0 to NUM_ENDPOINTS-1) of STRING_WORD_ARRAY_TYPE;
constant ENDPOINT_TOPIC : ENDPOINT_STRING_TYPE; --Deferred to package body
constant ENDPOINT_TYPE : ENDPOINT_STRING_TYPE; --Deferred to package body
constant DOMAIN_TAG : STRING_WORD_ARRAY_TYPE; -- Deferred to package body
constant ENDPOINT_TOPIC : ENDPOINT_STRING_TYPE; --Deferred to package body
constant ENDPOINT_TYPE : ENDPOINT_STRING_TYPE; --Deferred to package body
constant DOMAIN_TAG : STRING_WORD_ARRAY_TYPE; -- Deferred to package body
constant DEFAULT_DOMAIN_TAG : STRING_WORD_ARRAY_TYPE; -- Deferred to package body
-- TODO: Use everywhere
constant EMPTY_STRING : STRING_WORD_ARRAY_TYPE := (others => (others => '0'));
-- Swap "data" to Big Endian representation.
function endian_swap(swap : std_logic; data : std_logic_vector) return std_logic_vector;
function endian_swap(swap : std_logic; data : unsigned) return unsigned;
@ -82,7 +84,7 @@ package rtps_config_package is
function string_len (str : STRING_WORD_ARRAY_TYPE) return natural;
function boolean_to_std_logic(input : boolean) return std_logic;
function convert_string (str : string(1 to 256)) return STRING_WORD_ARRAY_TYPE;
function convert_string (str : USER_STRING_TYPE) return STRING_WORD_ARRAY_TYPE;
function round_slv(slv : std_logic_vector; width : natural) return std_logic_vector;
end package;
@ -228,7 +230,7 @@ package body rtps_config_package is
constant MIN_ENDPOINT_LEASE_DURATION : DURATION_TYPE := find_min_lease_duration;
function convert_string (str : string(1 to 256)) return STRING_WORD_ARRAY_TYPE is
function convert_string (str : USER_STRING_TYPE) return STRING_WORD_ARRAY_TYPE is
variable ret : STRING_WORD_ARRAY_TYPE := (others => (others => '0'));
begin
ret := (others => (others => '0'));
@ -248,23 +250,30 @@ package body rtps_config_package is
return ret;
end function;
constant ENDPOINT_TOPIC : ENDPOINT_STRING_TYPE := convert_endpoint_string(ENDPOINT_TOPIC_STRING);
constant ENDPOINT_TYPE : ENDPOINT_STRING_TYPE := convert_endpoint_string(ENDPOINT_TYPE_STRING);
constant DOMAIN_TAG : STRING_WORD_ARRAY_TYPE := convert_string(USER_DOMAIN_TAG);
constant ENDPOINT_TOPIC : ENDPOINT_STRING_TYPE := convert_endpoint_string(ENDPOINT_TOPIC_STRING);
constant ENDPOINT_TYPE : ENDPOINT_STRING_TYPE := convert_endpoint_string(ENDPOINT_TYPE_STRING);
constant DOMAIN_TAG : STRING_WORD_ARRAY_TYPE := convert_string(USER_DOMAIN_TAG);
constant DEFAULT_DOMAIN_TAG : STRING_WORD_ARRAY_TYPE := convert_string(DEFAULT_USER_DOMAIN_TAG);
function string_len (str : STRING_WORD_ARRAY_TYPE) return natural is
variable ret : natural := 0;
variable ret : natural := 0;
variable done : boolean := FALSE;
begin
ret := 0;
ret := 0;
done := FALSE;
for i in 0 to str'length-1 loop
for j in 0 to (WORD_WIDTH/BYTE_WIDTH)-1 loop
-- Count Bytes
ret := ret + 1;
-- Exit on first NULL byte (NULL Byte included in count)
if (str(i)(WORD_WIDTH-(j*BYTE_WIDTH)-1 downto WORD_WIDTH-(j*BYTE_WIDTH)-BYTE_WIDTH) = (BYTE_WIDTH-1 downto 0 => '0')) then
done := TRUE;
exit;
end if;
end loop;
if (done) then
exit;
end if;
end loop;
return ret;
end function;
@ -613,7 +622,7 @@ package body rtps_config_package is
len := len + 1;
ret.data(ind+len):= DOMAIN_ID;
-- DOMAIN TAG
if (DOMAIN_TAG /= EMPTY_STRING) then
if (DOMAIN_TAG /= DEFAULT_DOMAIN_TAG) then
tmp := string_len(DOMAIN_TAG);
len := len + 1;
ret.data(ind+len) := PID_DOMAIN_TAG & std_logic_vector(to_unsigned((round_div(tmp,4)+1)*4, 16));

View File

@ -113,49 +113,49 @@ package rtps_package is
-- *PARAMETER IDs*
constant PID_PAD : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0000";
constant PID_SENTINEL : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0001";
constant PID_TOPIC_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0005";
constant PID_TYPE_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0007";
constant PID_USER_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002c";
constant PID_GROUP_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002d";
constant PID_TOPIC_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002e";
constant PID_DURABILITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001d";
constant PID_DURABILITY_SERVICE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001e";
constant PID_DEADLINE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0023";
constant PID_LATENCY_BUDGET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0027";
constant PID_LIVELINESS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001b";
constant PID_RELIABILITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001a";
constant PID_LIFESPAN : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002b";
constant PID_DESTINATION_ORDER : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0025";
constant PID_HISTORY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0040";
constant PID_RESOURCE_LIMITS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0041";
constant PID_OWNERSHIP : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001f";
constant PID_OWNERSHIP_STRENGTH : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0006";
constant PID_PRESENTATION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0021";
constant PID_PARTITION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0029";
constant PID_PARTICIPANT_LEASE_DURATION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0002";
constant PID_TIME_BASED_FILTER : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0004";
constant PID_TRANSPORT_PRIORITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0049";
constant PID_TOPIC_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0005";
constant PID_OWNERSHIP_STRENGTH : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0006";
constant PID_TYPE_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0007";
constant PID_DOMAIN_ID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"000f";
constant PID_DOMAIN_TAG : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"4014";
constant PID_PROTOCOL_VERSION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0015";
constant PID_VENDORID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0016";
constant PID_RELIABILITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001a";
constant PID_LIVELINESS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001b";
constant PID_DURABILITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001d";
constant PID_DURABILITY_SERVICE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001e";
constant PID_OWNERSHIP : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001f";
constant PID_PRESENTATION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0021";
constant PID_DEADLINE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0023";
constant PID_DESTINATION_ORDER : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0025";
constant PID_LATENCY_BUDGET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0027";
constant PID_PARTITION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0029";
constant PID_LIFESPAN : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002b";
constant PID_USER_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002c";
constant PID_GROUP_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002d";
constant PID_TOPIC_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002e";
constant PID_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002f";
constant PID_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0030";
constant PID_DEFAULT_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0031";
constant PID_DEFAULT_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0048";
constant PID_METATRAFFIC_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0032";
constant PID_METATRAFFIC_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0033";
constant PID_EXPECTS_INLINE_QOS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0043";
constant PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0034";
constant PID_PARTICIPANT_LEASE_DURATION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0002";
constant PID_CONTENT_FILTER_PROPERTY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0035";
constant PID_HISTORY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0040";
constant PID_RESOURCE_LIMITS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0041";
constant PID_EXPECTS_INLINE_QOS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0043";
constant PID_DEFAULT_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0048";
constant PID_TRANSPORT_PRIORITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0049";
constant PID_PARTICIPANT_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0050";
constant PID_GROUP_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0052";
constant PID_BUILTIN_ENDPOINT_SET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0058";
constant PID_BUILTIN_ENDPOINT_QOS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0077";
constant PID_PROPERTY_LIST : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0059";
constant PID_ENDPOINT_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"005a";
constant PID_DATA_MAX_SIZE_SERIALIZED : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0060";
constant PID_ENTITY_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0062";
constant PID_ENDPOINT_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"005a";
constant PID_BUILTIN_ENDPOINT_QOS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0077";
-- INLINE-QOS ONLY
constant PID_CONTENT_FILTER_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0055";
constant PID_COHERENT_SET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0056";
@ -297,6 +297,8 @@ package rtps_package is
constant DEFAULT_PARTICIPANT_LEASE_DURATION : DURATION_TYPE; -- Deferred to package Body (100 s)
constant DEFAULT_EXPECTS_INLINE_QOS : std_logic := '0';
-- *BUILTIN ENDPOINT SET POSITIONS*
constant DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER : natural := 0;
constant DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR : natural := 1;
@ -320,11 +322,14 @@ package rtps_package is
--*CUSTOM TYPES*
type USER_BOOLEAN_ARRAY_TYPE is array (natural range <>) of boolean;
type USER_STRING_ARRAY_TYPE is array (natural range <>) of string(1 to 256);
subtype USER_STRING_TYPE is string(1 to 256);
type USER_STRING_ARRAY_TYPE is array (natural range <>) of USER_STRING_TYPE;
type USER_DURATION_ARRAY_TYPE is array (natural range <>) of DURATION_TYPE;
type USER_ENUMERATION_ARRAY_TYPE is array (natural range <>) of std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0);
type USER_LONG_ARRAY_TYPE is array (natural range <>) of std_logic_vector(CDR_LONG_WIDTH-1 downto 0);
constant DEFAULT_USER_DOMAIN_TAG : USER_STRING_TYPE := (others => NUL);
-- *OVERLOAD FUNCTIONS*
function convert_from_double_word (input: DOUBLE_WORD_ARRAY) return unsigned;
function convert_to_double_word (input: unsigned(63 downto 0)) return DOUBLE_WORD_ARRAY;

View File

@ -217,6 +217,8 @@ package rtps_test_package is
procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE);
procedure gen_sentinel(output : inout TEST_PACKET_TYPE);
procedure gen_rand_loc(RV : inout RandomPType; ret : out LOCATOR_TYPE);
function int(n : integer; width : natural) return std_logic_vector;
@ -877,8 +879,9 @@ package body rtps_test_package is
output.data(output.length) := endian_swap(ref.littleEndian, ref.domainId);
output.length := output.length + 1;
-- DOMAIN TAG
if (ref.domainTag /= EMPTY_STRING) then
if (ref.domainTag /= DEFAULT_DOMAIN_TAG) then
tmp := string_len(ref.domainTag);
report "Strlen domain_tag = " & to_string(tmp);
output.data(output.length) := PID_DOMAIN_TAG & endian_swap(ref.littleEndian, int((round_div(tmp,4)+1)*4, PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, int(tmp, CDR_LONG_WIDTH));
@ -901,7 +904,7 @@ package body rtps_test_package is
output.data(output.length)(31 downto 16) := ref.vendorId;
output.length := output.length + 1;
-- EXPECTS IN-LINE QOS
if (ref.expectsInlineQoS(0) /= '0') then
if (ref.expectsInlineQoS(0) /= DEFAULT_EXPECTS_INLINE_QOS) then
output.data(output.length) := PID_EXPECTS_INLINE_QOS & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := (others => '0');
@ -911,11 +914,9 @@ package body rtps_test_package is
-- METATRAFFIC MULTICAST LOCATOR
if (ref.metatrafficMulticastLocatorList.numLocators /= (ref.metatrafficMulticastLocatorList.numLocators'range => '0')) then
tmp := to_integer(unsigned(ref.metatrafficMulticastLocatorList.numLocators));
output.data(output.length) := PID_METATRAFFIC_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(((tmp*6)+1)*4,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.metatrafficMulticastLocatorList.numLocators);
output.length := output.length + 1;
for i in 0 to tmp-1 loop
output.data(output.length) := PID_METATRAFFIC_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.metatrafficMulticastLocatorList.locator(i).kind);
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.metatrafficMulticastLocatorList.locator(i).portn);
@ -933,11 +934,9 @@ package body rtps_test_package is
-- METATRAFFIC UNICAST LOCATOR
if (ref.metatrafficUnicastLocatorList.numLocators /= (ref.metatrafficUnicastLocatorList.numLocators'range => '0')) then
tmp := to_integer(unsigned(ref.metatrafficUnicastLocatorList.numLocators));
output.data(output.length) := PID_METATRAFFIC_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(((tmp*6)+1)*4,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.metatrafficUnicastLocatorList.numLocators);
output.length := output.length + 1;
for i in 0 to tmp-1 loop
output.data(output.length) := PID_METATRAFFIC_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.metatrafficUnicastLocatorList.locator(i).kind);
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.metatrafficUnicastLocatorList.locator(i).portn);
@ -955,11 +954,9 @@ package body rtps_test_package is
-- DEFAULT MULTICAST LOCATOR
if (ref.defaultMulticastLocatorList.numLocators /= (ref.defaultMulticastLocatorList.numLocators'range => '0')) then
tmp := to_integer(unsigned(ref.defaultMulticastLocatorList.numLocators));
output.data(output.length) := PID_METATRAFFIC_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(((tmp*6)+1)*4,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.defaultMulticastLocatorList.numLocators);
output.length := output.length + 1;
for i in 0 to tmp-1 loop
output.data(output.length) := PID_DEFAULT_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.defaultMulticastLocatorList.locator(i).kind);
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.defaultMulticastLocatorList.locator(i).portn);
@ -978,11 +975,9 @@ package body rtps_test_package is
assert (unsigned(ref.defaultUnicastLocatorList.numLocators) > 0) report "PARTICIPANT_DATA: Participant needs to have at least one Default Unicast Locator." severity error;
if (ref.defaultUnicastLocatorList.numLocators /= (ref.defaultUnicastLocatorList.numLocators'range => '0')) then
tmp := to_integer(unsigned(ref.defaultUnicastLocatorList.numLocators));
output.data(output.length) := PID_METATRAFFIC_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(((tmp*6)+1)*4,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.defaultUnicastLocatorList.numLocators);
output.length := output.length + 1;
for i in 0 to tmp-1 loop
output.data(output.length) := PID_DEFAULT_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH));
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.defaultUnicastLocatorList.locator(i).kind);
output.length := output.length + 1;
output.data(output.length) := endian_swap(ref.littleEndian, ref.defaultUnicastLocatorList.locator(i).portn);
@ -1097,28 +1092,27 @@ package body rtps_test_package is
else
ret(i).data := (others => '-');
end if;
-- SPDP Sequence Number 1/2
when 6 =>
-- Ignored
ret(i).data := (others => '-');
-- SPDP Sequence Number 2/2
when 8 =>
-- Ignored
ret(i).data := (others => '-');
-- Lease Duration 1/2
when 9 =>
when 8 =>
if (ref.match = MATCH) then
ret(i).data := std_logic_vector(ref.leaseDuration(0));
else
ret(i).data := (others => '-');
end if;
-- Lease Duration 2/2
when 10 =>
when 9 =>
if (ref.match = MATCH) then
ret(i).data := std_logic_vector(ref.leaseDuration(1));
else
ret(i).data := (others => '-');
end if;
-- EXTRA FLAGS
when 12 =>
if (ref.match = MATCH) then
ret(i).data := (0 => ref.expectsInlineQoS(0), others => '-');
else
ret(i).data := (others => '-');
end if;
-- Other Fields Ignored
when others =>
ret(i).data := (others => '-');
@ -1378,6 +1372,12 @@ package body rtps_test_package is
end if;
end procedure;
procedure gen_sentinel(output : inout TEST_PACKET_TYPE) is
begin
output.data(output.length) := PID_SENTINEL & (PARAMETER_LENGTH_WIDTH-1 downto 0 => '0');
output.length := output.length + 1;
end procedure;
function test_memory_match (A,B : TEST_MEMORY_TYPE) return boolean is
begin
if (A'length /= B'length) then