Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
VHDL
function with given range attribute as argument
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Olaf, post: 2886446"] 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 [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
VHDL
function with given range attribute as argument
Top