Commit f3bbfc61 authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

test: Add configuration option of transmitter delay to feature testbench!

parent 47617ae0
......@@ -55,8 +55,9 @@ package pkg_feature_exec_dispath is
end record;
type feature_signal_outputs_t is record
bl_inject : std_logic;
bl_force : boolean;
bl_inject : std_logic;
bl_force : boolean;
ftr_tb_trv_delay : t_ftr_tx_delay;
end record;
constant NINST : natural := 2;
......
......@@ -85,6 +85,9 @@ entity CAN_feature_test is
-- Bus level injected value and whether it should be forced on bus
signal bl_inject : in std_logic;
signal bl_force : in boolean;
-- Transmitter delays
signal transmitter_delays :in t_ftr_tx_delay;
-- Internal signals; TODO: direction
signal iteration_done : in boolean := false;
......@@ -205,6 +208,8 @@ begin
xe: bus_level <= s_bus_level;
xf: iout(i).can_tx <= p(i).CAN_tx;
x10: p(i).tr_del <= transmitter_delays(i);
---------------------------------
-- Clock & timestamp generation
......@@ -327,6 +332,12 @@ architecture tb of tb_feature is
data_out => (OTHERS =>'0'),
sbe => x"0"
);
constant tran_delay_init : t_ftr_tx_delay :=
(
11 * f100_Mhz * 1 ps,
11 * f100_Mhz * 1 ps
);
procedure restart_mem_bus(
signal mem_bus : out Avalon_mem_type
......@@ -348,6 +359,9 @@ architecture tb of tb_feature is
signal bl_inject : std_logic := RECESSIVE;
signal bl_force : boolean := false;
-- Default delay of 110 ns is realistic for CAN transceivers!
signal ftr_tb_trv_delays : t_ftr_tx_delay := tran_delay_init;
-- test internal signals
signal iteration_done : boolean := false;
......@@ -358,14 +372,24 @@ architecture tb of tb_feature is
signal bus_level : std_logic;
signal rand_ctr : natural range 0 to RAND_POOL_SIZE;
constant padded_test_name : string(1 to 20) := strtolen(20, test_name);
signal so : feature_signal_outputs_t;
signal so : feature_signal_outputs_t := (
'0',
false,
((
11 * f100_Mhz * 1 ps,
11 * f100_Mhz * 1 ps
))
);
begin
bl_inject <= so.bl_inject;
bl_force <= so.bl_force;
ftr_tb_trv_delays <= so.ftr_tb_trv_delay;
--In this test wrapper generics are directly connected to the signals
-- In this test wrapper generics are directly connected to the signals
-- of test entity
test_comp: entity work.CAN_feature_test
port map(
......@@ -378,6 +402,7 @@ begin
mem_bus => mem_bus,
bl_inject => bl_inject,
bl_force => bl_force,
transmitter_delays => ftr_tb_trv_delays,
iteration_done => iteration_done,
hw_reset_on_new_test => hw_reset_on_new_test,
......
......@@ -1079,11 +1079,35 @@ package CANtestLib is
);
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- CAN feauture TB configuration routines
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- Signals for feature test intialization
type t_ftr_tx_delay is array (1 to 2) of time;
----------------------------------------------------------------------------
-- Configure transmitter delay in feature TB.
--
-- Arguments:
-- tx_del Delay to be set
-- ID ID of the node where delay shall be set.
----------------------------------------------------------------------------
procedure ftr_tb_set_tran_delay(
constant tx_del : in time;
constant ID : in natural range 0 to 15;
signal actual_delay : out t_ftr_tx_delay
);
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- CAN configuration routines
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- Configure Bus timing on CTU CAN FD Core.
......@@ -1922,7 +1946,7 @@ package CANtestLib is
----------------------------------------------------------------------------
procedure CAN_configure_ssp(
constant ssp_source : in SSP_set_command_type;
constant ssp_offset_val : in std_logic_vector(6 downto 0);
constant ssp_offset_val : in std_logic_vector(7 downto 0);
constant ID : in natural range 0 to 15;
signal mem_bus : inout Avalon_mem_type
);
......@@ -2876,6 +2900,22 @@ package body CANtestLib is
aval_read_burst(r_data, int_address, stat_burst, mem_bus);
end if;
end procedure;
procedure ftr_tb_set_tran_delay(
constant tx_del : in time;
constant ID : in natural range 0 to 15;
signal actual_delay : out t_ftr_tx_delay
)is
begin
if (ID /= 2 and ID /= 1) then
warning("Transmitter delay config: " &
"Only nodes 1 and 2 are supported -> Skipping!");
return;
end if;
actual_delay(ID) <= tx_del;
end procedure;
procedure CAN_configure_timing(
......@@ -4741,7 +4781,7 @@ package body CANtestLib is
procedure CAN_configure_ssp(
constant ssp_source : in SSP_set_command_type;
constant ssp_offset_val : in std_logic_vector(6 downto 0);
constant ssp_offset_val : in std_logic_vector(7 downto 0);
constant ID : in natural range 0 to 15;
signal mem_bus : inout Avalon_mem_type
) is
......
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