-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add possibility to configure random stalls for axi_stream (#557)
* Added possibility to configure random stalls At creation of master/slave one can provide a configuration which tells how often a stall should occure, and if it occures what the minimal/maximal stall length of such a stall shall be. * Added lines for linter * Removed whitespaces and added check for zero stall activity where not expected * replaced configuration functions by constants configured by generic * uncommented disabled checks * fixed ordering of the signals in if statement and used VHDL 2008 * Fixed order of generics to be backwards compatible based on pull request comment of 1138-4EB * Change of stall generics to provide [0-100]% stall * replaces stat signals with records * only include RandomPType with use instead of all * made random variable privat to process * moved procedures that are private to a private package * give meaningful name to generics to avoid comment * fixed return value for p_actor in new_axi_stream_slave Changed new_actor to p_actor * added procedure drive_invalid_output * replaced for loop with direct call to test case * introduced new_stall_config function * unified random stall test cases for axi_stream * removed explicit numbers in test case this makes it more general and percentage numbers can be varied through the generics without having to manual change the vhdl code. * replaced if statement for min/max evaluation by min/max functions * reformated using black * fixed typo * fixed formating issues * Fixed year of license text in axi_stream_private_pkg.vhd * uppercased test bench variable
- Loading branch information
Showing
6 changed files
with
373 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
vunit/vhdl/verification_components/src/axi_stream_private_pkg.vhd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
-- This Source Code Form is subject to the terms of the Mozilla Public | ||
-- License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
-- You can obtain one at http://mozilla.org/MPL/2.0/. | ||
-- | ||
-- Copyright (c) 2014-2020, Lars Asplund [email protected] | ||
|
||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
|
||
library osvvm; | ||
use osvvm.RandomPkg.RandomPType; | ||
|
||
use work.axi_stream_pkg.all; | ||
|
||
package axi_stream_private_pkg is | ||
procedure probability_stall_axi_stream( | ||
signal aclk : in std_logic; | ||
axi_stream : in axi_stream_slave_t; | ||
rnd : inout RandomPType | ||
); | ||
|
||
procedure probability_stall_axi_stream( | ||
signal aclk : in std_logic; | ||
axi_stream : in axi_stream_master_t; | ||
rnd : inout RandomPType | ||
); | ||
|
||
procedure probability_stall_axi_stream( | ||
signal aclk : in std_logic; | ||
stall_config : in stall_config_t; | ||
rnd : inout RandomPType | ||
); | ||
|
||
end package; | ||
|
||
package body axi_stream_private_pkg is | ||
|
||
procedure probability_stall_axi_stream( | ||
signal aclk : in std_logic; | ||
axi_stream : in axi_stream_master_t; | ||
rnd : inout RandomPType) is | ||
begin | ||
probability_stall_axi_stream(aclk, axi_stream.p_stall_config, rnd); | ||
end procedure; | ||
|
||
procedure probability_stall_axi_stream( | ||
signal aclk : in std_logic; | ||
axi_stream : in axi_stream_slave_t; | ||
rnd : inout RandomPType) is | ||
begin | ||
probability_stall_axi_stream(aclk, axi_stream.p_stall_config, rnd); | ||
end procedure; | ||
|
||
procedure probability_stall_axi_stream( | ||
signal aclk : in std_logic; | ||
stall_config : in stall_config_t; | ||
rnd : inout RandomPType) is | ||
variable num_stall_cycles : natural := 0; | ||
begin | ||
if rnd.Uniform(0.0, 1.0) < stall_config.stall_probability then | ||
num_stall_cycles := rnd.FavorSmall(stall_config.min_stall_cycles, stall_config.max_stall_cycles); | ||
end if; | ||
for stall in 0 to num_stall_cycles-1 loop | ||
wait until rising_edge(aclk); | ||
end loop; | ||
end procedure; | ||
|
||
end package body; |
Oops, something went wrong.