Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Then you really don't have an array after all, so it's not clear what you really have as the starting point. It sounds like you have a bunch of strings but not collected into anything at present.I have an array of string.
each element ( each word ) is of different length - and this is illegal.
It's not clear what exactly you're trying to accomplishI wanted to make all array elements to be of the same length.
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 function str_pad(s : string; pad_char : character; len : integer) return string is variable ret : string(1 to len) begin assert len >= s'length report "Specified length must be longer than the specified string" severity failure; for i in 1 to s'high loop ret(i) := s(i); end loop; for i in s'high+1 to len loop ret(i) := pad_char; end loop; return ret; end function str_pad;
Code VHDL - [expand] 1 2 3 4 5 6 type my_line_array_t is array(natural range <>) of line; variable my_line_array : my_line_array_t(0 to 1); --must be a variable, as line is an access type .... my_line_array(0) := new string'("Hello everyone, Im some random string!"); my_line_array(1) := new string'("Go home Trickydicky, you're drunk");
Code VHDL - [expand] 1 2 DEALLOCATE(my_line_array(0)); DEALLOCATE(my_line_array(1));
generic
(
config_1: string := "ram" ;
config_2: string := "synchronous" ;
config_3: string := "non_ecc" ;
)
type array_string is array ( natural range <> ) of string ;
generic
(
conigurations : array_string := ( "ram" , "synchronous" , "non_ecc" )
)
conigurations : array_string := ( "ram " , "synchronous" , "non_ecc " )