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
end loop;
if (detected = false) then
-- LCOV_EXCL_START
outcome:= false;
node_error := true;
-- LCOV_EXCL_STOP
end if;
end loop;
end if;
......@@ -371,6 +373,7 @@ architecture behavioral of sanity_test is
-- Print contents of test memories for each node if something
-- went wrong!
if (node_error) then
-- LCOV_EXCL_START
tx_r_ptr := 0;
log("TX Memory Node " & integer'image(i) & ":",
error_l, log_level);
......@@ -388,6 +391,7 @@ architecture behavioral of sanity_test is
read_frame_from_test_mem(RX_frame, tmp_mem, rx_r_ptr);
CAN_print_frame(RX_frame, error_l);
end loop;
-- LCOV_EXCL_STOP
end if;
end loop;
......@@ -934,10 +938,12 @@ begin
if (erp_detected(1) or erp_detected(2) or
erp_detected(3) or erp_detected(4))
then
-- LCOV_EXCL_START
step_done:= true;
report "Some unit turned error passive -> " &
"Most probably traffic consitency check will fail!"
severity error;
-- LCOV_EXCL_STOP
end if;
wait for 100 ns;
end loop;
......@@ -954,8 +960,10 @@ begin
check_memories(tx_mems, rx_mems, outcome);
if (outcome = false) then
-- LCOV_EXCL_START
log("Traffic consitency check error!", error_l, log_level);
process_error(error_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
wait for 1000 ns;
......
......@@ -169,7 +169,9 @@ architecture tb of tb_sanity is
(l(2), l(4), 0.0, l(6)),
(l(3), l(6), l(6), 0.0));
else
-- LCOV_EXCL_START
assert false report "Invalid bus topology!" severity failure;
-- LCOV_EXCL_STOP
end if;
return bm;
end len_to_matrix;
......
......@@ -256,7 +256,9 @@ architecture bit_stuffing_unit_test of CAN_test is
if (to_integer(unsigned(set.stuff_length_fixed)) < 3 or
to_integer(unsigned(set.stuff_length_non_fixed)) < 3)
then
-- LCOV_EXCL_START
report "Invalid bit stuffing settings!" severity failure;
-- LCOV_EXCL_STOP
end if;
--------------------------------------
......@@ -470,6 +472,7 @@ architecture bit_stuffing_unit_test of CAN_test is
wait for 0 ns;
if (log_lvl = info_l) then
-- LCOV_EXCL_START
log("TX Data NON fixed: ", info_l, log_lvl);
write(msg1, set.tx_data_seq(set.bc_non_fixed - 1 downto 0));
writeline(output, msg1);
......@@ -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
downto set.bc_non_fixed));
writeline(output, msg2);
-- LCOV_EXCL_STOP
end if;
if (log_lvl = info_l) then
-- LCOV_EXCL_START
log("Stuffed data NON fixed: ", info_l, log_lvl);
write(msg3, set.stuffed_data_seq(
set.stuff_counter_non_fixed + set.bc_non_fixed - 1
......@@ -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_non_fixed + set.bc_non_fixed));
writeline(output, msg4);
-- LCOV_EXCL_STOP
end if;
log("Non-fixed length: " & integer'image(set.bc_non_fixed),
......@@ -530,8 +536,10 @@ architecture bit_stuffing_unit_test of CAN_test is
if (rx_trig_ack = '1') then
wait for 1 ns;
if (rx_data /= tx_data) then
-- LCOV_EXCL_START
log("TX, RX data mismatch", error_l, log_level);
process_error(err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
nbs_ptr := nbs_ptr + 1;
nbs_index <= nbs_ptr;
......@@ -561,13 +569,17 @@ architecture bit_stuffing_unit_test of CAN_test is
if (bs_trig = '1') then
wait for 1 ns;
if (stuffed_data /= set.stuffed_data_seq(wbs_ptr)) then
-- LCOV_EXCL_START
log("Stuffed data mismatch", error_l, log_level);
process_error(err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
if (set.stuffed_bits_mark(wbs_ptr) /= data_halt) then
-- LCOV_EXCL_START
log("Stuff bit not inserted!", error_l, log_level);
process_error(err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
wbs_ptr := wbs_ptr + 1;
wbs_index <= wbs_ptr;
......@@ -731,8 +743,10 @@ begin
-- Now stuff error should be fired by bit destuffing, since
-- bit value was forced to be the same as previous bits!
if (stuff_error = '0') then
-- LCOV_EXCL_START
log("Stuff error not fired!", error_l, log_level);
process_error(stuf_e_err_ctr, error_beh, exit_imm_1);
-- LCOV_EXCL_STOP
end if;
wait until rising_edge(clk_sys);
err_data <= '0';
......
......@@ -323,9 +323,11 @@ begin
wait for 20 ns;
if ((data_tx /= data_rx) and bit_Error = '0') then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm);
log("TX and RX Data mismatch and no bit error fired!",
error_l, log_level);
-- LCOV_EXCL_STOP
end if;
end loop;
......@@ -346,9 +348,11 @@ begin
wait for 20 ns;
if ((data_tx /= data_rx) and bit_Error = '0') then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm);
log("TX and RX Data are mismatching and no bit error fired!",
error_l, log_level);
-- LCOV_EXCL_STOP
end if;
end loop;
......@@ -410,9 +414,11 @@ begin
data_rx) and
bit_Error='0')
then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm);
log("TX and RX Data mismatch, and no bit error fired!",
error_l, log_level);
-- LCOV_EXCL_STOP
end if;
end loop;
......
......@@ -232,22 +232,24 @@ architecture CRC_unit_test of CAN_test is
variable c21_mism :out boolean
)is
begin
if (crc_15_dut = crc_15_mod) then
c15_mism := false;
else
c15_mism := false;
if (crc_15_dut /= crc_15_mod) then
-- LCOV_EXCL_START
c15_mism := true;
-- LCOV_EXCL_STOP
end if;
if (crc_17_dut = crc_17_mod) then
c17_mism := false;
else
if (crc_17_dut /= crc_17_mod) then
-- LCOV_EXCL_START
c17_mism := true;
-- LCOV_EXCL_STOP
end if;
if (crc_21_dut = crc_21_mod) then
c21_mism := false;
else
if (crc_21_dut /= crc_21_mod) then
-- LCOV_EXCL_START
c21_mism := true;
-- LCOV_EXCL_STOP
end if;
end procedure;
......@@ -347,18 +349,24 @@ begin
crc_21_mod, c15_mism, c17_mism, c21_mism);
if (c15_mism) then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm);
log("Mismatch in CRC15", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
if (c17_mism) then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm);
log("Mismatch in CRC17", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
if (c21_mism) then
-- LCOV_EXCL_START
process_error(error_ctr, error_beh, exit_imm);
log("Mismatch in CRC21", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
loop_ctr <= loop_ctr + 1;
......
......@@ -210,10 +210,11 @@ architecture Event_logger_unit_test of CAN_test is
wait until rising_edge(clk_sys);
wait for 1 ns;
outcome := true;
if (log_state /= running) then
-- LCOV_EXCL_START
outcome := false;
else
outcome := true;
-- LCOV_EXCL_STOP
end if;
end procedure;
......@@ -256,9 +257,11 @@ architecture Event_logger_unit_test of CAN_test is
end loop;
if (found = false) then
-- LCOV_EXCL_START
log("Event not found! Index: " & Integer'Image(i),
error_l, log_level);
outcome := false;
-- LCOV_EXCL_STOP
end if;
drv_up <= '1';
......@@ -522,8 +525,10 @@ begin
wait_till_trigger(clk_sys, log_state_out, trig_inputs, drv_trig,
log_level, outcome);
if (not outcome) then
-- LCOV_EXCL_START
log("Logger did not trigger as expected!",
error_l, log_level);
-- LCOV_EXCL_STOp
process_error(error_ctr, error_beh, exit_imm);
end if;
......@@ -534,8 +539,10 @@ begin
log_level, outcome);
if (outcome = false) then
-- LCOV_EXCL_START
log("Recorded event not matching expected value",
error_l, log_level);
-- LCOV_EXCL_STOP
process_error(error_ctr, error_beh, exit_imm);
end if;
......
......@@ -348,8 +348,10 @@ begin
(norm_err_model /= to_integer(unsigned(err_counter_norm_out))) or
(fd_err_model /= to_integer(unsigned(err_counter_fd_out))))
then
-- LCOV_EXCL_START
log("Error counters not as expected", error_l, log_level);
err_ctr_1 <= err_ctr_1 + 1;
-- LCOV_EXCL_STOP
end if;
end process;
......@@ -378,8 +380,10 @@ begin
wait until rising_edge(clk_sys);
if (fc_model /= error_state_out) then
-- LCOV_EXCL_START
log("Fault confinement state differs!", error_l, log_level);
err_ctr_2 <= err_ctr_2 + 1;
-- LCOV_EXCL_STOP
end if;
end process;
......
......@@ -467,29 +467,40 @@ begin
-- Checking the expected and real outputs
if (int_ena /= int_ena_exp) then
-- LCOV_EXCL_START
outcome := false;
log("Interrupt enable mismatch", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
if (int_mask /= int_mask_exp) then
-- LCOV_EXCL_START
outcome := false;
log("Interrupt mask mismatch", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
if (int_vector /= int_status_exp) then
-- LCOV_EXCL_START
outcome := false;
log("Interrupt vector mismatch", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
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;
log("Interrupt output mismatch", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
-- Checking the outputs
if (outcome = false) then
-- LCOV_EXCL_START
process_error(error_ctr_2, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
end process;
......
......@@ -238,26 +238,33 @@ architecture mess_filt_unit_test of CAN_test is
return true;
elsif (filt_res = '0') then -- Is not detected
log("Valid frame not detected", error_l, log_level);
return false;
-- LCOV_EXCL_START
log("Valid frame not detected", error_l, log_level);
return false;
-- LCOV_EXCL_STOP
else
log("Filter res undefined", error_l, log_level);
return false;
-- LCOV_EXCL_START
log("Filter res undefined", error_l, log_level);
return false;
-- LCOV_EXCL_STOP
end if;
else
if (filt_res = '1') then --Is detected
-- LCOV_EXCL_START
log("Invalid frame but frame detected", error_l, log_level);
return false;
-- LCOV_EXCL_STOP
elsif (filt_res = '0') then -- Is not detected
return true;
else
-- LCOV_EXCL_START
log("Filter res undefined", error_l, log_level);
return false;
-- LCOV_EXCL_STOP
end if;
end if;
......
......@@ -764,9 +764,11 @@ begin
end if;
if (check_ctr /= exp_dur) then
-- LCOV_EXCL_START
log("SYNC+PROP+PH1 " & tmp_text &
" did not last expected time!", error_l, log_level);
process_error(main_err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
-- Check distance between two consecutive "SYNC" triggers
......@@ -793,9 +795,11 @@ begin
end if;
if (check_ctr /= exp_dur) then
-- LCOV_EXCL_START
log("SYNC+PROP+PH1+PH2 " & tmp_text &
" did not last expected time!", error_l, log_level);
process_error(main_err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
end loop;
......@@ -832,11 +836,13 @@ begin
end if;
if (abs(integer(check_ctr) - resync_bit_time_length) > brp) then
-- LCOV_EXCL_START
log("Resync bit length wrong! Expected length: " &
integer'image(resync_bit_time_length) &
" Real length: " & integer'image(check_ctr),
error_l, log_level);
process_error(main_err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
end loop;
......@@ -892,10 +898,12 @@ begin
-- Check duration, count with two cycle delay.
if (exp_dur_BRS /= nom_ctr + data_ctr + 2) then
-- LCOV_EXCL_START
log("BRS bit length not as expected, " &
"Expected: " & integer'image(exp_dur_BRS) &
"Real: " & integer'image(nom_ctr + data_ctr + 2),
error_l, log_level);
-- LCOV_EXCL_STOP
process_error(main_err_ctr, error_beh, exit_imm);
end if;
......@@ -919,11 +927,13 @@ begin
-- Check the duration
if (exp_dur_CRC_del /= nom_ctr + data_ctr + 2) then
-- LCOV_EXCL_START
log("CRC delimiter bit length not as expected, " &
"Expected: " & integer'image(exp_dur_CRC_del) &
"Real: " & integer'image(nom_ctr + data_ctr + 2),
error_l, log_level);
process_error(main_err_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
end if;
wait until rising_edge(clk_sys);
......
......@@ -568,7 +568,9 @@ architecture Protocol_Control_unit_test of CAN_test is
when 6 => tmp := "101";
when 7 => tmp := "100";
when others =>
-- LCOV_EXCL_START
report "Invalid stuff counter value" severity failure;
-- LCOV_EXCL_STOP
end case;
parity := tmp(0) xor tmp(1) xor tmp(2);
......@@ -677,7 +679,9 @@ architecture Protocol_Control_unit_test of CAN_test is
end if;
ptr := ptr + 5;
when others =>
-- LCOV_EXCL_START
report "Invalid CAN FD Frame settings" severity error;
-- LCOV_EXCL_STOP
end case;
-- DLC field
......@@ -1109,8 +1113,10 @@ begin
-- Break if there is more data than expected!
if (rxb_mem_ptr > 19) then
-- LCOV_EXCL_START
log("Data size exceeds 64 bytes", error_l, log_level);
exit;
-- LCOV_EXCL_STOP
end if;
-- Store data word
......@@ -1223,6 +1229,7 @@ begin
-- Process possible error in TX/RX Frames or sequences mismatch
if (out_seq = false or out_frm = false) then
-- LCOV_EXCL_START
log("Generated CAN frame:", error_l, log_level);
CAN_print_frame(tx_frame, info_l);
......@@ -1238,6 +1245,7 @@ begin
writeline(output, msg2);
process_error(error_ctr, error_beh, exit_imm);
-- LCOV_EXCL_STOP
wait;
end if;
......
......@@ -320,7 +320,9 @@ architecture rx_buf_unit_test of CAN_test is
-- Check that overrun was cleared
if (rx_data_overrun = '1') then
-- LCOV_EXCL_START
log("Overrun not cleared!", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
------------------------------------------------------------------------
......@@ -473,8 +475,10 @@ architecture rx_buf_unit_test of CAN_test is
-- Check that word is exactly matching the word in in_mem at the
-- same position
if (buff_out /= in_mem(out_pointer)) then
log("Buffer FUCKED UP, inex: " & integer'image(out_pointer),
-- LCOV_EXCL_START
log("Buffer FUCKED UP, index: " & integer'image(out_pointer),
error_l, log_level);
-- LCOV_EXCL_STOP
end if;
out_pointer <= out_pointer + 1;
......@@ -700,8 +704,10 @@ begin
compare_data(in_mem, out_mem, cons_res);
if (cons_res = false) then
-- LCOV_EXCL_START
process_error(cons_errs, error_beh, exit_imm_d_3);
log("Data consistency check failed !", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
-- Now we can tell to the other circuits that one iteration is over
......
......@@ -535,8 +535,10 @@ begin
begin
if (mod_frame_valid_out /= tran_frame_valid_out and now /= 0 fs) then
-- LCOV_EXCL_START
log("DUT and Model Frame valid not matching!", error_l, log_level);
cmp_err_ctr <= cmp_err_ctr + 1;
-- LCOV_EXCL_STOP
end if;
if (((mod_dlc_out /= tran_dlc_out) or
......@@ -544,21 +546,27 @@ begin
(mod_ident_type_out /= tran_ident_type_out) or
(mod_frame_type_out /= tran_frame_type_out)) and now /= 0 fs)
then
-- LCOV_EXCL_START
log("DUT and Model metadata not matching!", error_l, log_level);
cmp_err_ctr <= cmp_err_ctr + 1;
-- LCOV_EXCL_STOP
end if;
if (txt_hw_cmd_buf_index /= mod_buf_index and now /= 0 fs)
then
-- LCOV_EXCL_START
log("DUT and Model buffer index not matching!", error_l, log_level);
cmp_err_ctr <= cmp_err_ctr + 1;
-- LCOV_EXCL_STOP
end if;
if (last_locked_index /= mod_buf_index and
txtb_changed = '0' and now /= 0 fs)
then
-- LCOV_EXCL_START
log("Buffer change not detected!", error_l, log_level);
cmp_err_ctr <= cmp_err_ctr + 1;
-- LCOV_EXCL_STOP
end if;
wait until falling_edge(clk_sys);
......
......@@ -308,8 +308,10 @@ begin
-- At any point the data should be matching the data in
-- the shadow buffer
if (txt_word /= shadow_mem(txt_addr)) then
-- LCOV_EXCL_START
process_error(data_coh_err_ctr, error_beh, exit_imm_1);
log("Data coherency error!", error_l, log_level);
-- LCOV_EXCL_STOP
end if;
end process;
......@@ -369,11 +371,13 @@ begin
wait until falling_edge(clk_sys);
-- Check whether the state ended up as expected
if (txtb_state /= txtb_exp_state) then
-- LCOV_EXCL_START
process_error(state_coh_error_ctr, error_beh, exit_imm_2);
log("State not updated as expected! Actual: " &
txt_fsm_type'image(txtb_state) & " Expected: " &
txt_fsm_type'image(txtb_exp_state),
error_l, log_level);
-- LCOV_EXCL_STOP
end if;
-- Set all the commands to be inactive
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment