Skip to content

Commit baa2a59

Browse files
committed
add pslverror test cases and fix issue
1 parent 2683038 commit baa2a59

File tree

3 files changed

+33
-14
lines changed

3 files changed

+33
-14
lines changed

vunit/vhdl/verification_components/src/apb_requester.vhd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ begin
129129
penable_o <= '1';
130130
wait until (pready_i and penable_o) = '1' and rising_edge(clk);
131131

132-
check_equal(pslverr_i, error_this_transaction, "Unexpected error response.");
132+
check_equal(pslverr_i, error_this_transaction, "Unexpected pslverror response for write request.");
133133

134134
if is_visible(bus_handle.p_bus_handle.p_logger, debug) then
135135
debug(bus_handle.p_bus_handle.p_logger,
@@ -153,7 +153,7 @@ begin
153153
penable_o <= '1';
154154
wait until (pready_i and penable_o) = '1' and rising_edge(clk);
155155

156-
check_equal(pslverr_i, error_this_transaction, "Unexpected error response.");
156+
check_equal(pslverr_i, error_this_transaction, "Unexpected pslverror response for read request.");
157157

158158
reply_msg := new_msg;
159159
push_std_ulogic_vector(reply_msg, prdata_i);

vunit/vhdl/verification_components/src/apb_requester_pkg.vhd

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ package apb_requester_pkg is
4343
constant bus_handle : apb_requester_t;
4444
constant address : std_logic_vector;
4545
constant data : std_logic_vector;
46-
variable expected_error : std_logic := '0';
46+
constant expected_error : std_logic := '0';
4747
-- default byte enable is all bytes
4848
constant byte_enable : std_logic_vector := "");
4949
procedure write_bus(signal net : inout network_t;
5050
constant bus_handle : apb_requester_t;
5151
constant address : natural;
5252
constant data : std_logic_vector;
53-
variable expected_error : std_logic := '0';
53+
constant expected_error : std_logic := '0';
5454
-- default byte enable is all bytes
5555
constant byte_enable : std_logic_vector := "");
5656

@@ -59,26 +59,26 @@ package apb_requester_pkg is
5959
constant bus_handle : apb_requester_t;
6060
constant address : std_logic_vector;
6161
variable reference : inout bus_reference_t;
62-
variable expected_error : std_logic := '0');
62+
constant expected_error : std_logic := '0');
6363

6464
procedure read_bus(signal net : inout network_t;
6565
constant bus_handle : apb_requester_t;
6666
constant address : natural;
6767
variable reference : inout bus_reference_t;
68-
variable expected_error : std_logic := '0');
68+
constant expected_error : std_logic := '0');
6969

7070
-- Blocking: read bus with immediate reply
7171
procedure read_bus(signal net : inout network_t;
7272
constant bus_handle : apb_requester_t;
7373
constant address : std_logic_vector;
7474
variable data : inout std_logic_vector;
75-
variable expected_error : std_logic := '0');
75+
constant expected_error : std_logic := '0');
7676

7777
procedure read_bus(signal net : inout network_t;
7878
constant bus_handle : apb_requester_t;
7979
constant address : natural;
8080
variable data : inout std_logic_vector;
81-
variable expected_error : std_logic := '0');
81+
constant expected_error : std_logic := '0');
8282

8383
-- Blocking: Read bus and check result against expected data
8484
procedure check_bus(signal net : inout network_t;
@@ -185,7 +185,7 @@ package body apb_requester_pkg is
185185
constant bus_handle : apb_requester_t;
186186
constant address : std_logic_vector;
187187
constant data : std_logic_vector;
188-
variable expected_error : std_logic := '0';
188+
constant expected_error : std_logic := '0';
189189
-- default byte enable is all bytes
190190
constant byte_enable : std_logic_vector := "") is
191191
variable request_msg : msg_t := new_msg(apb_write_msg);
@@ -214,7 +214,7 @@ package body apb_requester_pkg is
214214
constant bus_handle : apb_requester_t;
215215
constant address : natural;
216216
constant data : std_logic_vector;
217-
variable expected_error : std_logic := '0';
217+
constant expected_error : std_logic := '0';
218218
-- default byte enable is all bytes
219219
constant byte_enable : std_logic_vector := "") is
220220
begin
@@ -226,7 +226,7 @@ package body apb_requester_pkg is
226226
constant bus_handle : apb_requester_t;
227227
constant address : std_logic_vector;
228228
variable data : inout std_logic_vector;
229-
variable expected_error : std_logic := '0') is
229+
constant expected_error : std_logic := '0') is
230230
variable reference : bus_reference_t;
231231
begin
232232
read_bus(net, bus_handle, address, reference, expected_error);
@@ -237,7 +237,7 @@ package body apb_requester_pkg is
237237
constant bus_handle : apb_requester_t;
238238
constant address : natural;
239239
variable data : inout std_logic_vector;
240-
variable expected_error : std_logic := '0') is
240+
constant expected_error : std_logic := '0') is
241241
variable reference : bus_reference_t;
242242
begin
243243
read_bus(net, bus_handle, to_address(bus_handle, address), reference, expected_error);
@@ -249,7 +249,7 @@ package body apb_requester_pkg is
249249
constant bus_handle : apb_requester_t;
250250
constant address : natural;
251251
variable reference : inout bus_reference_t;
252-
variable expected_error : std_logic := '0') is
252+
constant expected_error : std_logic := '0') is
253253
begin
254254
read_bus(net, bus_handle, to_address(bus_handle, address), reference, expected_error);
255255
end procedure;
@@ -258,7 +258,7 @@ package body apb_requester_pkg is
258258
constant bus_handle : apb_requester_t;
259259
constant address : std_logic_vector;
260260
variable reference : inout bus_reference_t;
261-
variable expected_error : std_logic := '0') is
261+
constant expected_error : std_logic := '0') is
262262
variable full_address : std_logic_vector(bus_handle.p_bus_handle.p_address_length-1 downto 0) := (others => '0');
263263
alias request_msg : msg_t is reference;
264264
begin

vunit/vhdl/verification_components/test/tb_apb_requester.vhd

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,25 @@ begin
126126
wait_until_idle(net, bus_handle);
127127
check_expected_was_written(memory);
128128

129+
elsif run("pslverror_during_read") then
130+
buf := allocate(memory => memory, num_bytes => 2, permissions => read_only);
131+
write_word(memory, base_address(buf), x"1234");
132+
mock(get_logger("check"), error);
133+
read_bus(net, bus_handle, base_address(buf), data, '1');
134+
wait_until_idle(net, bus_handle);
135+
check_only_log(get_logger("check"),
136+
"Unexpected pslverror response for read request. - Got 0. Expected 1.", error);
137+
unmock(get_logger("check"));
138+
139+
elsif run("pslverror_during_write") then
140+
buf := allocate(memory => memory, num_bytes => 2, permissions => write_only);
141+
mock(get_logger("check"), error);
142+
write_bus(net, bus_handle, base_address(buf), x"1122", '1');
143+
wait_until_idle(net, bus_handle);
144+
check_only_log(get_logger("check"),
145+
"Unexpected pslverror response for write request. - Got 0. Expected 1.", error);
146+
unmock(get_logger("check"));
147+
129148
end if;
130149

131150
wait for 100 ns;

0 commit comments

Comments
 (0)