Skip to content

Commit 472d514

Browse files
committed
use null_actor/null_logger as defaults for master
1 parent 5aaf471 commit 472d514

1 file changed

Lines changed: 27 additions & 16 deletions

File tree

vunit/vhdl/verification_components/src/apb_master_pkg.vhd

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ package apb_master_pkg is
2222
p_bus_handle : bus_master_t;
2323
p_drive_invalid : boolean;
2424
p_drive_invalid_val : std_logic;
25-
p_ready_high_probability : real range 0.0 to 1.0;
2625
end record;
2726

2827
impure function new_apb_master(
2928
data_length : natural;
3029
address_length : natural;
31-
logger : logger_t := bus_logger;
30+
logger : logger_t := null_logger;
3231
actor : actor_t := null_actor;
3332
drive_invalid : boolean := true;
34-
drive_invalid_val : std_logic := 'X';
35-
ready_high_probability : real := 1.0
33+
drive_invalid_val : std_logic := 'X'
3634
) return apb_master_t;
3735

3836
function get_logger(bus_handle : apb_master_t) return logger_t;
@@ -116,24 +114,37 @@ package body apb_master_pkg is
116114
impure function new_apb_master(
117115
data_length : natural;
118116
address_length : natural;
119-
logger : logger_t := bus_logger;
117+
logger : logger_t := null_logger;
120118
actor : actor_t := null_actor;
121119
drive_invalid : boolean := true;
122-
drive_invalid_val : std_logic := 'X';
123-
ready_high_probability : real := 1.0
120+
drive_invalid_val : std_logic := 'X'
124121
) return apb_master_t is
125-
variable bus_handle : bus_master_t := new_bus(
126-
data_length => data_length,
127-
address_length => address_length,
128-
logger => logger,
129-
actor => actor
130-
);
122+
impure function create_bus (logger : logger_t; actor : actor_t) return bus_master_t is
123+
begin
124+
return new_bus(
125+
data_length => data_length,
126+
address_length => address_length,
127+
logger => logger,
128+
actor => actor
129+
);
130+
end function;
131+
variable actor_tmp : actor_t := null_actor;
132+
variable logger_tmp : logger_t := null_logger;
131133
begin
134+
if actor = null_actor then
135+
actor_tmp := new_actor;
136+
else
137+
actor_tmp := actor;
138+
end if;
139+
if logger = null_logger then
140+
logger_tmp := bus_logger;
141+
else
142+
logger_tmp := logger;
143+
end if;
132144
return (
133-
p_bus_handle => bus_handle,
145+
p_bus_handle => create_bus(logger_tmp, actor_tmp),
134146
p_drive_invalid => drive_invalid,
135-
p_drive_invalid_val => drive_invalid_val,
136-
p_ready_high_probability => ready_high_probability
147+
p_drive_invalid_val => drive_invalid_val
137148
);
138149
end;
139150

0 commit comments

Comments
 (0)