OpenCores
URL https://opencores.org/ocsvn/lxp32/lxp32/trunk

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [common_pkg/] [common_pkg.vhd] - Diff between revs 2 and 6

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 6
Line 2... Line 2...
-- Common package for LXP32 testbenches
-- Common package for LXP32 testbenches
--
--
-- Part of the LXP32 verification environment
-- Part of the LXP32 verification environment
--
--
-- Copyright (c) 2016 by Alex I. Kuznetsov
-- Copyright (c) 2016 by Alex I. Kuznetsov
--
 
-- Note: the "rand" function declared in this package implements
 
-- a linear congruent pseudo-random number generator as defined in
 
-- the ISO/IEC 9899:1999 standard.
 
---------------------------------------------------------------------
---------------------------------------------------------------------
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.numeric_std.all;
 
 
package common_pkg is
package common_pkg is
        shared variable rand_state: unsigned(31 downto 0):=to_unsigned(1,32);
        type rng_state_type is record
 
                seed1: positive;
 
                seed2: positive;
 
        end record;
 
 
        impure function rand return integer;
        -- Generate a pseudo-random value of integer type from [a;b] range
        impure function rand(a: integer; b: integer) return integer;
        -- Output is stored in x
 
        procedure rand(variable st: inout rng_state_type; a,b: integer; variable x: out integer);
 
 
 
        -- Convert std_logic_vector to a hexadecimal string (similar to
 
        -- the "to_hstring" function from VHDL-2008
        function hex_string(x: std_logic_vector) return string;
        function hex_string(x: std_logic_vector) return string;
end package;
end package;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.