* Add rtps_builtin_endpoint_test6
- Compiling and Passing * Bug Fix in rtps_builtin_endpoint to make testbench pass
This commit is contained in:
parent
013510bce1
commit
69b6da2dda
71
sim/rtps_builtin_endpoint_test6.do
Normal file
71
sim/rtps_builtin_endpoint_test6.do
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
onerror {resume}
|
||||||
|
quietly WaveActivateNextPane {} 0
|
||||||
|
add wave -noupdate -divider SYSTEM
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/clk
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/reset
|
||||||
|
add wave -noupdate -divider INPUT
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/empty
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/rd
|
||||||
|
add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test6/uut/data_in
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/last_word_in
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/last_word_in_latch
|
||||||
|
add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test6/uut/time
|
||||||
|
add wave -noupdate -divider OUTPUT
|
||||||
|
add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test6/uut/data_out
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/endpoint_wr
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/last_word_out
|
||||||
|
add wave -noupdate -divider TESTBENCH
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/start
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/stim_stage
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/stimulus.length
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/cnt_stim
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/packet_sent
|
||||||
|
add wave -noupdate -divider {MAIN FSM}
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/stage
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/stage_next
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/cnt
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/endpoint_mask
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/participant_match
|
||||||
|
add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test6/uut/lease_duration
|
||||||
|
add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test6/uut/deadline
|
||||||
|
add wave -noupdate -divider {MEM FSM}
|
||||||
|
add wave -noupdate -expand -group MEM_FSM /rtps_builtin_endpoint_test6/uut/mem_opcode
|
||||||
|
add wave -noupdate -expand -group MEM_FSM /rtps_builtin_endpoint_test6/uut/mem_op_start
|
||||||
|
add wave -noupdate -expand -group MEM_FSM /rtps_builtin_endpoint_test6/uut/mem_op_done
|
||||||
|
add wave -noupdate -expand -group MEM_FSM /rtps_builtin_endpoint_test6/uut/mem_stage
|
||||||
|
add wave -noupdate -expand -group MEM_FSM /rtps_builtin_endpoint_test6/uut/mem_stage_next
|
||||||
|
add wave -noupdate -expand -group MEM_FSM /rtps_builtin_endpoint_test6/uut/mem_cnt
|
||||||
|
add wave -noupdate -expand -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test6/uut/mem_addr_base
|
||||||
|
add wave -noupdate -expand -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test6/uut/addr_res
|
||||||
|
add wave -noupdate -divider GUARD
|
||||||
|
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test6/uut/read_cnt
|
||||||
|
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test6/uut/parameter_end
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/parse_prc/rd_guard
|
||||||
|
add wave -noupdate -divider MEMORY
|
||||||
|
add wave -noupdate -expand -group MEMORY -radix unsigned /rtps_builtin_endpoint_test6/uut/ram_inst/addr
|
||||||
|
add wave -noupdate -expand -group MEMORY /rtps_builtin_endpoint_test6/uut/ram_inst/wen
|
||||||
|
add wave -noupdate -expand -group MEMORY /rtps_builtin_endpoint_test6/uut/ram_inst/ren
|
||||||
|
add wave -noupdate -expand -group MEMORY -radix hexadecimal /rtps_builtin_endpoint_test6/uut/ram_inst/wr_data
|
||||||
|
add wave -noupdate -expand -group MEMORY -radix hexadecimal /rtps_builtin_endpoint_test6/uut/ram_inst/rd_data
|
||||||
|
add wave -noupdate -divider MISC
|
||||||
|
add wave -noupdate /rtps_builtin_endpoint_test6/uut/update_participant_flags
|
||||||
|
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test6/uut/mem_seq_nr
|
||||||
|
add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test6/uut/seq_nr
|
||||||
|
TreeUpdate [SetDefaultTree]
|
||||||
|
WaveRestoreCursors {Begin {31125000 ps} 1} {Error {45825000 ps} 1} {Cursor {31192063 ps} 0}
|
||||||
|
quietly wave cursor active 3
|
||||||
|
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 ns
|
||||||
|
update
|
||||||
|
WaveRestoreZoom {30675309 ps} {31823651 ps}
|
||||||
405
src/Tests/Level_0/rtps_builtin_endpoint_test6.vhd
Normal file
405
src/Tests/Level_0/rtps_builtin_endpoint_test6.vhd
Normal file
@ -0,0 +1,405 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
-- This testbench tests the stale participant handling of the rtps_builtin_endpoint.
|
||||||
|
-- It first matches 3 Participants: Participant 0 with default lease duration 100s, Participant 1 with lease duration 10s, and Participant 2 with lease duration 30s.
|
||||||
|
-- After matching the time is artificially progressed to 15s (from 0s), and the removal of Participant 1 is checked. Than the time is again artificially progressed to 101s
|
||||||
|
-- and the removal of Participant 0 and 2 is checked (in that order).
|
||||||
|
-- Note that dummy packets are sent in between to trigger the memory contents checks, since the stale checks are done in between packet processing.
|
||||||
|
|
||||||
|
entity rtps_builtin_endpoint_test6 is
|
||||||
|
end entity;
|
||||||
|
|
||||||
|
architecture testbench of rtps_builtin_endpoint_test6 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';
|
||||||
|
signal endpoint_wr, endpoint_full : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0');
|
||||||
|
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, reference : 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_out : work.ScoreBoardPkg_builtin_endpoint.ScoreBoardPType;
|
||||||
|
shared variable SB_mem : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType;
|
||||||
|
signal stim_done, check_done, mem_check : std_logic := '0';
|
||||||
|
signal test_time : TIME_TYPE := TIME_ZERO;
|
||||||
|
|
||||||
|
-- *FUNCTION DECLARATION*
|
||||||
|
procedure wait_on_complete is
|
||||||
|
begin
|
||||||
|
wait until rising_edge(packet_sent);
|
||||||
|
end procedure;
|
||||||
|
|
||||||
|
function gen_sn(input : natural) return SEQUENCENUMBER_TYPE is
|
||||||
|
variable ret : SEQUENCENUMBER_TYPE;
|
||||||
|
begin
|
||||||
|
ret(0) := (others => '0');
|
||||||
|
ret(1) := unsigned(int(input, WORD_WIDTH));
|
||||||
|
return ret;
|
||||||
|
end function;
|
||||||
|
|
||||||
|
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 => test_time,
|
||||||
|
endpoint_full => endpoint_full,
|
||||||
|
endpoint_wr => endpoint_wr,
|
||||||
|
rtps_wr => open,
|
||||||
|
rtps_full => '0',
|
||||||
|
last_word_out => last_word_out,
|
||||||
|
alive => (others => '0')
|
||||||
|
);
|
||||||
|
|
||||||
|
stimulus_prc : process
|
||||||
|
variable sub : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE;
|
||||||
|
variable RV : RandomPType;
|
||||||
|
variable p0, p1, p2, participant : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA;
|
||||||
|
variable p_sn : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER;
|
||||||
|
variable wr_sig : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0');
|
||||||
|
|
||||||
|
-- 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_entityid_2(reader : boolean) return std_logic_vector is
|
||||||
|
variable ret : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0');
|
||||||
|
begin
|
||||||
|
gen_rand_entityid(RV, reader, ret);
|
||||||
|
return ret;
|
||||||
|
end function;
|
||||||
|
|
||||||
|
procedure push_participant_reference is
|
||||||
|
variable wr_sig : std_logic_vector(NUM_ENDPOINTS-1 downto 0) := (others => '1');
|
||||||
|
begin
|
||||||
|
gen_participant_match_frame(participant, reference);
|
||||||
|
for i in 0 to reference.length-1 loop
|
||||||
|
SB_out.Push(wr_sig & reference.last(i) & reference.data(i));
|
||||||
|
end loop;
|
||||||
|
reference := EMPTY_TEST_PACKET;
|
||||||
|
end procedure;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
assert (TEST_STRING = "TEST_CONFIG_1") report "user_config incompatible with testbench." severity FAILURE;
|
||||||
|
|
||||||
|
SetAlertLogName("L0-rtps_builtin_endpoint-stale_participant_handling");
|
||||||
|
SetAlertEnable(FAILURE, TRUE);
|
||||||
|
SetAlertEnable(ERROR, TRUE);
|
||||||
|
SetAlertEnable(WARNING, TRUE);
|
||||||
|
SetLogEnable(DEBUG, FALSE);
|
||||||
|
SetLogEnable(PASSED, FALSE);
|
||||||
|
SetLogEnable(INFO, TRUE);
|
||||||
|
RV.InitSeed(RV'instance_name);
|
||||||
|
|
||||||
|
-- Participant RTPS Submessage
|
||||||
|
sub := DEFAULT_RTPS_SUBMESSAGE;
|
||||||
|
sub.submessageID := SID_DATA;
|
||||||
|
sub.writerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_ANNOUNCER;
|
||||||
|
sub.readerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_DETECTOR;
|
||||||
|
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
|
||||||
|
|
||||||
|
-- Participant 0 (Default Lease Time 100 s)
|
||||||
|
p0.guidPrefix := gen_rand_guid_prefix;
|
||||||
|
p0.nr := 0;
|
||||||
|
p0.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
|
||||||
|
p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
|
||||||
|
p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
|
||||||
|
p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
|
||||||
|
p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
|
||||||
|
|
||||||
|
-- Participant 1 (Lease Duration 10 s)
|
||||||
|
p1.guidPrefix := gen_rand_guid_prefix;
|
||||||
|
p1.nr := 1;
|
||||||
|
p1.leaseDuration := gen_duration(10,0);
|
||||||
|
p1.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
|
||||||
|
p1.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
|
||||||
|
p1.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
|
||||||
|
p1.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
|
||||||
|
p1.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
|
||||||
|
|
||||||
|
-- Participant 2 (Lease Duration 30 s)
|
||||||
|
p2.guidPrefix := gen_rand_guid_prefix;
|
||||||
|
p2.nr := 2;
|
||||||
|
p2.leaseDuration := gen_duration(30,0);
|
||||||
|
p2.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
|
||||||
|
p2.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1';
|
||||||
|
p2.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1';
|
||||||
|
p2.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1';
|
||||||
|
p2.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1';
|
||||||
|
|
||||||
|
Log("Initiating Test", INFO);
|
||||||
|
test_time <= TIME_ZERO;
|
||||||
|
stim_done <= '0';
|
||||||
|
start <= '0';
|
||||||
|
reset <= '1';
|
||||||
|
wait until rising_edge(clk);
|
||||||
|
wait until rising_edge(clk);
|
||||||
|
reset <= '0';
|
||||||
|
|
||||||
|
-- *PARTICIPANT*
|
||||||
|
Log("Current Time 0s", INFO);
|
||||||
|
Log("Match Participant 0 [Default Lease 100s]", INFO);
|
||||||
|
sub.writerSN := p_sn;
|
||||||
|
participant := p0;
|
||||||
|
gen_participant_data(participant, sub.data);
|
||||||
|
gen_sentinel(sub.data);
|
||||||
|
gen_rtps_handler_out(sub, participant, stimulus);
|
||||||
|
SB_mem.Push(gen_participant_mem_frame(participant));
|
||||||
|
start_test;
|
||||||
|
wait_on_complete;
|
||||||
|
stimulus := EMPTY_TEST_PACKET;
|
||||||
|
reference := EMPTY_TEST_PACKET;
|
||||||
|
sub.data := EMPTY_TEST_PACKET;
|
||||||
|
p_sn := p_sn + 1;
|
||||||
|
|
||||||
|
Log("Match Participant 1 [Lease 10s]", INFO);
|
||||||
|
sub.writerSN := p_sn;
|
||||||
|
participant := p1;
|
||||||
|
gen_participant_data(participant, sub.data);
|
||||||
|
gen_sentinel(sub.data);
|
||||||
|
gen_rtps_handler_out(sub, participant, stimulus);
|
||||||
|
SB_mem.Push(gen_participant_mem_frame(participant));
|
||||||
|
start_test;
|
||||||
|
wait_on_complete;
|
||||||
|
stimulus := EMPTY_TEST_PACKET;
|
||||||
|
reference := EMPTY_TEST_PACKET;
|
||||||
|
sub.data := EMPTY_TEST_PACKET;
|
||||||
|
p_sn := p_sn + 1;
|
||||||
|
|
||||||
|
Log("Match Participant 2 [Lease 30s]", INFO);
|
||||||
|
sub.writerSN := p_sn;
|
||||||
|
participant := p2;
|
||||||
|
gen_participant_data(participant, sub.data);
|
||||||
|
gen_sentinel(sub.data);
|
||||||
|
gen_rtps_handler_out(sub, participant, stimulus);
|
||||||
|
SB_mem.Push(gen_participant_mem_frame(participant));
|
||||||
|
start_test;
|
||||||
|
wait_on_complete;
|
||||||
|
stimulus := EMPTY_TEST_PACKET;
|
||||||
|
reference := EMPTY_TEST_PACKET;
|
||||||
|
sub.data := EMPTY_TEST_PACKET;
|
||||||
|
p_sn := p_sn + 1;
|
||||||
|
|
||||||
|
-- DUMMY PACKET (Trigger last mem check)
|
||||||
|
-- Mark Packet as non-standard Payload, in order to trigger the packet to be skipped (as early as possible)
|
||||||
|
sub.data := EMPTY_TEST_PACKET;
|
||||||
|
sub.flags(SUBMESSAGE_NON_STANDARD_PAYLOAD_FLAG_POS):= '1';
|
||||||
|
gen_rtps_handler_out(sub, participant, stimulus);
|
||||||
|
|
||||||
|
participant := p1;
|
||||||
|
participant.match := UNMATCH;
|
||||||
|
push_participant_reference;
|
||||||
|
SB_mem.Push(gen_participant_mem_frame(participant));
|
||||||
|
|
||||||
|
Log("Current Time 15 s", INFO);
|
||||||
|
start_test;
|
||||||
|
-- Progress Time (15 s)
|
||||||
|
test_time <= (unsigned(int(15, CDR_LONG_WIDTH)), unsigned(int(0, CDR_LONG_WIDTH)));
|
||||||
|
wait_on_complete;
|
||||||
|
|
||||||
|
start_test;
|
||||||
|
wait_on_complete;
|
||||||
|
|
||||||
|
Log("Current Time 101 s", INFO);
|
||||||
|
test_time <= (unsigned(int(101, CDR_LONG_WIDTH)), unsigned(int(0, CDR_LONG_WIDTH)));
|
||||||
|
|
||||||
|
participant := p0;
|
||||||
|
participant.match := UNMATCH;
|
||||||
|
push_participant_reference;
|
||||||
|
SB_mem.Push(gen_participant_mem_frame(participant));
|
||||||
|
|
||||||
|
start_test;
|
||||||
|
wait_on_complete;
|
||||||
|
|
||||||
|
participant := p2;
|
||||||
|
participant.match := UNMATCH;
|
||||||
|
push_participant_reference;
|
||||||
|
SB_mem.Push(gen_participant_mem_frame(participant));
|
||||||
|
|
||||||
|
start_test;
|
||||||
|
wait_on_complete;
|
||||||
|
|
||||||
|
TranscriptOpen(RESULTS_FILE, APPEND_MODE);
|
||||||
|
SetTranscriptMirror;
|
||||||
|
stim_done <= '1';
|
||||||
|
wait until check_done = '1';
|
||||||
|
AlertIf((not SB_out.empty) or (not SB_mem.empty), "Incomplete test run");
|
||||||
|
ReportAlerts;
|
||||||
|
TranscriptClose;
|
||||||
|
std.env.stop;
|
||||||
|
wait;
|
||||||
|
end process;
|
||||||
|
|
||||||
|
clock_prc : process
|
||||||
|
begin
|
||||||
|
clk <= '0';
|
||||||
|
wait for 25 ns;
|
||||||
|
clk <= '1';
|
||||||
|
wait for 25 ns;
|
||||||
|
end process;
|
||||||
|
|
||||||
|
in_empty_prc : process
|
||||||
|
begin
|
||||||
|
in_empty <= '0';
|
||||||
|
wait until rd_sig = '1';
|
||||||
|
wait until rising_edge(clk);
|
||||||
|
in_empty <= '1';
|
||||||
|
wait until rising_edge(clk);
|
||||||
|
end process;
|
||||||
|
|
||||||
|
endpoint_full_prc : process
|
||||||
|
begin
|
||||||
|
endpoint_full <= (others => '0');
|
||||||
|
wait until (or endpoint_wr) = '1';
|
||||||
|
wait until rising_edge(clk);
|
||||||
|
endpoint_full <= (others => '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);
|
||||||
|
alertif(endpoint_full /= (0 to NUM_ENDPOINTS-1 => '0') and (endpoint_wr /= (0 to NUM_ENDPOINTS-1 => '0')), "Endpoint FIFO write signal high while full 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);
|
||||||
|
|
||||||
|
if rising_edge(clk) then
|
||||||
|
if (reset = '1') then
|
||||||
|
cnt_stim <= 0;
|
||||||
|
stim_stage <= IDLE;
|
||||||
|
packet_sent <= '1';
|
||||||
|
else
|
||||||
|
case (stim_stage) is
|
||||||
|
when IDLE =>
|
||||||
|
if (start = '1' and stimulus.length /= 0) then
|
||||||
|
stim_stage <= BUSY;
|
||||||
|
cnt_stim <= 0;
|
||||||
|
packet_sent <= '0';
|
||||||
|
end if;
|
||||||
|
when BUSY =>
|
||||||
|
if (rd_sig = '1') then
|
||||||
|
if (cnt_stim = stimulus.length-1) then
|
||||||
|
stim_stage <= IDLE;
|
||||||
|
packet_sent <= '1';
|
||||||
|
else
|
||||||
|
cnt_stim <= cnt_stim + 1;
|
||||||
|
end if;
|
||||||
|
end if;
|
||||||
|
end case;
|
||||||
|
end if;
|
||||||
|
end if;
|
||||||
|
end process;
|
||||||
|
|
||||||
|
output_check_prc : process(all)
|
||||||
|
begin
|
||||||
|
check_done <= '0';
|
||||||
|
if rising_edge(clk) then
|
||||||
|
if (endpoint_wr /= (0 to NUM_ENDPOINTS-1 => '0')) then
|
||||||
|
SB_out.Check(endpoint_wr & last_word_out & data_out);
|
||||||
|
end if;
|
||||||
|
if (stim_done = '1' and SB_out.empty) then
|
||||||
|
check_done <= '1';
|
||||||
|
end if;
|
||||||
|
end if;
|
||||||
|
end process;
|
||||||
|
|
||||||
|
mem_check_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';
|
||||||
|
wait until rising_edge(rd_sig);
|
||||||
|
if (mem_op_done /= '1') then
|
||||||
|
wait until mem_op_done = '1';
|
||||||
|
end if;
|
||||||
|
if (not SB_mem.empty) then
|
||||||
|
SB_mem.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 1 ms;
|
||||||
|
Alert("Test timeout", FAILURE);
|
||||||
|
std.env.stop;
|
||||||
|
end process;
|
||||||
|
|
||||||
|
end architecture;
|
||||||
@ -62,7 +62,6 @@ architecture testbench of rtps_out_test1 is
|
|||||||
signal last_word_in, rd_sig, empty : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0');
|
signal last_word_in, rd_sig, empty : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0');
|
||||||
|
|
||||||
signal stim_stage : TEST_STAGE_ARRAY_TYPE := (others => IDLE);
|
signal stim_stage : TEST_STAGE_ARRAY_TYPE := (others => IDLE);
|
||||||
shared variable reference : TEST_PACKET_TYPE := EMPTY_TEST_PACKET;
|
|
||||||
shared variable stimulus : TEST_PACKET_ARRAY_TYPE := (others => EMPTY_TEST_PACKET);
|
shared variable stimulus : TEST_PACKET_ARRAY_TYPE := (others => EMPTY_TEST_PACKET);
|
||||||
|
|
||||||
signal packet_sent : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0');
|
signal packet_sent : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0');
|
||||||
|
|||||||
@ -21,6 +21,7 @@ analyze Level_0/rtps_builtin_endpoint_test2.vhd
|
|||||||
analyze Level_0/rtps_builtin_endpoint_test3.vhd
|
analyze Level_0/rtps_builtin_endpoint_test3.vhd
|
||||||
analyze Level_0/rtps_builtin_endpoint_test4.vhd
|
analyze Level_0/rtps_builtin_endpoint_test4.vhd
|
||||||
analyze Level_0/rtps_builtin_endpoint_test5.vhd
|
analyze Level_0/rtps_builtin_endpoint_test5.vhd
|
||||||
|
analyze Level_0/rtps_builtin_endpoint_test6.vhd
|
||||||
analyze Level_0/rtps_out_test1.vhd
|
analyze Level_0/rtps_out_test1.vhd
|
||||||
|
|
||||||
#simulate rtps_handler_test1
|
#simulate rtps_handler_test1
|
||||||
@ -29,5 +30,6 @@ analyze Level_0/rtps_out_test1.vhd
|
|||||||
#simulate rtps_builtin_endpoint_test2
|
#simulate rtps_builtin_endpoint_test2
|
||||||
#simulate rtps_builtin_endpoint_test3
|
#simulate rtps_builtin_endpoint_test3
|
||||||
#simulate rtps_builtin_endpoint_test4
|
#simulate rtps_builtin_endpoint_test4
|
||||||
simulate rtps_builtin_endpoint_test5
|
#simulate rtps_builtin_endpoint_test5
|
||||||
|
simulate rtps_builtin_endpoint_test6
|
||||||
#simulate rtps_out_test1
|
#simulate rtps_out_test1
|
||||||
@ -617,6 +617,7 @@ begin
|
|||||||
announcement_time_next <= time + PARTICIPANT_ANNOUNCEMENT_PERIOD;
|
announcement_time_next <= time + PARTICIPANT_ANNOUNCEMENT_PERIOD;
|
||||||
stage_next <= SEND_HEADER;
|
stage_next <= SEND_HEADER;
|
||||||
return_stage_next <= SEND_PARTICIPANT_ANNOUNCEMENT;
|
return_stage_next <= SEND_PARTICIPANT_ANNOUNCEMENT;
|
||||||
|
cnt_next <= 0;
|
||||||
-- Heartbeat Time Trigger
|
-- Heartbeat Time Trigger
|
||||||
-- NOTE: Liveliness assertion and Heartbeat sending is done together
|
-- NOTE: Liveliness assertion and Heartbeat sending is done together
|
||||||
elsif (time > heartbeat_time) then
|
elsif (time > heartbeat_time) then
|
||||||
@ -1394,7 +1395,7 @@ begin
|
|||||||
-- Participant Lease Expired
|
-- Participant Lease Expired
|
||||||
-- NOTE: The mem_participant_data is zero initialized on lease expiration, so we check the default address for zero
|
-- NOTE: The mem_participant_data is zero initialized on lease expiration, so we check the default address for zero
|
||||||
-- (since the default address should always be set)
|
-- (since the default address should always be set)
|
||||||
if (mem_participant_data.def_addr /= (mem_participant_data.def_addr'reverse_range => '0')) then
|
if (mem_participant_data.def_addr = (mem_participant_data.def_addr'reverse_range => '0')) then
|
||||||
-- Remove Participant
|
-- Remove Participant
|
||||||
mem_opcode <= REMOVE_PARTICIPANT;
|
mem_opcode <= REMOVE_PARTICIPANT;
|
||||||
mem_op_start <= '1';
|
mem_op_start <= '1';
|
||||||
@ -1484,6 +1485,7 @@ begin
|
|||||||
guid_next(1) <= mem_guidprefix(1);
|
guid_next(1) <= mem_guidprefix(1);
|
||||||
guid_next(2) <= mem_guidprefix(2);
|
guid_next(2) <= mem_guidprefix(2);
|
||||||
stage_next <= INFORM_ENDPOINTS_PARTICIPANT_UNMATCH;
|
stage_next <= INFORM_ENDPOINTS_PARTICIPANT_UNMATCH;
|
||||||
|
cnt_next <= 0;
|
||||||
end if;
|
end if;
|
||||||
when PROCESS_PL =>
|
when PROCESS_PL =>
|
||||||
-- Input FIFO Guard
|
-- Input FIFO Guard
|
||||||
@ -2765,6 +2767,7 @@ begin
|
|||||||
-- If Subscriber Data not scheduled for response or no Readers available, skip
|
-- If Subscriber Data not scheduled for response or no Readers available, skip
|
||||||
if (mem_participant_data.extra_flags(PUB_DATA_FLAG) = '0' or NUM_READERS = 0) then
|
if (mem_participant_data.extra_flags(PUB_DATA_FLAG) = '0' or NUM_READERS = 0) then
|
||||||
stage_next <= SEND_MES_MAN_LIVE;
|
stage_next <= SEND_MES_MAN_LIVE;
|
||||||
|
cnt_next <= 0;
|
||||||
-- Output FIFO Guard
|
-- Output FIFO Guard
|
||||||
elsif (rtps_full = '0') then
|
elsif (rtps_full = '0') then
|
||||||
wr_sig <= '1';
|
wr_sig <= '1';
|
||||||
@ -3116,12 +3119,17 @@ begin
|
|||||||
mem_stage_next <= FIND_NEXT_PARTICIPANT;
|
mem_stage_next <= FIND_NEXT_PARTICIPANT;
|
||||||
mem_cnt_next <= 0;
|
mem_cnt_next <= 0;
|
||||||
when FIND_NEXT_PARTICIPANT =>
|
when FIND_NEXT_PARTICIPANT =>
|
||||||
-- Next Participant Slot
|
-- Memory Bound Guard
|
||||||
|
if (addr_res /= max_participant_addr) then
|
||||||
|
-- Reached End of Memory, No match
|
||||||
tmp := addr_res + PARTICIPANT_FRAME_SIZE;
|
tmp := addr_res + PARTICIPANT_FRAME_SIZE;
|
||||||
mem_addr_base_next <= tmp;
|
mem_addr_base_next <= tmp;
|
||||||
mem_addr_next <= tmp;
|
mem_addr_next <= tmp;
|
||||||
mem_stage_next <= FIND_NEXT_PARTICIPANT;
|
mem_stage_next <= FIND_NEXT_PARTICIPANT;
|
||||||
mem_cnt_next <= 0;
|
mem_cnt_next <= 0;
|
||||||
|
else
|
||||||
|
addr_res_next <= MAX_ADDRESS;
|
||||||
|
end if;
|
||||||
when others =>
|
when others =>
|
||||||
null;
|
null;
|
||||||
end case;
|
end case;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user