O
Olaf
Hi,
after some hours I found an error in my testbench, since I forgot the
bondaries of use (I wrote it some time ago). Here the origin function:
function str2sulv(vec : in string) return std_ulogic_vector is
variable temp : std_ulogic_vector(vec'range) := (others => 'X');
begin
for i in vec'range loop
if (vec(i) = '1') then
temp(i) := '1';
elsif (vec(i) = '0') then
temp(i) := '0';
end if;
end loop;
return temp;
end function;
I called this with vec = "1111111_000000" - the underline was the
problem. No I would like to write it using an argument more: the range
to avoid such problem for the future. How can I add it?
function str2sulv(
vec : in string;
rg : in ???????)
return std_ulogic_vector is
variable temp : std_ulogic_vector(rg) := (others => 'X');
which I want to call like:
data <= str2sulv("1111111_0000000", data'range);
Thanks
Olaf
after some hours I found an error in my testbench, since I forgot the
bondaries of use (I wrote it some time ago). Here the origin function:
function str2sulv(vec : in string) return std_ulogic_vector is
variable temp : std_ulogic_vector(vec'range) := (others => 'X');
begin
for i in vec'range loop
if (vec(i) = '1') then
temp(i) := '1';
elsif (vec(i) = '0') then
temp(i) := '0';
end if;
end loop;
return temp;
end function;
I called this with vec = "1111111_000000" - the underline was the
problem. No I would like to write it using an argument more: the range
to avoid such problem for the future. How can I add it?
function str2sulv(
vec : in string;
rg : in ???????)
return std_ulogic_vector is
variable temp : std_ulogic_vector(rg) := (others => 'X');
which I want to call like:
data <= str2sulv("1111111_0000000", data'range);
Thanks
Olaf