Line 324... |
Line 324... |
constant rpt : in string;
|
constant rpt : in string;
|
constant expr : in boolean;
|
constant expr : in boolean;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
|
|
|
-- to_ascending
|
|
function to_ascending(
|
|
constant s : std_logic_vector
|
|
) return std_logic_vector;
|
|
function to_ascending(
|
|
constant s : unsigned
|
|
) return unsigned;
|
|
function to_ascending(
|
|
constant s : signed
|
|
) return signed;
|
|
|
|
-- to_descending
|
|
function to_descending(
|
|
constant s : std_logic_vector
|
|
) return std_logic_vector;
|
|
function to_descending(
|
|
constant s : unsigned
|
|
) return unsigned;
|
|
function to_descending(
|
|
constant s : signed
|
|
) return signed;
|
|
|
|
-- hxstr
|
|
function hxstr(
|
|
constant s : std_logic_vector;
|
|
constant prefix : string := ""
|
|
) return string;
|
|
function hxstr(
|
|
constant s : unsigned;
|
|
constant prefix : string := ""
|
|
) return string;
|
|
function hxstr(
|
|
constant s : signed;
|
|
constant prefix : string := ""
|
|
) return string;
|
|
|
-- pltbutils internal procedure(s), do not call from user's code
|
-- pltbutils internal procedure(s), do not call from user's code
|
procedure pltbutils_sc_update(
|
procedure pltbutils_sc_update(
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
|
|
Line 537... |
Line 573... |
else
|
else
|
v_pltbutils_test_num.set(num);
|
v_pltbutils_test_num.set(num);
|
end if;
|
end if;
|
v_pltbutils_test_name.set(name);
|
v_pltbutils_test_name.set(name);
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
print("Test " & str(v_pltbutils_test_num.value) & ": " & name);
|
print(lf & "Test " & str(v_pltbutils_test_num.value) & ": " & name);
|
-- VHDL-1993:
|
-- VHDL-1993:
|
--if num = -1 then
|
--if num = -1 then
|
-- b_pltbutils_test_num := v_pltbutils_test_num + 1;
|
-- b_pltbutils_test_num := v_pltbutils_test_num + 1;
|
--else
|
--else
|
-- v_pltbutils_test_num := num;
|
-- v_pltbutils_test_num := num;
|
Line 1260... |
Line 1296... |
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(data) &
|
"; Data=" & hxstr(data, "0x") &
|
" Expected=" & str(expected) &
|
" Expected=" & hxstr(expected, "0x") &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
Line 1293... |
Line 1329... |
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(data) &
|
"; Data=" & hxstr(data, "0x") &
|
" Expected=" & str(expected) &
|
" Expected=" & hxstr(expected, "0x") &
|
" Mask=" & str(mask) &
|
" Mask=" & hxstr(mask, "0x") &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
Line 1349... |
Line 1385... |
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(std_logic_vector(data)) &
|
"; Data=" & hxstr(data, "0x") &
|
" Expected=" & str(std_logic_vector(expected)) &
|
" Expected=" & hxstr(expected, "0x") &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
Line 1392... |
Line 1428... |
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(std_logic_vector(data)) &
|
"; Data=" & hxstr(data, "0x") &
|
" Expected=" & str(std_logic_vector(expected)) &
|
" Expected=" & hxstr(expected, "0x") &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
Line 1453... |
Line 1489... |
end if;
|
end if;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
|
-- to_ascending
|
|
--
|
|
-- function to_ascending(
|
|
-- constant s : std_logic_vector
|
|
-- ) return std_logic_vector;
|
|
--
|
|
-- function to_ascending(
|
|
-- constant s : unsigned
|
|
-- ) return unsigned
|
|
--
|
|
-- function to_ascending(
|
|
-- constant s : signed
|
|
-- ) return signed;
|
|
--
|
|
-- Converts a signal to ascending range ( "to"-range ).
|
|
-- The argument s can have ascending or descending range.
|
|
----------------------------------------------------------------------------
|
|
function to_ascending(
|
|
constant s : std_logic_vector
|
|
) return std_logic_vector is
|
|
variable r : std_logic_vector(0 to s'length-1);
|
|
begin
|
|
for i in r'range loop
|
|
r(i) := s(i);
|
|
end loop;
|
|
return r;
|
|
end function to_ascending;
|
|
|
|
function to_ascending(
|
|
constant s : unsigned
|
|
) return unsigned is
|
|
variable r : unsigned(0 to s'length-1);
|
|
begin
|
|
for i in r'range loop
|
|
r(i) := s(i);
|
|
end loop;
|
|
return r;
|
|
end function to_ascending;
|
|
|
|
function to_ascending(
|
|
constant s : signed
|
|
) return signed is
|
|
variable r : signed(0 to s'length-1);
|
|
begin
|
|
for i in r'range loop
|
|
r(i) := s(i);
|
|
end loop;
|
|
return r;
|
|
end function to_ascending;
|
|
|
|
----------------------------------------------------------------------------
|
|
-- to_descending
|
|
--
|
|
-- function to_descending(
|
|
-- constant s : std_logic_vector
|
|
-- ) return std_logic_vector;
|
|
--
|
|
-- function to_descending(
|
|
-- constant s : unsigned
|
|
-- ) return unsigned
|
|
--
|
|
-- function to_descending(
|
|
-- constant s : signed
|
|
-- ) return signed;
|
|
--
|
|
-- Converts a signal to descending range ( "downto"-range ).
|
|
-- The argument s can have ascending or descending range.
|
|
----------------------------------------------------------------------------
|
|
function to_descending(
|
|
constant s : std_logic_vector
|
|
) return std_logic_vector is
|
|
variable r : std_logic_vector(s'length-1 downto 0);
|
|
begin
|
|
for i in r'range loop
|
|
r(i) := s(i);
|
|
end loop;
|
|
return r;
|
|
end function to_descending;
|
|
|
|
function to_descending(
|
|
constant s : unsigned
|
|
) return unsigned is
|
|
variable r : unsigned(s'length-1 downto 0);
|
|
begin
|
|
for i in r'range loop
|
|
r(i) := s(i);
|
|
end loop;
|
|
return r;
|
|
end function to_descending;
|
|
|
|
function to_descending(
|
|
constant s : signed
|
|
) return signed is
|
|
variable r : signed(s'length-1 downto 0);
|
|
begin
|
|
for i in r'range loop
|
|
r(i) := s(i);
|
|
end loop;
|
|
return r;
|
|
end function to_descending;
|
|
|
|
----------------------------------------------------------------------------
|
|
-- hxstr
|
|
-- function hxstr(
|
|
-- constant s : std_logic_vector;
|
|
-- constant prefix : string := ""
|
|
-- ) return string;
|
|
--
|
|
-- function hxstr(
|
|
-- constant s : unsigned;
|
|
-- constant prefix : string := ""
|
|
-- ) return string;
|
|
--
|
|
-- function hxstr(
|
|
-- constant s : signed;
|
|
-- constant prefix : string := ""
|
|
-- ) return string;
|
|
--
|
|
-- Converts a signal to a string in hexadecimal format.
|
|
-- An optional prefix can be specified, e.g. "0x".
|
|
--
|
|
-- The signal can have ascending range ( "to-range" ) or descending range
|
|
-- ("downto-range").
|
|
--
|
|
-- hxstr is a wrapper function for hstr in txt_util.
|
|
-- hstr only support std_logic_vector with descending range.
|
|
--
|
|
-- Examples:
|
|
-- print("value=" & hxstr(s));
|
|
-- print("value=" & hxstr(s, "0x"));
|
|
----------------------------------------------------------------------------
|
|
function hxstr(
|
|
constant s : std_logic_vector;
|
|
constant prefix : string := ""
|
|
) return string is
|
|
begin
|
|
return prefix & hstr(to_descending(s));
|
|
end function hxstr;
|
|
|
|
function hxstr(
|
|
constant s : unsigned;
|
|
constant prefix : string := ""
|
|
) return string is
|
|
begin
|
|
return prefix & hstr(to_descending(std_logic_vector(s)));
|
|
end function hxstr;
|
|
|
|
function hxstr(
|
|
constant s : signed;
|
|
constant prefix : string := ""
|
|
) return string is
|
|
begin
|
|
return prefix & hstr(to_descending(std_logic_vector(s)));
|
|
end function hxstr;
|
|
|
|
----------------------------------------------------------------------------
|
-- pltbutils internal procedure(s), called from other pltbutils procedures.
|
-- pltbutils internal procedure(s), called from other pltbutils procedures.
|
-- Do not to call this/these from user's code.
|
-- Do not to call this/these from user's code.
|
-- This/these procedures are undocumented in the specification on purpose.
|
-- This/these procedures are undocumented in the specification on purpose.
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
procedure pltbutils_sc_update(
|
procedure pltbutils_sc_update(
|