Commit 43b0e865 authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

Added printout of sanity test parameters.

parent da87c2bb
......@@ -495,6 +495,20 @@ package CANtestLib is
constant f100_MHZ : natural := 10000;
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- sanity test Stuff; must be in a package
----------------------------------------------------------------------------
----------------------------------------------------------------------------
constant NODE_COUNT : natural := 4;
type bus_matrix_type is array(1 to NODE_COUNT, 1 to NODE_COUNT) of real;
type anat_t is array (integer range <>) of natural;
subtype anat_nc_t is anat_t (1 to NODE_COUNT);
subtype epsilon_type is anat_nc_t;
subtype trv_del_type is anat_nc_t;
subtype timing_config_t is anat_t(1 to 10);
----------------------------------------------------------------------------
----------------------------------------------------------------------------
......@@ -932,6 +946,31 @@ package CANtestLib is
);
----------------------------------------------------------------------------
-- Print Bus timing configuration of CTU CAN FD Core.
-- (duration of bit phases, synchronisation jump width, baud-rate prescaler)
--
-- Arguments:
-- bus_timing Bus timing structure that will be printed in simulator.
-- ID Index of CTU CAN FD Core instance
-- mem_bus Avalon memory bus to execute the access on.
----------------------------------------------------------------------------
procedure CAN_print_timing(
constant bus_timing : in bit_time_config_type
);
----------------------------------------------------------------------------
-- Print Bus matrix from sanity test configuration.
--
-- Arguments:
-- bus_matrix Bus Matrix to be printed.
----------------------------------------------------------------------------
procedure CAN_print_bus_matrix(
constant bus_matrix : in bus_matrix_type
);
----------------------------------------------------------------------------
-- Turn on/off CTU_CAN_FD Core.
--
......@@ -1565,23 +1604,6 @@ package CANtestLib is
signal mem_bus : inout Avalon_mem_type
);
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- sanity test Stuff; must be in a package
----------------------------------------------------------------------------
----------------------------------------------------------------------------
constant NODE_COUNT : natural := 4;
type bus_matrix_type is array(1 to NODE_COUNT,1 to NODE_COUNT) of real;
type anat_t is array (integer range <>) of natural;
subtype anat_nc_t is anat_t (1 to NODE_COUNT);
subtype epsilon_type is anat_nc_t;
subtype trv_del_type is anat_nc_t;
subtype timing_config_t is anat_t(1 to 10);
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- Component declarations
......@@ -2345,6 +2367,67 @@ package body CANtestLib is
end procedure;
procedure CAN_print_timing(
constant bus_timing : in bit_time_config_type
)is
variable msg : line;
begin
write(msg, string'("Nominal Bit timing: "));
-- Baud Rate Prescaler
write(msg, string'("BRP: " & integer'image(bus_timing.tq_nbt) & " "));
-- Propagation segment
write(msg, string'("PROP: " & integer'image(bus_timing.prop_nbt) & " "));
-- Phase 1 segment
write(msg, string'("PH1: " & integer'image(bus_timing.ph1_nbt) & " "));
-- Phase 2 segment
write(msg, string'("PH2: " & integer'image(bus_timing.ph2_nbt) & " "));
-- SJW
write(msg, string'("SJW: " & integer'image(bus_timing.sjw_nbt) & " "));
write(msg, string'("Data Bit timing: "));
-- Baud Rate Prescaler - FD
write(msg, string'("BRP: " & integer'image(bus_timing.tq_dbt) & " "));
-- Propagation segment - FD
write(msg, string'("PROP: " & integer'image(bus_timing.prop_dbt) & " "));
-- Phase 1 segment - FD
write(msg, string'("PH1: " & integer'image(bus_timing.ph1_dbt) & " "));
-- Phase 2 segment - FD
write(msg, string'("PH2: " & integer'image(bus_timing.ph2_dbt) & " "));
-- SJW - FD
write(msg, string'("SJW: " & integer'image(bus_timing.sjw_dbt) & " "));
writeline(output, msg);
end procedure;
procedure CAN_print_bus_matrix(
constant bus_matrix : in bus_matrix_type
)is
variable msg : line;
begin
write(msg, string'("Bus matrix: "));
writeline(output, msg);
for i in 1 to NODE_COUNT loop
for j in 1 to NODE_COUNT loop
write(msg, string'(integer'image(bus_matrix(i, j) & " ")));
end loop;
writeline(output, msg);
end loop;
end procedure;
procedure CAN_turn_controller(
constant turn_on : in boolean;
constant ID : in natural range 0 to 15;
......
......@@ -825,8 +825,32 @@ begin
variable step_done : boolean := false;
begin
print_test_info(iterations, log_level, error_beh, error_tol);
-- TODO: print sanity test params
------------------------------------------------------------------------
-- Print Test configuration
------------------------------------------------------------------------
log("Sanity test configuration:", info_l, log_level);
log("Clock jitters (ppm): " & epsilon_v(1) & " "
& epsilon_v(2) & " " & epsilon_v(3) & " " & epsilon_v(4) & " ",
info_l, log_level);
log("Transceiver delays (ns): " & trv_del_v(1) & " "
& trv_del_v(2) & " " & trv_del_v(3) & " " & trv_del_v(4) & " ",
info_l, log_level);
log(" Noise width (mean): " & nw_mean(1) &
" Noise width (var): " & nw_var(1) &
" Noise gap (mean): " & ng_mean(1) &
" Noise gap (var): " & ng_var(1),
info_l, log_level);
log ("Bus topology: " & topology, info_l, log_level);
CAN_print_timing(timing_config);
CAN_print_bus_matrix(bus_matrix);
------------------------------------------------------------------------
-- Execute test reset
------------------------------------------------------------------------
wait for 5 ns;
do_restart_mem_if <= (OTHERS => false);
wait for 5 ns;
......
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