From 1a15367846968ceef8831defa6fbd31218d0cb82 Mon Sep 17 00:00:00 2001 From: Lars Asplund Date: Wed, 18 Apr 2018 08:36:50 +0200 Subject: [PATCH] Added support for specifying actor for a new bus. Closes #317. --- .../verification_components/src/bus_master_pkg-body.vhd | 8 ++++++-- vunit/vhdl/verification_components/src/bus_master_pkg.vhd | 3 ++- .../verification_components/test/tb_bus_master_pkg.vhd | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/vunit/vhdl/verification_components/src/bus_master_pkg-body.vhd b/vunit/vhdl/verification_components/src/bus_master_pkg-body.vhd index 8971c908e..12abd03d4 100644 --- a/vunit/vhdl/verification_components/src/bus_master_pkg-body.vhd +++ b/vunit/vhdl/verification_components/src/bus_master_pkg-body.vhd @@ -15,9 +15,13 @@ package body bus_master_pkg is impure function new_bus(data_length : natural; address_length : natural; byte_length : natural := 8; - logger : logger_t := bus_logger) return bus_master_t is + logger : logger_t := bus_logger; + actor : actor_t := null_actor) return bus_master_t is + variable p_actor : actor_t; begin - return (p_actor => new_actor, + p_actor := actor when actor /= null_actor else new_actor; + + return (p_actor => p_actor, p_data_length => data_length, p_address_length => address_length, p_byte_length => byte_length, diff --git a/vunit/vhdl/verification_components/src/bus_master_pkg.vhd b/vunit/vhdl/verification_components/src/bus_master_pkg.vhd index 239d67378..827e94e5c 100644 --- a/vunit/vhdl/verification_components/src/bus_master_pkg.vhd +++ b/vunit/vhdl/verification_components/src/bus_master_pkg.vhd @@ -34,7 +34,8 @@ package bus_master_pkg is impure function new_bus(data_length : natural; address_length : natural; byte_length : natural := 8; - logger : logger_t := bus_logger) return bus_master_t; + logger : logger_t := bus_logger; + actor : actor_t := null_actor) return bus_master_t; -- Return the length of the data on this bus impure function data_length(bus_handle : bus_master_t) return natural; diff --git a/vunit/vhdl/verification_components/test/tb_bus_master_pkg.vhd b/vunit/vhdl/verification_components/test/tb_bus_master_pkg.vhd index 1462d494a..45aba63e6 100644 --- a/vunit/vhdl/verification_components/test/tb_bus_master_pkg.vhd +++ b/vunit/vhdl/verification_components/test/tb_bus_master_pkg.vhd @@ -24,6 +24,10 @@ end entity; architecture a of tb_bus_master_pkg is constant memory : memory_t := new_memory; constant bus_handle : bus_master_t := new_bus(data_length => 32, address_length => 32); + constant logger : logger_t := get_logger("logger"); + constant actor : actor_t := new_actor("actor"); + constant custom_logger_and_actor_bus_handle : bus_master_t := + new_bus(data_length => 32, address_length => 32, logger => logger, actor => actor); begin main : process variable buf : buffer_t; @@ -86,6 +90,10 @@ begin check_bus(net, bus_handle, x"00000000", std_logic_vector'(x"112233")); check_only_log(bus_logger, "check_bus(x""00000000"") - Got x""77112233"" expected x""00112233""", failure); unmock(bus_logger); + + elsif run("test custom logger and actor bus master") then + check(custom_logger_and_actor_bus_handle.p_logger = logger); + check(custom_logger_and_actor_bus_handle.p_actor = actor); end if; test_runner_cleanup(runner); end process;