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

Subversion Repositories pltbutils

[/] [pltbutils/] [trunk/] [src/] [vhdl/] [pltbutils_func_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 112... Line 112...
    signal   pltbutils_sc       : out   pltbutils_sc_t
    signal   pltbutils_sc       : out   pltbutils_sc_t
  );
  );
 
 
  -- print, printv, print2
  -- print, printv, print2
  procedure print(
  procedure print(
 
    constant active             : in    boolean;
 
    signal   s                  : out   string;
 
    constant txt                : in    string
 
  );
 
  procedure print(
    signal   s                  : out   string;
    signal   s                  : out   string;
    constant txt                : in    string
    constant txt                : in    string
  );
  );
  procedure printv(
  procedure printv(
 
    constant active             : in    boolean;
    variable s                  : out   string;
    variable s                  : out   string;
    constant txt                : in    string
    constant txt                : in    string
  );
  );
  procedure printv(
  procedure printv(
 
    variable s                  : out   string;
 
    constant txt                : in    string
 
  );
 
  procedure printv(
 
    constant active             : in    boolean;
 
    variable s                  : inout pltbutils_p_string_t;
 
    constant txt                : in    string
 
  );
 
  procedure printv(
    variable s                  : inout pltbutils_p_string_t;
    variable s                  : inout pltbutils_p_string_t;
    constant txt                : in    string
    constant txt                : in    string
  );
  );
  procedure print(
  procedure print(
 
    constant active             : in    boolean;
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    constant txt                : in    string
    constant txt                : in    string
  );
  );
 
  procedure print(
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant txt                : in    string
 
  );
 
  procedure print2(
 
    constant active             : in    boolean;
 
    signal   s                  : out   string;
 
    constant txt                : in    string
 
  );
  procedure print2(
  procedure print2(
    signal   s                  : out   string;
    signal   s                  : out   string;
    constant txt                : in    string
    constant txt                : in    string
  );
  );
  procedure print2(
  procedure print2(
 
    constant active             : in    boolean;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant txt                : in    string
 
  );
 
  procedure print2(
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    constant txt                : in    string
    constant txt                : in    string
  );
  );
 
 
  -- waitclks
  -- waitclks
Line 145... Line 175...
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    constant falling            : in    boolean := false;
    constant falling            : in    boolean := false;
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
  );
  );
 
 
 
  -- waitsig
 
  procedure waitsig(
 
    signal   s                  : in    integer;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
  procedure waitsig(
 
    signal   s                  : in    std_logic;
 
    constant value              : in    std_logic;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
  procedure waitsig(
 
    signal   s                  : in    std_logic;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
  procedure waitsig(
 
    signal   s                  : in    std_logic_vector;
 
    constant value              : in    std_logic_vector;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
  procedure waitsig(
 
    signal   s                  : in    std_logic_vector;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
  procedure waitsig(
 
    signal   s                  : in    unsigned;
 
    constant value              : in    unsigned;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
  procedure waitsig(
 
    signal   s                  : in    unsigned;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
  procedure waitsig(
 
    signal   s                  : in    signed;
 
    constant value              : in    signed;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
  procedure waitsig(
 
    signal   s                  : in    signed;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  );
 
 
  -- check
  -- check
  procedure check(
  procedure check(
    constant rpt                : in    string;
    constant rpt                : in    string;
    constant data               : in    integer;
    constant data               : in    integer;
    constant expected           : in    integer;
    constant expected           : in    integer;
Line 462... Line 566...
  --   signal   s                  : out   string;
  --   signal   s                  : out   string;
  --   constant txt                : in    string
  --   constant txt                : in    string
  -- ) 
  -- ) 
  --
  --
  -- procedure print(
  -- procedure print(
 
  --   constant active             : in    boolean;
 
  --   signal   s                  : out   string;
 
  --   constant txt                : in    string
 
  -- ) 
 
  --
 
  -- procedure print(
  --   signal   pltbutils_sc       : out   pltbutils_sc_t;
  --   signal   pltbutils_sc       : out   pltbutils_sc_t;
  --   constant txt                : in    string
  --   constant txt                : in    string
  -- )
  -- )
  --
  --
 
  -- procedure print(
 
  --   constant active             : in    boolean;
 
  --   signal   pltbutils_sc       : out   pltbutils_sc_t;
 
  --   constant txt                : in    string
 
  -- )
 
  --
 
  -- procedure printv(
 
  --   variable s                  : out   string;
 
  --   constant txt                : in    string
 
  -- )
 
  --
  -- procedure printv(
  -- procedure printv(
 
  --   constant active             : in    boolean;
  --   variable s                  : out   string;
  --   variable s                  : out   string;
  --   constant txt                : in    string
  --   constant txt                : in    string
  -- )
  -- )
  --
  --
  -- procedure print2(    
  -- procedure print2(    
  --   signal   s                  : out   string;
  --   signal   s                  : out   string;
  --   constant txt                : in    string
  --   constant txt                : in    string
  -- )
  -- )
  --
  --
  -- procedure print2(    
  -- procedure print2(    
 
  --   constant active             : in    boolean;
 
  --   signal   s                  : out   string;
 
  --   constant txt                : in    string
 
  -- )
 
  --
 
  -- procedure print2(    
 
  --   signal   pltbutils          : out   pltbutils_sc_t;
 
  --   constant txt                : in    string
 
  -- )
 
  --
 
  -- procedure print2(    
 
  --   constant active             : in    boolean;
  --   signal   pltbutils          : out   pltbutils_sc_t;
  --   signal   pltbutils          : out   pltbutils_sc_t;
  --   constant txt                : in    string
  --   constant txt                : in    string
  -- )
  -- )
  --
  --
  -- print() prints text messages to a signal for viewing in the simulator's
  -- print() prints text messages to a signal for viewing in the simulator's
Line 493... Line 627...
  --   s                        Signal or variable of type string to be 
  --   s                        Signal or variable of type string to be 
  --                            printed to.
  --                            printed to.
  --
  --
  --   txt                      The text.
  --   txt                      The text.
  --
  --
 
  --   active                   The text is only printed if active is true.
 
  --                            Useful for debug switches, etc.
 
  --
  --   pltbutils_sc             PlTbUtils' global status- and control signal 
  --   pltbutils_sc             PlTbUtils' global status- and control signal 
  --                            of type pltbutils_sc_t. 
  --                            of type pltbutils_sc_t. 
  --                            The name must be no other than pltbutils_sc.
  --                            The name must be no other than pltbutils_sc.
  --
  --
  -- If the string txt  is longer than the signal s, the text will be truncated.
  -- If the string txt  is longer than the signal s, the text will be truncated.
  -- If txt  is shorter, s will be padded with spaces.
  -- If txt  is shorter, s will be padded with spaces.
  --
  --
  -- Examples:
  -- Examples:
  -- print(msg, "Hello, world"); -- Prints to signal msg
  -- print(msg, "Hello, world"); -- Prints to signal msg
 
  -- print(G_DEBUG, msg, "Hello, world"); -- Prints to signal msg if 
 
  --                                      -- generic G_DEBUG is true
  -- printv(v_msg, "Hello, world"); -- Prints to variable msg
  -- printv(v_msg, "Hello, world"); -- Prints to variable msg
  -- print(pltbutils_sc, "Hello, world"); -- Prints to "info" in waveform window
  -- print(pltbutils_sc, "Hello, world"); -- Prints to "info" in waveform window
  -- print2(msg, "Hello, world"); -- Prints to signal and transcript window 
  -- print2(msg, "Hello, world"); -- Prints to signal and transcript window 
  -- print(pltbutils_sc, "Hello, world"); -- Prints to "info" in waveform and
  -- print(pltbutils_sc, "Hello, world"); -- Prints to "info" in waveform and
  --                                      -- transcript windows
  --                                      -- transcript windows
  ----------------------------------------------------------------------------
  ----------------------------------------------------------------------------
  procedure print(
  procedure print(
 
    constant active             : in    boolean;
    signal   s                  : out   string;
    signal   s                  : out   string;
    constant txt                : in    string
    constant txt                : in    string
  ) is
  ) is
    variable j : positive := txt 'low;
    variable j : positive := txt 'low;
  begin
  begin
 
    if active then
    for i in s'range loop
    for i in s'range loop
      if j <= txt 'high then
      if j <= txt 'high then
        s(i) <= txt (j);
        s(i) <= txt (j);
      else
      else
        s(i) <= ' ';
        s(i) <= ' ';
      end if;
      end if;
      j := j + 1;
      j := j + 1;
    end loop;
    end loop;
 
    end if;
 
  end procedure print;
 
 
 
  procedure print(
 
    signal   s                  : out   string;
 
    constant txt                : in    string
 
  ) is
 
  begin
 
    print(true, s, txt);
  end procedure print;
  end procedure print;
 
 
  procedure printv(
  procedure printv(
 
    constant active             : in    boolean;
    variable s                  : out   string;
    variable s                  : out   string;
    constant txt                : in    string
    constant txt                : in    string
  ) is
  ) is
    variable j : positive := txt 'low;
    variable j : positive := txt 'low;
  begin
  begin
 
    if active then
    for i in s'range loop
    for i in s'range loop
      if j <= txt 'high then
      if j <= txt 'high then
        s(i) := txt (j);
        s(i) := txt (j);
      else
      else
        s(i) := ' ';
        s(i) := ' ';
      end if;
      end if;
      j := j + 1;
      j := j + 1;
    end loop;
    end loop;
 
    end if;
 
  end procedure printv;
 
 
 
  procedure printv(
 
    variable s                  : out   string;
 
    constant txt                : in    string
 
  ) is
 
  begin
 
    printv(true, s, txt);
  end procedure printv;
  end procedure printv;
 
 
  -- VHDL-2002:
  -- VHDL-2002:
  procedure printv(
  procedure printv(
 
    constant active             : in    boolean;
    variable s                  : inout pltbutils_p_string_t;
    variable s                  : inout pltbutils_p_string_t;
    constant txt                : in    string
    constant txt                : in    string
  ) is
  ) is
    variable j : positive := txt 'low;
    variable j : positive := txt 'low;
  begin
  begin
 
    if active then
    s.set(txt );
    s.set(txt );
 
    end if;
 
  end procedure printv;
 
 
 
  procedure printv(
 
    variable s                  : inout pltbutils_p_string_t;
 
    constant txt                : in    string
 
  ) is
 
  begin
 
    printv(true, s, txt);
  end procedure printv;
  end procedure printv;
 
 
  -- Print to info element in pltbutils_sc, which shows up in waveform window
  -- Print to info element in pltbutils_sc, which shows up in waveform window
  procedure print(
  procedure print(
 
    constant active             : in    boolean;
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    constant txt                : in    string
    constant txt                : in    string
  ) is
  ) is
    variable j : positive := txt 'low;
    variable j : positive := txt 'low;
  begin
  begin
 
    if active then
    printv(v_pltbutils_info, txt );
    printv(v_pltbutils_info, txt );
    pltbutils_sc_update(pltbutils_sc);
    pltbutils_sc_update(pltbutils_sc);
 
    end if;
 
  end procedure print;
 
 
 
  procedure print(
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant txt                : in    string
 
  ) is
 
  begin
 
    print(true, pltbutils_sc, txt);
  end procedure print;
  end procedure print;
 
 
  procedure print2(
  procedure print2(
 
    constant active             : in    boolean;
    signal   s                  : out   string;
    signal   s                  : out   string;
    constant txt                : in    string
    constant txt                : in    string
  ) is
  ) is
  begin
  begin
 
    if active then
    print(s, txt );
    print(s, txt );
    print(txt );
    print(txt );
 
    end if;
 
  end procedure print2;
 
 
 
  procedure print2(
 
    signal   s                  : out   string;
 
    constant txt                : in    string
 
  ) is
 
  begin
 
    print(true, s, txt);
  end procedure print2;
  end procedure print2;
 
 
  procedure print2(
  procedure print2(
 
    constant active             : in    boolean;
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    signal   pltbutils_sc       : out   pltbutils_sc_t;
    constant txt                : in    string
    constant txt                : in    string
  ) is
  ) is
  begin
  begin
    print(pltbutils_sc, txt );
    print(pltbutils_sc, txt );
    print(txt );
    print(txt );
  end procedure print2;
  end procedure print2;
 
 
 
  procedure print2(
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant txt                : in    string
 
  ) is
 
  begin
 
    print(true, pltbutils_sc, txt);
 
  end procedure print2;
 
 
  ----------------------------------------------------------------------------
  ----------------------------------------------------------------------------
  -- waitclks
  -- waitclks
  --
  --
  -- procedure waitclks(
  -- procedure waitclks(
  --   constant n                  : in    natural;
  --   constant n                  : in    natural;
Line 625... Line 828...
    variable i                  : natural := n;
    variable i                  : natural := n;
    variable v_timeout_time     : time;
    variable v_timeout_time     : time;
  begin
  begin
    v_timeout_time := now + timeout;
    v_timeout_time := now + timeout;
    while i > 0 loop
    while i > 0 loop
      if FALLING then
      if falling then
        wait until falling_edge(clk) for timeout / n;
        wait until falling_edge(clk) for timeout / n;
      else
      else
        wait until rising_edge(clk)  for timeout / n;
        wait until rising_edge(clk)  for timeout / n;
      end if;
      end if;
      i := i - 1;
      i := i - 1;
Line 643... Line 846...
      pltbutils_sc_update(pltbutils_sc);
      pltbutils_sc_update(pltbutils_sc);
    end if;
    end if;
  end procedure waitclks;
  end procedure waitclks;
 
 
  ----------------------------------------------------------------------------
  ----------------------------------------------------------------------------
 
  -- waitsig
 
  --
 
  -- procedure waitsig(
 
  --   signal   s                  : in    integer|std_logic|std_logic_vector|unsigned|signed;
 
  --   constant value              : in    integer|std_logic|std_logic_vector|unsigned|signed;
 
  --   signal   clk                : in    std_logic;
 
  --   signal   pltbutils_sc       : out   pltbutils_sc_t;
 
  --   constant falling            : in    boolean := false;
 
  --   constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  -- )
 
  --
 
  -- Waits until a signal has reached a specified value after specified clock
 
  -- edge.
 
  --
 
  -- Arguments: 
 
  --   s                        The signal to test.
 
  --                            Supported types: integer, std_logic, 
 
  --                            std_logic_vector, unsigned, signed.
 
  --
 
  --   value                    Value to wait for.
 
  --                            Same type as data or integer.
 
  --
 
  --   clk                      The clock.
 
  --
 
  --   pltbutils_sc             PlTbUtils' global status- and control signal.
 
  --                            Must be set to pltbutils_sc.
 
  --
 
  --   falling                  If true, waits for falling edges, otherwise
 
  --                            rising edges. Optional, default is false.
 
  --
 
  --   timeout                  Timeout time, in case the clock is not working.
 
  --                            Optional, default is C_PLTBUTILS_TIMEOUT.  
 
  --
 
  -- Examples:
 
  -- waitsig(wr_en, '1', sys_clk, pltbutils_sc);
 
  -- waitsig(rd_en,   1, sys_clk, pltbutils_sc, true);
 
  -- waitclks(full, '1', sys_clk, pltbutils_sc, true, 1 ms);
 
  ---------------------------------------------------------------------------- 
 
  procedure waitsig(
 
    signal   s                  : in    integer;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_timeout_time     : time;
 
  begin
 
    v_timeout_time := now + timeout;
 
    l1 : loop
 
      waitclks(1, clk, pltbutils_sc, falling, timeout);
 
      exit l1 when s = value or now >= v_timeout_time;
 
    end loop;
 
    if now >= v_timeout_time then
 
      assert false
 
      report "waitsig() timeout"
 
      severity error;
 
      v_pltbutils_err_cnt.inc; -- VHDL-2002
 
      --v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
 
      pltbutils_sc_update(pltbutils_sc);
 
    end if;
 
  end procedure waitsig;
 
 
 
  procedure waitsig(
 
    signal   s                  : in    std_logic;
 
    constant value              : in    std_logic;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_timeout_time     : time;
 
  begin
 
    v_timeout_time := now + timeout;
 
    l1 : loop
 
      waitclks(1, clk, pltbutils_sc, falling, timeout);
 
      exit l1 when s = value or now >= v_timeout_time;
 
    end loop;
 
    if now >= v_timeout_time then
 
      assert false
 
      report "waitsig() timeout"
 
      severity error;
 
      v_pltbutils_err_cnt.inc; -- VHDL-2002
 
      --v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
 
      pltbutils_sc_update(pltbutils_sc);
 
    end if;
 
  end procedure waitsig;
 
 
 
  procedure waitsig(
 
    signal   s                  : in    std_logic;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_value            : std_logic;
 
    variable v_timeout_time     : time;
 
  begin
 
    case value is
 
      when 0      => v_value := '0';
 
      when 1      => v_value := '1';
 
      when others => v_value := 'X';
 
    end case;
 
    if v_value /= 'X' then
 
      waitsig(s, v_value, clk,
 
              pltbutils_sc, falling, timeout);
 
    else
 
      assert false
 
        report "waitsig() illegal value to wait for: " & integer'image(value)
 
        severity error;
 
      v_pltbutils_err_cnt.inc; -- VHDL-2002
 
      --v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
 
      pltbutils_sc_update(pltbutils_sc);
 
    end if;
 
  end procedure waitsig;
 
 
 
  procedure waitsig(
 
    signal   s                  : in    std_logic_vector;
 
    constant value              : in    std_logic_vector;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_timeout_time     : time;
 
  begin
 
    v_timeout_time := now + timeout;
 
    l1 : loop
 
      waitclks(1, clk, pltbutils_sc, falling, timeout);
 
      exit l1 when s = value or now >= v_timeout_time;
 
    end loop;
 
    if now >= v_timeout_time then
 
      assert false
 
      report "waitsig() timeout"
 
      severity error;
 
      v_pltbutils_err_cnt.inc; -- VHDL-2002
 
      --v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
 
      pltbutils_sc_update(pltbutils_sc);
 
    end if;
 
  end procedure waitsig;
 
 
 
  procedure waitsig(
 
    signal   s                  : in    std_logic_vector;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_timeout_time     : time;
 
  begin
 
    waitsig(s, std_logic_vector(to_unsigned(value, s'length)), clk,
 
            pltbutils_sc, falling, timeout);
 
  end procedure waitsig;
 
 
 
  procedure waitsig(
 
    signal   s                  : in    unsigned;
 
    constant value              : in    unsigned;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_timeout_time     : time;
 
  begin
 
    v_timeout_time := now + timeout;
 
    l1 : loop
 
      waitclks(1, clk, pltbutils_sc, falling, timeout);
 
      exit l1 when s = value or now >= v_timeout_time;
 
    end loop;
 
    if now >= v_timeout_time then
 
      assert false
 
      report "waitsig() timeout"
 
      severity error;
 
      v_pltbutils_err_cnt.inc; -- VHDL-2002
 
      --v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
 
      pltbutils_sc_update(pltbutils_sc);
 
    end if;
 
  end procedure waitsig;
 
 
 
  procedure waitsig(
 
    signal   s                  : in    unsigned;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_timeout_time     : time;
 
  begin
 
    waitsig(s, to_unsigned(value, s'length), clk,
 
            pltbutils_sc, falling, timeout);
 
  end procedure waitsig;
 
 
 
  procedure waitsig(
 
    signal   s                  : in    signed;
 
    constant value              : in    signed;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_timeout_time     : time;
 
  begin
 
    v_timeout_time := now + timeout;
 
    l1 : loop
 
      waitclks(1, clk, pltbutils_sc, falling, timeout);
 
      exit l1 when s = value or now >= v_timeout_time;
 
    end loop;
 
    if now >= v_timeout_time then
 
      assert false
 
      report "waitsig() timeout"
 
      severity error;
 
      v_pltbutils_err_cnt.inc; -- VHDL-2002
 
      --v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
 
      pltbutils_sc_update(pltbutils_sc);
 
    end if;
 
  end procedure waitsig;
 
 
 
  procedure waitsig(
 
    signal   s                  : in    signed;
 
    constant value              : in    integer;
 
    signal   clk                : in    std_logic;
 
    signal   pltbutils_sc       : out   pltbutils_sc_t;
 
    constant falling            : in    boolean := false;
 
    constant timeout            : in    time    := C_PLTBUTILS_TIMEOUT
 
  ) is
 
    variable v_timeout_time     : time;
 
  begin
 
    waitsig(s, to_signed(value, s'length), clk,
 
            pltbutils_sc, falling, timeout);
 
  end procedure waitsig;
 
 
 
  ----------------------------------------------------------------------------
  -- check
  -- check
  --
  --
  -- procedure check(
  -- procedure check(
  --  constant rpt              : in    string;
  --  constant rpt              : in    string;
  --  constant data             : in    integer|std_logic|std_logic_vector|unsigned|signed;
  --  constant data             : in    integer|std_logic|std_logic_vector|unsigned|signed;

powered by: WebSVN 2.1.0

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