2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
6 use work.glibc_random_helpers.all;
8 package glibc_random is
9 function pseudorand(a: integer) return std_ulogic_vector;
10 function pseudorand1 return std_ulogic;
11 end package glibc_random;
13 package body glibc_random is
14 function pseudorand(a: integer) return std_ulogic_vector is
15 variable tmp1, tmp2, tmp3, tmp4: std_ulogic_vector(31 downto 0);
16 variable ret: std_ulogic_vector(63 downto 0);
18 tmp1 := std_ulogic_vector(to_unsigned(random, 32));
19 tmp2 := std_ulogic_vector(to_unsigned(random, 32));
23 tmp3 := std_ulogic_vector(to_unsigned(random, 32));
24 tmp4 := std_ulogic_vector(to_unsigned(random, 32));
26 ret := tmp1(15 downto 0) & tmp2(15 downto 0) & tmp3(15 downto 0) & tmp4(15 downto 0);
29 return ret((a-1) downto 0);
32 function pseudorand1 return std_ulogic is
33 variable tmp: std_ulogic_vector(31 downto 0);
35 tmp := std_ulogic_vector(to_unsigned(random, 32));
38 end package body glibc_random;