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

Subversion Repositories pltbutils

[/] [pltbutils/] [trunk/] [src/] [vhdl/] [pltbutils_func_pkg.vhd] - Diff between revs 97 and 99

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

Rev 97 Rev 99
Line 378... Line 378...
    variable pltbv              : inout pltbv_t;
    variable pltbv              : inout pltbv_t;
    signal   pltbs              : out   pltbs_t
    signal   pltbs              : out   pltbs_t
  );
  );
  procedure check(
  procedure check(
    constant rpt                : in    string;
    constant rpt                : in    string;
 
    constant actual             : in    boolean;
 
    constant expected           : in    boolean;
 
    variable pltbv              : inout pltbv_t;
 
    signal   pltbs              : out   pltbs_t
 
  );
 
  procedure check(
 
    constant rpt                : in    string;
 
    constant actual             : in    boolean;
 
    constant expected           : in    integer;
 
    variable pltbv              : inout pltbv_t;
 
    signal   pltbs              : out   pltbs_t
 
  );
 
  procedure check(
 
    constant rpt                : in    string;
 
    constant actual             : in    time;
 
    constant expected           : in    time;
 
    variable pltbv              : inout pltbv_t;
 
    signal   pltbs              : out   pltbs_t
 
  );
 
  procedure check(
 
    constant rpt                : in    string;
 
    constant actual             : in    time;
 
    constant expected           : in    time;
 
    constant tolerance          : in    time;
 
    variable pltbv              : inout pltbv_t;
 
    signal   pltbs              : out   pltbs_t
 
  );
 
  procedure check(
 
    constant rpt                : in    string;
    constant actual             : in    string;
    constant actual             : in    string;
    constant expected           : in    string;
    constant expected           : in    string;
    variable pltbv              : inout pltbv_t;
    variable pltbv              : inout pltbv_t;
    signal   pltbs              : out   pltbs_t
    signal   pltbs              : out   pltbs_t
  );
  );
Line 1271... Line 1300...
  ----------------------------------------------------------------------------
  ----------------------------------------------------------------------------
  -- check
  -- check
  --
  --
  -- procedure check(
  -- procedure check(
  --   constant rpt             : in    string;
  --   constant rpt             : in    string;
  --   constant actual          : in    integer|std_logic|std_logic_vector|unsigned|signed|string;
  --   constant actual          : in    integer|std_logic|std_logic_vector|unsigned|signed|boolean|time|string;
  --   constant expected        : in    integer|std_logic|std_logic_vector|unsigned|signed|string;
  --   constant expected        : in    integer|std_logic|std_logic_vector|unsigned|signed|boolean|time|string;
  --   variable pltbv           : inout pltbv_t;
  --   variable pltbv           : inout pltbv_t;
  --   signal   pltbs           : out   pltbs_t
  --   signal   pltbs           : out   pltbs_t
  -- )
  -- )
  --
  --
  -- procedure check(
  -- procedure check(
Line 1288... Line 1317...
  --   signal   pltbs           : out   pltbs_t
  --   signal   pltbs           : out   pltbs_t
  -- )
  -- )
  --
  --
  -- procedure check(
  -- procedure check(
  --   constant rpt             : in    string;
  --   constant rpt             : in    string;
 
  --   constant actual          : in    time;
 
  --   constant expected        : in    time;
 
  --   constant tolerance       : in    time;
 
  --   variable pltbv           : inout pltbv_t;
 
  --   signal   pltbs           : out   pltbs_t
 
  -- )
 
  --
 
  -- procedure check(
 
  --   constant rpt             : in    string;
  --   constant expr            : in    boolean;
  --   constant expr            : in    boolean;
  --   variable pltbv           : inout pltbv_t;
  --   variable pltbv           : inout pltbv_t;
  --   signal   pltbs           : out   pltbs_t
  --   signal   pltbs           : out   pltbs_t
  -- )
  -- )
  --
  --
Line 1308... Line 1346...
  --                            value, becase check() prints that
  --                            value, becase check() prints that
  --                            automatically.
  --                            automatically.
  --
  --
  --   actual                   The signal or variable to be checked.
  --   actual                   The signal or variable to be checked.
  --                            Supported types: integer, std_logic,
  --                            Supported types: integer, std_logic,
  --                            std_logic_vector, unsigned, signed.
  --                            std_logic_vector, unsigned, signed, boolean,
 
  --                            time, string.
  --
  --
  --   expected                 Expected value.
  --   expected                 Expected value.
  --                            Same type as data or integer.
  --                            Same type as data or integer.
  --
  --
  --   mask                     Bit mask and:ed to data and expected
  --   mask                     Bit mask and:ed to data and expected
  --                            before comparison.
  --                            before comparison.
  --                            Optional if data is std_logic_vector.
  --                            Optional if data is std_logic_vector.
  --                            Not allowed for other types.
  --                            Not allowed for other types.
  --
  --
 
  --   tolerance                Allowed tolerance. Checks that
 
  --                            expected - tolerance <= actual <= expected + tolerance
 
  --                            is true.
 
  -- 
  --   expr                     boolean expression for checking.
  --   expr                     boolean expression for checking.
  --                            This makes it possible to check any kind of
  --                            This makes it possible to check any kind of
  --                            expresion, not just equality.
  --                            expresion, not just equality.
  --
  --
  --   pltbv, pltbs             PlTbUtils' status- and control variable and
  --   pltbv, pltbs             PlTbUtils' status- and control variable and
Line 1470... Line 1513...
  ) is
  ) is
  begin
  begin
    check(rpt, actual, to_signed(expected, actual'length), pltbv, pltbs);
    check(rpt, actual, to_signed(expected, actual'length), pltbv, pltbs);
  end procedure check;
  end procedure check;
 
 
 
  -- check boolean
 
  procedure check(
 
    constant rpt                : in    string;
 
    constant actual             : in    boolean;
 
    constant expected           : in    boolean;
 
    variable pltbv              : inout pltbv_t;
 
    signal   pltbs              : out   pltbs_t
 
  ) is
 
  begin
 
    check(rpt, actual = expected, str(actual), str(expected), "", pltbv, pltbs);
 
  end procedure check;
 
 
 
  -- check boolean against integer
 
  procedure check(
 
    constant rpt                : in    string;
 
    constant actual             : in    boolean;
 
    constant expected           : in    integer;
 
    variable pltbv              : inout pltbv_t;
 
    signal   pltbs              : out   pltbs_t
 
  ) is
 
  begin
 
    check(rpt, ((actual = false and expected = 0) or (actual = true and expected = 1)),
 
          str(actual), str(expected), "", pltbv, pltbs);
 
  end procedure check;
 
 
 
  -- check time
 
  procedure check(
 
    constant rpt                : in    string;
 
    constant actual             : in    time;
 
    constant expected           : in    time;
 
    variable pltbv              : inout pltbv_t;
 
    signal   pltbs              : out   pltbs_t
 
  ) is
 
  begin
 
    check(rpt, actual = expected, time'image(actual), time'image(expected), "", pltbv, pltbs);
 
  end procedure check;
 
 
 
  -- check time with tolerance
 
  procedure check(
 
    constant rpt                : in    string;
 
    constant actual             : in    time;
 
    constant expected           : in    time;
 
    constant tolerance          : in    time;
 
    variable pltbv              : inout pltbv_t;
 
    signal   pltbs              : out   pltbs_t
 
  ) is
 
  begin
 
    check(rpt, ((actual >= expected-tolerance) and (actual <= expected+tolerance)),
 
          time'image(actual), time'image(expected) & " +/- " & time'image(tolerance), "", pltbv, pltbs);
 
  end procedure check;
 
 
  -- check string
  -- check string
  procedure check(
  procedure check(
    constant rpt                : in    string;
    constant rpt                : in    string;
    constant actual             : in    string;
    constant actual             : in    string;
    constant expected           : in    string;
    constant expected           : in    string;
Line 1494... Line 1588...
    end if;
    end if;
    check(rpt, not mismatch, actual, expected, "", pltbv, pltbs);
    check(rpt, not mismatch, actual, expected, "", pltbv, pltbs);
  end procedure check;
  end procedure check;
 
 
  -- check with boolean expression
  -- check with boolean expression
  -- Check signal or variable with a boolean expression as argument C_EXPR.
  -- Check signal or variable with a boolean expression as argument expr.
  -- This allowes any kind of check.
  -- This allowes any kind of check, including less than, greater than,
 
  -- ranges, etc. But there are no clear messages in case of mismatch.
  procedure check(
  procedure check(
    constant rpt                : in    string;
    constant rpt                : in    string;
    constant expr               : in    boolean;
    constant expr               : in    boolean;
    variable pltbv              : inout pltbv_t;
    variable pltbv              : inout pltbv_t;
    signal   pltbs              : out   pltbs_t
    signal   pltbs              : out   pltbs_t
  ) is
  ) is
  begin
  begin
    check(rpt, expr, "", "", "", pltbv, pltbs);
    check(rpt, expr, "", "", "", pltbv, pltbs);
  end procedure check;
  end procedure check;
 
 
 
  -- check base procedure
 
  -- All other check procedures perform the check, and calls this procedure
 
  -- with the check result in the expr argument.
 
  -- This procedure can also be called directly. It allow any kind of check,
 
  -- including less than, greater than, ranges, etc. 
 
  -- Your calling code must convert actual, expected and mask to strings.
  procedure check(
  procedure check(
    constant rpt                : in    string;
    constant rpt                : in    string;
    constant expr               : in    boolean;
    constant expr               : in    boolean;
    constant actual             : in    string;
    constant actual             : in    string;
    constant expected           : in    string;
    constant expected           : in    string;

powered by: WebSVN 2.1.0

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