URL
https://opencores.org/ocsvn/lxp32/lxp32/trunk
[/] [lxp32/] [trunk/] [verify/] [common_pkg/] [common_pkg_body.vhd] - Diff between revs 6 and 9
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 6 |
Rev 9 |
Line 24... |
Line 24... |
function hex_string(x: std_logic_vector) return string is
|
function hex_string(x: std_logic_vector) return string is
|
variable xx: std_logic_vector(x'length-1 downto 0);
|
variable xx: std_logic_vector(x'length-1 downto 0);
|
variable i: integer:=0;
|
variable i: integer:=0;
|
variable ii: integer;
|
variable ii: integer;
|
variable c: integer;
|
variable c: integer;
|
|
variable high_index: integer;
|
variable s: string(x'length downto 1);
|
variable s: string(x'length downto 1);
|
begin
|
begin
|
xx:=x;
|
xx:=x;
|
loop
|
loop
|
ii:=i*4;
|
ii:=i*4;
|
exit when ii>xx'high;
|
exit when ii>xx'high;
|
if ii+3<=xx'high then
|
if ii+3<=xx'high then
|
c:=to_integer(unsigned(xx(ii+3 downto ii)));
|
high_index:=ii+3;
|
else
|
else
|
c:=to_integer(unsigned(xx(xx'high downto ii)));
|
high_index:=xx'high;
|
|
end if;
|
|
|
|
if is_x(xx(high_index downto ii)) then
|
|
c:=-1;
|
|
else
|
|
c:=to_integer(unsigned(xx(high_index downto ii)));
|
end if;
|
end if;
|
|
|
case c is
|
case c is
|
when 0 => s(i+1):='0';
|
when 0 => s(i+1):='0';
|
when 1 => s(i+1):='1';
|
when 1 => s(i+1):='1';
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.