«…лишь недалекие люди боятся конкуренции, а люди подлинного творчества ценят общение с каждым талантом…» А. Бек, Талант.

Open Source VHDL Verification Methodology/Пример использования OS-VVM/Пример 2

Материал из Wiki
Перейти к: навигация, поиск
Проект OS-VVM

Исходные коды

Описание примеров

Презентации

Coverage

* VHDL * PSL *

Содержание

Листинги 1

-- Для покрытия всех пар состояний требуется 1615 циклов
-- покрытие A достигается за 103 циклов
-- покрытие B достикается за 68 циклов



Распределение покрытия CovA

Gnuplot Plot

Распределение покрытия CovB

Gnuplot Plot

Распределение покрытия CovD

Gnuplot Plot

Распределение покрытия CovCrossAB (3D)

Gnuplot Plot

Gnuplot Plot

Листинги 2

-- Для покрытия всех пар состояний требуется 1615 циклов
-- покрытие A достигается за 103 циклов
-- покрытие B достикается за 68 циклов


Листинги 3


Листинг 0

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.math_real.all;
  4. use ieee.numeric_std.all;
  5.  
  6. entity tstb is
  7. end;
  8.  
  9. architecture beh of tstb is
  10.  
  11.   component sxema
  12.     port (a, b : in  std_logic_vector (4 downto 1);
  13.           d    : out std_logic_vector (8 downto 1));
  14.   end component;
  15.  
  16.   signal a, b : std_logic_vector (4 downto 1);
  17.   signal d    : std_logic_vector (8 downto 1);
  18.  
  19. begin
  20.   p0 : sxema
  21.     port map (a => a, b => b, d => d);
  22.  
  23.   RandomGenProc1 : process
  24.     variable RndValA, RndValB : real;           -- Random value
  25.     variable RndA, RndB       : integer;
  26.     variable SeedA1           : positive := 7;  -- initialize seeds
  27.     variable SeedA2           : positive := 1;
  28.     variable SeedB1           : positive := 4;  -- initialize seeds
  29.     variable SeedB2           : positive := 2;
  30.   begin
  31.  
  32.     for i in 1 to 100 loop
  33.       uniform(SeedA1, SeedA2, RndValA);       -- randomize 0.0 to 1.0
  34.       uniform(SeedB1, SeedB2, RndValB);       -- randomize 0.0 to 1.0
  35.       RndA := integer(trunc(RndValA*16.0));   -- scale to 0 to 15
  36.       RndB := integer(trunc(RndValB*16.0));   -- scale to 0 to 15
  37.  
  38.       a <= std_logic_vector(to_unsigned(RndA, 4));
  39.       b <= std_logic_vector(to_unsigned(RndB, 4));
  40.  
  41.       wait for 10 ns;
  42.  
  43.     end loop;
  44.     wait ;
  45.   end process;
  46. end;


   procedure UNIFORM(variable SEED1,SEED2:inout POSITIVE; variable X:out REAL);
       -- Purpose:
       --         Returns, in X, a pseudo-random number with uniform
       --         distribution in the open interval (0.0, 1.0).
       -- Special values:
       --         None
       -- Domain:
       --         1 <= SEED1 <= 2147483562; 1 <= SEED2 <= 2147483398
       -- Error conditions:
       --         Error if SEED1 or SEED2 outside of valid domain
       -- Range:
       --         0.0 < X < 1.0
       -- Notes:
       --         a) The semantics for this function are described by the
       --            algorithm published by Pierre L'Ecuyer in "Communications
       --            of the ACM," vol. 31, no. 6, June 1988, pp. 742-774.
       --            The algorithm is based on the combination of two
       --            multiplicative linear congruential generators for 32-bit
       --            platforms.
       --
       --         b) Before the first call to UNIFORM, the seed values
       --            (SEED1, SEED2) have to be initialized to values in the range
       --            [1, 2147483562] and [1, 2147483398] respectively.  The
       --            seed values are modified after each call to UNIFORM.
       --
       --         c) This random number generator is portable for 32-bit
       --            computers, and it has a period of ~2.30584*(10**18) for each
       --            set of seed values.
       --
       --         d) For information on spectral tests for the algorithm, refer
       --            to the L'Ecuyer article.
   function TRUNC (X : in REAL ) return REAL;
       -- Purpose:
       --         Truncates X towards 0.0 and returns truncated value
       -- Special values:
       --         TRUNC(0.0) = 0.0
       -- Domain:
       --         X in REAL
       -- Error conditions:
       --         None
       -- Range:
       --         TRUNC(X) is mathematically unbounded
       -- Notes:
       --         a) Implementations have to support at least the domain
       --                ABS(X) < REAL(INTEGER'HIGH)

NEW