URL
https://opencores.org/ocsvn/pltbutils/pltbutils/trunk
Subversion Repositories pltbutils
Compare Revisions
- This comparison shows the changes necessary to convert path
/pltbutils/branches/dev_beta0002/src/vhdl
- from Rev 95 to Rev 96
- ↔ Reverse comparison
Rev 95 → Rev 96
/pltbutils_comp.vhd
17,7 → 17,7
---- - ---- |
---- ---- |
---- Author(s): ---- |
---- - Per Larsson, pela@opencores.org ---- |
---- - Per Larsson, pela.opencores@gmail.com ---- |
---- ---- |
---------------------------------------------------------------------- |
---- ---- |
/pltbutils_user_cfg_pkg.vhd
23,7 → 23,7
---- - ---- |
---- ---- |
---- Author(s): ---- |
---- - Per Larsson, pela@opencores.org ---- |
---- - Per Larsson, pela.opencores@gmail.com ---- |
---- ---- |
---------------------------------------------------------------------- |
---- ---- |
/pltbutils_comp_pkg.vhd
20,7 → 20,7
---- - ---- |
---- ---- |
---- Author(s): ---- |
---- - Per Larsson, pela@opencores.org ---- |
---- - Per Larsson, pela.opencores@gmail.com ---- |
---- ---- |
---------------------------------------------------------------------- |
---- ---- |
/pltbutils_func_pkg.vhd
17,7 → 17,7
---- - ---- |
---- ---- |
---- Author(s): ---- |
---- - Per Larsson, pela@opencores.org ---- |
---- - Per Larsson, pela.opencores@gmail.com ---- |
---- ---- |
---------------------------------------------------------------------- |
---- ---- |
125,7 → 125,7
variable pltbv : inout pltbv_t; |
signal pltbs : out pltbs_t; |
constant show_success_fail : in boolean := false; |
constant force : in boolean := false |
constant force_stop : in boolean := false |
); |
|
-- starttest |
290,6 → 290,13
constant falling : in boolean := false; |
constant timeout : in time := C_PLTBUTILS_TIMEOUT |
); |
procedure waitsig( |
signal s : in std_logic; |
constant value : in std_logic; |
variable pltbv : inout pltbv_t; |
signal pltbs : out pltbs_t; |
constant timeout : in time := C_PLTBUTILS_TIMEOUT |
); |
|
-- check |
procedure check( |
564,7 → 571,7
-- variable pltbv : inout pltbv_t; |
-- signal pltbs : out pltbs_t; |
-- constant show_success_fail : in boolean := false; |
-- constant force : in boolean := false |
-- constant force_stop : in boolean := false |
-- ) |
-- |
-- Displays a message at end of simulation message, presents the simulation |
579,7 → 586,7
-- "*** FAIL ***", or "*** NO CHECKS ***". |
-- Optional, default is false. |
-- |
-- force If true, forces the simulation to stop using an |
-- force_stop If true, forces the simulation to stop using an |
-- assert failure statement. Use this option only |
-- if the normal way of stopping the simulation |
-- doesn't work (see below). |
587,8 → 594,8
-- |
-- The testbench should be designed so that all clocks stop when endsim() |
-- sets the signal pltbs.stop_sim to '1'. This should stop the simulator. |
-- In some cases that doesn't work, then set the force argument to true, which |
-- causes a false assert failure, which should stop the simulator. |
-- In some cases that doesn't work, then set the force_stop argument to true, |
-- which causes a false assert failure, which should stop the simulator. |
-- Scripts searching transcript logs for errors and failures, should ignore |
-- the failure with "--- FORCE END OF SIMULATION ---" as part of the report. |
-- |
612,7 → 619,7
variable pltbv : inout pltbv_t; |
signal pltbs : out pltbs_t; |
constant show_success_fail : in boolean := false; |
constant force : in boolean := false |
constant force_stop : in boolean := false |
) is |
variable timestamp : time; |
begin |
631,7 → 638,7
pltbv.stop_sim := '1'; |
pltbs_update(pltbv, pltbs); |
wait for C_WAIT_BEFORE_STOP_TIME; |
if force then |
if force_stop then |
if C_PLTBUTILS_USE_STD_STOPSIM then |
stopsim(now); |
end if; |
938,7 → 945,7
constant txt : in string |
) is |
begin |
print(true, s, txt); |
print2(true, s, txt); |
end procedure print2; |
|
procedure print2( |
958,7 → 965,7
constant txt : in string |
) is |
begin |
print(true, pltbv, pltbs, txt); |
print2(true, pltbv, pltbs, txt); |
end procedure print2; |
|
---------------------------------------------------------------------------- |
1061,6 → 1068,7
-- waitsig(rd_en, 1, sys_clk, pltbv, pltbs, true); |
-- waitclks(full, '1', sys_clk, pltbv, pltbs, true, 1 ms); |
---------------------------------------------------------------------------- |
-- waitsig integer, clocked |
procedure waitsig( |
signal s : in integer; |
constant value : in integer; |
1082,6 → 1090,7
end if; |
end procedure waitsig; |
|
-- waitsig std_logic, clocked |
procedure waitsig( |
signal s : in std_logic; |
constant value : in std_logic; |
1103,6 → 1112,7
end if; |
end procedure waitsig; |
|
-- waitsig std_logic against integer, clocked |
procedure waitsig( |
signal s : in std_logic; |
constant value : in integer; |
1127,6 → 1137,7
end if; |
end procedure waitsig; |
|
-- waitsig std_logic_vector, clocked |
procedure waitsig( |
signal s : in std_logic_vector; |
constant value : in std_logic_vector; |
1148,6 → 1159,7
end if; |
end procedure waitsig; |
|
-- waitsig std_logic_vector against integer, clocked |
procedure waitsig( |
signal s : in std_logic_vector; |
constant value : in integer; |
1163,6 → 1175,7
pltbv, pltbs, falling, timeout); |
end procedure waitsig; |
|
-- waitsig unsigned, clocked |
procedure waitsig( |
signal s : in unsigned; |
constant value : in unsigned; |
1184,6 → 1197,7
end if; |
end procedure waitsig; |
|
-- waitsig unsigned against integer, clocked |
procedure waitsig( |
signal s : in unsigned; |
constant value : in integer; |
1199,6 → 1213,7
pltbv, pltbs, falling, timeout); |
end procedure waitsig; |
|
-- waitsig signed, clocked |
procedure waitsig( |
signal s : in signed; |
constant value : in signed; |
1220,6 → 1235,7
end if; |
end procedure waitsig; |
|
-- waitsig signed against integer, clocked |
procedure waitsig( |
signal s : in signed; |
constant value : in integer; |
1235,6 → 1251,23
pltbv, pltbs, falling, timeout); |
end procedure waitsig; |
|
-- waitsig std_logic, unclocked |
procedure waitsig( |
signal s : in std_logic; |
constant value : in std_logic; |
variable pltbv : inout pltbv_t; |
signal pltbs : out pltbs_t; |
constant timeout : in time := C_PLTBUTILS_TIMEOUT |
) is |
begin |
if s /= value then |
wait until s = value for timeout; |
if s /= value then |
pltbutils_error("waitsig() timeout", pltbv, pltbs); |
end if; |
end if; |
end procedure waitsig; |
|
---------------------------------------------------------------------------- |
-- check |
-- |
1520,8 → 1553,19
-- constant s : signed |
-- ) return signed; |
-- |
-- Converts a signal or variable to ascending range ("to-range"). |
-- Converts a vector to ascending range ("to-range"). |
-- The argument s can have ascending or descending range. |
-- E.g. an argument defined as a std_logic_vector(3 downto 1) |
-- will be returned as a std_logic_vector(1 to 3). |
-- |
-- Arguments: |
-- s Constant, signal or variable to convert |
-- |
-- Return value: Converted value |
-- |
-- Examples: |
-- ascending_sig <= to_ascending(descending_sig); |
-- ascending_var := to_ascending(descending_var); |
---------------------------------------------------------------------------- |
function to_ascending( |
constant s : std_logic_vector |
1571,8 → 1615,19
-- constant s : signed |
-- ) return signed; |
-- |
-- Converts a signal or variable to descending range ("downto-range"). |
-- Converts a vector to descending range ("downto-range"). |
-- The argument s can have ascending or descending range. |
-- E.g. an argument defined as a std_logic_vector(1 to 3) |
-- will be returned as a std_logic_vector(3 downto 1). |
-- |
-- Arguments: |
-- s Constant, signal or variable to convert |
-- |
-- Return value: Converted value |
-- |
-- Examples: |
-- descending_sig <= to_descending(ascending_sig); |
-- descending_var := to_descending(ascending_var); |
---------------------------------------------------------------------------- |
function to_descending( |
constant s : std_logic_vector |
1627,18 → 1682,21
-- constant postfix : string := "" |
-- ) return string; |
-- |
-- Converts a signal to a string in hexadecimal format. |
-- An optional prefix can be specified, e.g. "0x". |
-- Converts a vector to a string in hexadecimal format. |
-- An optional prefix can be specified, e.g. "0x", as well as a suffix. |
-- |
-- The signal can have ascending range ( "to-range" ) or descending range |
-- ("downto-range"). |
-- The input argument can have ascending range ( "to-range" ) or descending range |
-- ("downto-range"). There is no vector length limitation. |
-- |
-- hxstr is a wrapper function for hstr in txt_util. |
-- hstr only support std_logic_vector with descending range. |
-- Arguments: |
-- s Constant, signal or variable to convert |
-- |
-- Return value: Converted value |
-- |
-- Examples: |
-- print("value=" & hxstr(s)); |
-- print("value=" & hxstr(s, "0x")); |
-- print("value=" & hxstr(s, "16#", "#")); |
---------------------------------------------------------------------------- |
function hxstr( |
constant s : std_logic_vector; |
1645,8 → 1703,42
constant prefix : string := ""; |
constant postfix : string := "" |
) return string is |
variable hexstr : string(1 to (s'length+3)/4); |
variable nibble_aligned_s : std_logic_vector(((s'length+3)/4)*4-1 downto 0) := (others => '0'); |
variable nibble : std_logic_vector(3 downto 0); |
begin |
return prefix & hstr(to_descending(s)) & postfix; |
nibble_aligned_s(s'length-1 downto 0) := to_descending(s); |
for i in 0 to nibble_aligned_s'high/4 loop |
nibble := nibble_aligned_s(4*i + 3 downto 4*i); |
case nibble is |
when "0000" => hexstr(hexstr'high-i) := '0'; |
when "0001" => hexstr(hexstr'high-i) := '1'; |
when "0010" => hexstr(hexstr'high-i) := '2'; |
when "0011" => hexstr(hexstr'high-i) := '3'; |
when "0100" => hexstr(hexstr'high-i) := '4'; |
when "0101" => hexstr(hexstr'high-i) := '5'; |
when "0110" => hexstr(hexstr'high-i) := '6'; |
when "0111" => hexstr(hexstr'high-i) := '7'; |
when "1000" => hexstr(hexstr'high-i) := '8'; |
when "1001" => hexstr(hexstr'high-i) := '9'; |
when "1010" => hexstr(hexstr'high-i) := 'A'; |
when "1011" => hexstr(hexstr'high-i) := 'B'; |
when "1100" => hexstr(hexstr'high-i) := 'C'; |
when "1101" => hexstr(hexstr'high-i) := 'D'; |
when "1110" => hexstr(hexstr'high-i) := 'E'; |
when "1111" => hexstr(hexstr'high-i) := 'F'; |
when "UUUU" => hexstr(hexstr'high-i) := 'U'; |
when "XXXX" => hexstr(hexstr'high-i) := 'X'; |
when "ZZZZ" => hexstr(hexstr'high-i) := 'Z'; |
when "WWWW" => hexstr(hexstr'high-i) := 'W'; |
when "LLLL" => hexstr(hexstr'high-i) := 'L'; |
when "HHHH" => hexstr(hexstr'high-i) := 'H'; |
when "----" => hexstr(hexstr'high-i) := '-'; |
when others => hexstr(hexstr'high-i) := '?'; |
-- TODO: handle vectors where nibble_aligned_s'length > a'length and the highest nibble are all equal characters such as "XXX" |
end case; |
end loop; |
return prefix & hexstr & postfix; |
end function hxstr; |
|
function hxstr( |
1655,7 → 1747,7
constant postfix : string := "" |
) return string is |
begin |
return prefix & hstr(to_descending(std_logic_vector(s))) & postfix; |
return hxstr(std_logic_vector(s), prefix, postfix); |
end function hxstr; |
|
function hxstr( |
1664,13 → 1756,13
constant postfix : string := "" |
) return string is |
begin |
return prefix & hstr(to_descending(std_logic_vector(s))) & postfix; |
return hxstr(std_logic_vector(s), prefix, postfix); |
end function hxstr; |
|
---------------------------------------------------------------------------- |
-- pltbutils internal procedure(s), called from other pltbutils procedures. |
-- Do not to call this/these from user's code. |
-- This/these procedures are undocumented in the specification on purpose. |
-- pltbutils internal procedures, called from other pltbutils procedures. |
-- Do not to call these from user's code. |
-- These procedures are undocumented in the specification on purpose. |
---------------------------------------------------------------------------- |
procedure pltbs_update( |
variable pltbv : inout pltbv_t; |