Commit 6c330ee4 authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

test: Add initialization of TXT Buffer memories.

Now this is done in TB to avoid extra gating of TXT Buffer counter in
Protocol control. The reason is to avoid huge log overflow on arithmetic
comparisons on undefined values!
parent da978abf
...@@ -453,6 +453,10 @@ begin ...@@ -453,6 +453,10 @@ begin
--wait for 10 ns; --wait for 10 ns;
info("... ready .. let's begin"); info("... ready .. let's begin");
-- Initialize TXT Buffer memories (not to have too many logs!)
CAN_init_txtb_mems(ID_1, mem_bus(1));
CAN_init_txtb_mems(ID_2, mem_bus(2));
--Execute the controllers configuration --Execute the controllers configuration
CAN_turn_controller(true, ID_1, mem_bus(1)); CAN_turn_controller(true, ID_1, mem_bus(1));
CAN_turn_controller(true, ID_2, mem_bus(2)); CAN_turn_controller(true, ID_2, mem_bus(2));
......
...@@ -86,6 +86,7 @@ USE ieee.math_real.ALL; ...@@ -86,6 +86,7 @@ USE ieee.math_real.ALL;
USE work.randomLib.All; USE work.randomLib.All;
use work.can_constants.all; use work.can_constants.all;
use work.drv_stat_pkg.all; use work.drv_stat_pkg.all;
use work.can_config.all;
use work.CAN_FD_register_map.all; use work.CAN_FD_register_map.all;
use work.CAN_FD_frame_format.all; use work.CAN_FD_frame_format.all;
...@@ -2078,6 +2079,20 @@ package CANtestLib is ...@@ -2078,6 +2079,20 @@ package CANtestLib is
constant skip_stuff_bits : in boolean := true constant skip_stuff_bits : in boolean := true
); );
----------------------------------------------------------------------------
-- Initialize TXT Buffer memories
--
-- Arguments:
-- ID Index of CTU CAN FD Core instance.
-- mem_bus Avalon memory bus to execute the access on.
----------------------------------------------------------------------------
procedure CAN_init_txtb_mems(
constant ID : in natural range 0 to 15;
signal mem_bus : inout Avalon_mem_type
);
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- Component declarations -- Component declarations
...@@ -4970,6 +4985,7 @@ package body CANtestLib is ...@@ -4970,6 +4985,7 @@ package body CANtestLib is
CAN_write(data, address, ID, mem_bus, BIT_16); CAN_write(data, address, ID, mem_bus, BIT_16);
end procedure; end procedure;
procedure CAN_read_error_code_capture( procedure CAN_read_error_code_capture(
variable err_capt : inout SW_error_capture; variable err_capt : inout SW_error_capture;
constant ID : in natural range 0 to 15; constant ID : in natural range 0 to 15;
...@@ -5030,6 +5046,24 @@ package body CANtestLib is ...@@ -5030,6 +5046,24 @@ package body CANtestLib is
end procedure; end procedure;
procedure CAN_init_txtb_mems(
constant ID : in natural range 0 to 15;
signal mem_bus : inout Avalon_mem_type
) is
variable address : std_logic_vector(11 downto 0);
variable data : std_logic_vector(31 downto 0):=
(OTHERS => '0');
begin
for i in 1 to C_TXT_BUFFER_COUNT loop
address := std_logic_vector(to_unsigned(
to_integer((unsigned(TXTB1_DATA_1_ADR)) * i), 12));
for j in 0 to 19 loop
CAN_write(data, address, ID, mem_bus);
address := std_logic_vector(unsigned(address) + 4);
end loop;
end loop;
end procedure;
end package body; end package body;
......
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