Commit 199cfe87 authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

Added coverage exclusion to sanity and unit tests.

parent c42616f8
...@@ -361,8 +361,10 @@ architecture behavioral of sanity_test is ...@@ -361,8 +361,10 @@ architecture behavioral of sanity_test is
end loop; end loop;
if (detected = false) then if (detected = false) then
-- LCOV_EXCL_START
outcome:= false; outcome:= false;
node_error := true; node_error := true;
-- LCOV_EXCL_STOP
end if; end if;
end loop; end loop;
end if; end if;
...@@ -371,6 +373,7 @@ architecture behavioral of sanity_test is ...@@ -371,6 +373,7 @@ architecture behavioral of sanity_test is
-- Print contents of test memories for each node if something -- Print contents of test memories for each node if something
-- went wrong! -- went wrong!
if (node_error) then if (node_error) then
-- LCOV_EXCL_START
tx_r_ptr := 0; tx_r_ptr := 0;
log("TX Memory Node " & integer'image(i) & ":", log("TX Memory Node " & integer'image(i) & ":",
error_l, log_level); error_l, log_level);
...@@ -388,6 +391,7 @@ architecture behavioral of sanity_test is ...@@ -388,6 +391,7 @@ architecture behavioral of sanity_test is
read_frame_from_test_mem(RX_frame, tmp_mem, rx_r_ptr); read_frame_from_test_mem(RX_frame, tmp_mem, rx_r_ptr);
CAN_print_frame(RX_frame, error_l); CAN_print_frame(RX_frame, error_l);
end loop; end loop;
-- LCOV_EXCL_STOP
end if; end if;
end loop; end loop;
...@@ -934,10 +938,12 @@ begin ...@@ -934,10 +938,12 @@ begin
if (erp_detected(1) or erp_detected(2) or if (erp_detected(1) or erp_detected(2) or
erp_detected(3) or erp_detected(4)) erp_detected(3) or erp_detected(4))
then then
-- LCOV_EXCL_START
step_done:= true; step_done:= true;
report "Some unit turned error passive -> " & report "Some unit turned error passive -> " &
"Most probably traffic consitency check will fail!" "Most probably traffic consitency check will fail!"
severity error; severity error;
-- LCOV_EXCL_STOP
end if; end if;
wait for 100 ns; wait for 100 ns;
end loop; end loop;
...@@ -954,8 +960,10 @@ begin ...@@ -954,8 +960,10 @@ begin
check_memories(tx_mems, rx_mems, outcome); check_memories(tx_mems, rx_mems, outcome);
if (outcome = false) then if (outcome = false) then
-- LCOV_EXCL_START
log("Traffic consitency check error!", error_l, log_level); log("Traffic consitency check error!", error_l, log_level);
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if; end if;
wait for 1000 ns; wait for 1000 ns;
......
...@@ -169,7 +169,9 @@ architecture tb of tb_sanity is ...@@ -169,7 +169,9 @@ architecture tb of tb_sanity is
(l(2), l(4), 0.0, l(6)), (l(2), l(4), 0.0, l(6)),
(l(3), l(6), l(6), 0.0)); (l(3), l(6), l(6), 0.0));
else else
-- LCOV_EXCL_START
assert false report "Invalid bus topology!" severity failure; assert false report "Invalid bus topology!" severity failure;
-- LCOV_EXCL_STOP
end if; end if;
return bm; return bm;
end len_to_matrix; end len_to_matrix;
......
...@@ -256,7 +256,9 @@ architecture bit_stuffing_unit_test of CAN_test is ...@@ -256,7 +256,9 @@ architecture bit_stuffing_unit_test of CAN_test is
if (to_integer(unsigned(set.stuff_length_fixed)) < 3 or if (to_integer(unsigned(set.stuff_length_fixed)) < 3 or
to_integer(unsigned(set.stuff_length_non_fixed)) < 3) to_integer(unsigned(set.stuff_length_non_fixed)) < 3)
then then
-- LCOV_EXCL_START
report "Invalid bit stuffing settings!" severity failure; report "Invalid bit stuffing settings!" severity failure;
-- LCOV_EXCL_STOP
end if; end if;
-------------------------------------- --------------------------------------
...@@ -470,6 +472,7 @@ architecture bit_stuffing_unit_test of CAN_test is ...@@ -470,6 +472,7 @@ architecture bit_stuffing_unit_test of CAN_test is
wait for 0 ns; wait for 0 ns;
if (log_lvl = info_l) then if (log_lvl = info_l) then
-- LCOV_EXCL_START
log("TX Data NON fixed: ", info_l, log_lvl); log("TX Data NON fixed: ", info_l, log_lvl);
write(msg1, set.tx_data_seq(set.bc_non_fixed - 1 downto 0)); write(msg1, set.tx_data_seq(set.bc_non_fixed - 1 downto 0));
writeline(output, msg1); writeline(output, msg1);
...@@ -478,9 +481,11 @@ architecture bit_stuffing_unit_test of CAN_test is ...@@ -478,9 +481,11 @@ architecture bit_stuffing_unit_test of CAN_test is
write(msg2, set.tx_data_seq(set.bc_non_fixed + set.bc_fixed - 1 write(msg2, set.tx_data_seq(set.bc_non_fixed + set.bc_fixed - 1
downto set.bc_non_fixed)); downto set.bc_non_fixed));
writeline(output, msg2); writeline(output, msg2);
-- LCOV_EXCL_STOP
end if; end if;
if (log_lvl = info_l) then if (log_lvl = info_l) then
-- LCOV_EXCL_START
log("Stuffed data NON fixed: ", info_l, log_lvl); log("Stuffed data NON fixed: ", info_l, log_lvl);
write(msg3, set.stuffed_data_seq( write(msg3, set.stuffed_data_seq(
set.stuff_counter_non_fixed + set.bc_non_fixed - 1 set.stuff_counter_non_fixed + set.bc_non_fixed - 1
...@@ -493,6 +498,7 @@ architecture bit_stuffing_unit_test of CAN_test is ...@@ -493,6 +498,7 @@ architecture bit_stuffing_unit_test of CAN_test is
set.stuff_counter_fixed + set.bc_fixed - 1 downto set.stuff_counter_fixed + set.bc_fixed - 1 downto
set.stuff_counter_non_fixed + set.bc_non_fixed)); set.stuff_counter_non_fixed + set.bc_non_fixed));
writeline(output, msg4); writeline(output, msg4);
-- LCOV_EXCL_STOP
end if; end if;
log("Non-fixed length: " & integer'image(set.bc_non_fixed), log("Non-fixed length: " & integer'image(set.bc_non_fixed),
...@@ -530,8 +536,10 @@ architecture bit_stuffing_unit_test of CAN_test is ...@@ -530,8 +536,10 @@ architecture bit_stuffing_unit_test of CAN_test is
if (rx_trig_ack = '1') then if (rx_trig_ack = '1') then
wait for 1 ns; wait for 1 ns;
if (rx_data /= tx_data) then if (rx_data /= tx_data) then
-- LCOV_EXCL_START
log("TX, RX data mismatch", error_l, log_level); log("TX, RX data mismatch", error_l, log_level);
process_error(err_ctr, error_beh, exit_imm); process_error(err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if; end if;
nbs_ptr := nbs_ptr + 1; nbs_ptr := nbs_ptr + 1;
nbs_index <= nbs_ptr; nbs_index <= nbs_ptr;
...@@ -561,13 +569,17 @@ architecture bit_stuffing_unit_test of CAN_test is ...@@ -561,13 +569,17 @@ architecture bit_stuffing_unit_test of CAN_test is
if (bs_trig = '1') then if (bs_trig = '1') then
wait for 1 ns; wait for 1 ns;
if (stuffed_data /= set.stuffed_data_seq(wbs_ptr)) then if (stuffed_data /= set.stuffed_data_seq(wbs_ptr)) then
-- LCOV_EXCL_START
log("Stuffed data mismatch", error_l, log_level); log("Stuffed data mismatch", error_l, log_level);
process_error(err_ctr, error_beh, exit_imm); process_error(err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if; end if;
if (set.stuffed_bits_mark(wbs_ptr) /= data_halt) then if (set.stuffed_bits_mark(wbs_ptr) /= data_halt) then
-- LCOV_EXCL_START
log("Stuff bit not inserted!", error_l, log_level); log("Stuff bit not inserted!", error_l, log_level);
process_error(err_ctr, error_beh, exit_imm); process_error(err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if; end if;
wbs_ptr := wbs_ptr + 1; wbs_ptr := wbs_ptr + 1;
wbs_index <= wbs_ptr; wbs_index <= wbs_ptr;
...@@ -731,8 +743,10 @@ begin ...@@ -731,8 +743,10 @@ begin
-- Now stuff error should be fired by bit destuffing, since -- Now stuff error should be fired by bit destuffing, since
-- bit value was forced to be the same as previous bits! -- bit value was forced to be the same as previous bits!
if (stuff_error = '0') then if (stuff_error = '0') then
-- LCOV_EXCL_START
log("Stuff error not fired!", error_l, log_level); log("Stuff error not fired!", error_l, log_level);
process_error(stuf_e_err_ctr, error_beh, exit_imm_1); process_error(stuf_e_err_ctr, error_beh, exit_imm_1);
-- LCOV_EXCL_STOP
end if; end if;
wait until rising_edge(clk_sys); wait until rising_edge(clk_sys);
err_data <= '0'; err_data <= '0';
......
...@@ -323,9 +323,11 @@ begin ...@@ -323,9 +323,11 @@ begin
wait for 20 ns; wait for 20 ns;
if ((data_tx /= data_rx) and bit_Error = '0') then if ((data_tx /= data_rx) and bit_Error = '0') then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
log("TX and RX Data mismatch and no bit error fired!", log("TX and RX Data mismatch and no bit error fired!",
error_l, log_level); error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
end loop; end loop;
...@@ -346,9 +348,11 @@ begin ...@@ -346,9 +348,11 @@ begin
wait for 20 ns; wait for 20 ns;
if ((data_tx /= data_rx) and bit_Error = '0') then if ((data_tx /= data_rx) and bit_Error = '0') then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
log("TX and RX Data are mismatching and no bit error fired!", log("TX and RX Data are mismatching and no bit error fired!",
error_l, log_level); error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
end loop; end loop;
...@@ -410,9 +414,11 @@ begin ...@@ -410,9 +414,11 @@ begin
data_rx) and data_rx) and
bit_Error='0') bit_Error='0')
then then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
log("TX and RX Data mismatch, and no bit error fired!", log("TX and RX Data mismatch, and no bit error fired!",
error_l, log_level); error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
end loop; end loop;
......
...@@ -232,22 +232,24 @@ architecture CRC_unit_test of CAN_test is ...@@ -232,22 +232,24 @@ architecture CRC_unit_test of CAN_test is
variable c21_mism :out boolean variable c21_mism :out boolean
)is )is
begin begin
if (crc_15_dut = crc_15_mod) then c15_mism := false;
c15_mism := false;
else if (crc_15_dut /= crc_15_mod) then
-- LCOV_EXCL_START
c15_mism := true; c15_mism := true;
-- LCOV_EXCL_STOP
end if; end if;
if (crc_17_dut = crc_17_mod) then if (crc_17_dut /= crc_17_mod) then
c17_mism := false; -- LCOV_EXCL_START
else
c17_mism := true; c17_mism := true;
-- LCOV_EXCL_STOP
end if; end if;
if (crc_21_dut = crc_21_mod) then if (crc_21_dut /= crc_21_mod) then
c21_mism := false; -- LCOV_EXCL_START
else
c21_mism := true; c21_mism := true;
-- LCOV_EXCL_STOP
end if; end if;
end procedure; end procedure;
...@@ -347,18 +349,24 @@ begin ...@@ -347,18 +349,24 @@ begin
crc_21_mod, c15_mism, c17_mism, c21_mism); crc_21_mod, c15_mism, c17_mism, c21_mism);
if (c15_mism) then if (c15_mism) then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
log("Mismatch in CRC15", error_l, log_level); log("Mismatch in CRC15", error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
if (c17_mism) then if (c17_mism) then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
log("Mismatch in CRC17", error_l, log_level); log("Mismatch in CRC17", error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
if (c21_mism) then if (c21_mism) then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
log("Mismatch in CRC21", error_l, log_level); log("Mismatch in CRC21", error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
loop_ctr <= loop_ctr + 1; loop_ctr <= loop_ctr + 1;
......
...@@ -210,10 +210,11 @@ architecture Event_logger_unit_test of CAN_test is ...@@ -210,10 +210,11 @@ architecture Event_logger_unit_test of CAN_test is
wait until rising_edge(clk_sys); wait until rising_edge(clk_sys);
wait for 1 ns; wait for 1 ns;
outcome := true;
if (log_state /= running) then if (log_state /= running) then
-- LCOV_EXCL_START
outcome := false; outcome := false;
else -- LCOV_EXCL_STOP
outcome := true;
end if; end if;
end procedure; end procedure;
...@@ -256,9 +257,11 @@ architecture Event_logger_unit_test of CAN_test is ...@@ -256,9 +257,11 @@ architecture Event_logger_unit_test of CAN_test is
end loop; end loop;
if (found = false) then if (found = false) then
-- LCOV_EXCL_START
log("Event not found! Index: " & Integer'Image(i), log("Event not found! Index: " & Integer'Image(i),
error_l, log_level); error_l, log_level);
outcome := false; outcome := false;
-- LCOV_EXCL_STOP
end if; end if;
drv_up <= '1'; drv_up <= '1';
...@@ -522,8 +525,10 @@ begin ...@@ -522,8 +525,10 @@ begin
wait_till_trigger(clk_sys, log_state_out, trig_inputs, drv_trig, wait_till_trigger(clk_sys, log_state_out, trig_inputs, drv_trig,
log_level, outcome); log_level, outcome);
if (not outcome) then if (not outcome) then
-- LCOV_EXCL_START
log("Logger did not trigger as expected!", log("Logger did not trigger as expected!",
error_l, log_level); error_l, log_level);
-- LCOV_EXCL_STOp
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
end if; end if;
...@@ -534,8 +539,10 @@ begin ...@@ -534,8 +539,10 @@ begin
log_level, outcome); log_level, outcome);
if (outcome = false) then if (outcome = false) then
-- LCOV_EXCL_START
log("Recorded event not matching expected value", log("Recorded event not matching expected value",
error_l, log_level); error_l, log_level);
-- LCOV_EXCL_STOP
process_error(error_ctr, error_beh, exit_imm); process_error(error_ctr, error_beh, exit_imm);
end if; end if;
......
...@@ -348,8 +348,10 @@ begin ...@@ -348,8 +348,10 @@ begin
(norm_err_model /= to_integer(unsigned(err_counter_norm_out))) or (norm_err_model /= to_integer(unsigned(err_counter_norm_out))) or
(fd_err_model /= to_integer(unsigned(err_counter_fd_out)))) (fd_err_model /= to_integer(unsigned(err_counter_fd_out))))
then then
-- LCOV_EXCL_START
log("Error counters not as expected", error_l, log_level); log("Error counters not as expected", error_l, log_level);
err_ctr_1 <= err_ctr_1 + 1; err_ctr_1 <= err_ctr_1 + 1;
-- LCOV_EXCL_STOP
end if; end if;
end process; end process;
...@@ -378,8 +380,10 @@ begin ...@@ -378,8 +380,10 @@ begin
wait until rising_edge(clk_sys); wait until rising_edge(clk_sys);
if (fc_model /= error_state_out) then if (fc_model /= error_state_out) then
-- LCOV_EXCL_START
log("Fault confinement state differs!", error_l, log_level); log("Fault confinement state differs!", error_l, log_level);
err_ctr_2 <= err_ctr_2 + 1; err_ctr_2 <= err_ctr_2 + 1;
-- LCOV_EXCL_STOP
end if; end if;
end process; end process;
......
...@@ -467,29 +467,40 @@ begin ...@@ -467,29 +467,40 @@ begin
-- Checking the expected and real outputs -- Checking the expected and real outputs
if (int_ena /= int_ena_exp) then if (int_ena /= int_ena_exp) then
-- LCOV_EXCL_START
outcome := false; outcome := false;
log("Interrupt enable mismatch", error_l, log_level); log("Interrupt enable mismatch", error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
if (int_mask /= int_mask_exp) then if (int_mask /= int_mask_exp) then
-- LCOV_EXCL_START
outcome := false; outcome := false;
log("Interrupt mask mismatch", error_l, log_level); log("Interrupt mask mismatch", error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
if (int_vector /= int_status_exp) then if (int_vector /= int_status_exp) then
-- LCOV_EXCL_START
outcome := false; outcome := false;
log("Interrupt vector mismatch", error_l, log_level); log("Interrupt vector mismatch", error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
if ((exp_output = true and int_out = '0') or if ((exp_output = true and int_out = '0') or
(exp_output = false and int_out = '1')) then (exp_output = false and int_out = '1'))
then
-- LCOV_EXCL_START
outcome := false; outcome := false;
log("Interrupt output mismatch", error_l, log_level); log("Interrupt output mismatch", error_l, log_level);
-- LCOV_EXCL_STOP
end if; end if;
-- Checking the outputs -- Checking the outputs
if (outcome = false) then if (outcome = false) then
-- LCOV_EXCL_START
process_error(error_ctr_2, error_beh, exit_imm); process_error(error_ctr_2, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if; end if;
end process; end process;
......
...@@ -238,26 +238,33 @@ architecture mess_filt_unit_test of CAN_test is ...@@ -238,26 +238,33 @@ architecture mess_filt_unit_test of CAN_test is
return true; return true;
elsif (filt_res = '0') then -- Is not detected elsif (filt_res = '0') then -- Is not detected
log("Valid frame not detected", error_l, log_level); -- LCOV_EXCL_START
return false; log("Valid frame not detected", error_l, log_level);
return false;
-- LCOV_EXCL_STOP
else else
log("Filter res undefined", error_l, log_level); -- LCOV_EXCL_START
return false; log("Filter res undefined", error_l, log_level);
return false;
-- LCOV_EXCL_STOP
end if; end if;
else else
if (filt_res = '1') then --Is detected if (filt_res = '1') then --Is detected
-- LCOV_EXCL_START
log("Invalid frame but frame detected", error_l, log_level); log("Invalid frame but frame detected", error_l, log_level);
return false; return false;
-- LCOV_EXCL_STOP
elsif (filt_res = '0') then -- Is not detected elsif (filt_res = '0') then -- Is not detected
return true; return true;
else else
-- LCOV_EXCL_START
log("Filter res undefined", error_l, log_level); log("Filter res undefined", error_l, log_level);
return false; return false;
-- LCOV_EXCL_STOP
end if; end if;
end if; end if;
......
...@@ -764,9 +764,11 @@ begin ...@@ -764,9 +764,11 @@ begin
end if; end if;
if (check_ctr /= exp_dur) then if (check_ctr /= exp_dur) then
-- LCOV_EXCL_START
log("SYNC+PROP+PH1 " & tmp_text & log("SYNC+PROP+PH1 " & tmp_text &
" did not last expected time!", error_l, log_level); " did not last expected time!", error_l, log_level);
process_error(main_err_ctr, error_beh, exit_imm); process_error(main_err_ctr, error_beh, exit_imm);