Go Back

Source code

Details

Name: pltbutils
Created: Apr 14, 2013
Updated: Feb 2, 2015
SVN Updated: Feb 2, 2015

Other project properties

Category: Testing / Verification
Language: VHDL
Development status: Beta
Additional info: Design done , Specification done
WishBone Compliant: No
License: LGPL

Description

PlTbUtils makes it easy to create automatic, self-checking simulation testbenches, and to locate bugs during a simulation. It is a collection of functions, procedures and testbench components that simplifies creation of stimuli and checking results of a device under test.

Features:

  • Simulation status printed in transcript windows as well as in waveform window (error count, checks count, number and name of current test, etc).
  • Check procedures which output meaningful information when a check fails.
  • Clear SUCCESS/FAIL message at end of simulation.
  • Easy to locate point in time of bugs, by studying increments of the error counter in the waveform window.
  • User-defined information messages in the waveformwindow about what is currently going on.
  • Transcript outputs prepared for parsing by scripts, e.g. in regression tests.
  • Reduces amount of code in tests, which makes them faster to write and easier to read.

It is intended that PlTbUtils will constantly expand by adding more and more functions, procedures and testbench components. Comments, feedback and suggestions are welcome to pela.opencores@gmail.com .

The project page on the web is http://opencores.org/project,pltbutils

Subversion repository URL is http://opencores.org/ocsvn/pltbutils/pltbutils/trunk

Subversion export command is

      svn export http://opencores.org/ocsvn/pltbutils/pltbutils/trunk pltbutils
     

See the PlTbUtils Specification .

A quick look

example_wave

During a simulation, the waveform window shows current test number, test name, user-defined info, accumulated number och checks and errors. When the error counter increments, a bug has been found in that point in time.

example_transcript

The transcript window clearly shows points in time where the simulation starts, ends, and where errors are detected. The simulation stops with a clear SUCCESS/FAIL message, specifically formatted for parsing by scripts.

example_transcript_bugfixed

The testcase code is compact and to the point, which results in less code to write, and makes the code easier to read, as in the following example.

      library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.pltbutils_func_pkg.all;

-- NOTE: The purpose of the following code is to demostrate some of the 
-- features in PlTbUtils, not to do a thorough verification.
architecture tc1 of tc_example is
begin
  p_tc1 : process
  begin
    startsim("tc1", pltbutils_sc);
    rst         <= '1';
    carry_in    <= '0';
    x           <= (others => '0');
    y           <= (others => '0');
        
    testname(1, "Reset test", pltbutils_sc);
    waitclks(2, clk, pltbutils_sc);    
    check("Sum during reset",       sum,         0, pltbutils_sc);
    check("Carry out during reset", carry_out, '0', pltbutils_sc);
    rst         <= '0';
    
    testname(2, "Simple sum test", pltbutils_sc);
    carry_in <= '0';
    x <= std_logic_vector(to_unsigned(1, x'length));
    y <= std_logic_vector(to_unsigned(2, x'length));
    waitclks(2, clk, pltbutils_sc);
    check("Sum",       sum,         3, pltbutils_sc); 
    check("Carry out", carry_out, '0', pltbutils_sc); 
    
    testname(3, "Simple carry in test", pltbutils_sc);
    print(pltbutils_sc, "Bug here somewhere");
    carry_in <= '1';
    x <= std_logic_vector(to_unsigned(1, x'length));
    y <= std_logic_vector(to_unsigned(2, x'length));
    waitclks(2, clk, pltbutils_sc);
    check("Sum",       sum,         4, pltbutils_sc); 
    check("Carry out", carry_out, '0', pltbutils_sc);
    print(pltbutils_sc, "");

    testname(4, "Simple carry out test", pltbutils_sc);
    carry_in <= '0';
    x <= std_logic_vector(to_unsigned(2**G_WIDTH-1, x'length));
    y <= std_logic_vector(to_unsigned(1, x'length));
    waitclks(2, clk, pltbutils_sc);
    check("Sum",       sum,         0, pltbutils_sc); 
    check("Carry out", carry_out, '1', pltbutils_sc);

    endsim(pltbutils_sc, true);
    wait;
  end process p_tc1;
end architecture tc1;