Changing string

<snip>


if image_cnt=0 then
ReadFile("image0.bmp");
elsif image_cnt=1 then
ReadFile("image1.bmp");
...
elsif image_cnt=127 then
ReadFile("image127.bmp");
end if;
end if;
end if;
end process;

How can I include the "image_cnt" value
into the string of the image name in an elegant way ?


ReadFile("image" & integer'image(image_cnt) & ".bmp");

Kevin Jennings
 
<snip>
               if image_cnt=0 then
                  ReadFile("image0.bmp");
              elsif image_cnt=1 then
                  ReadFile("image1.bmp");
              ...
              elsif image_cnt=127 then
                  ReadFile("image127.bmp");
              end if;
         end if;
   end if;
end process;

How can I include the "image_cnt" value
into the string of the image name in an elegant way ?
ReadFile("image" & integer'image(127) & ".bmp");

Kevin Jennings
 
Mike Treseler wrote:

I would read the file into a testbench
variable or constant array
at initialization time.
Sorry, I missed the point that
there are more than one file.
See the other postings.

-- Mike Treseler
 
ALuPin@web.de wrote:

How can I include the "image_cnt" value
into the string of the image name in an elegant way ?
I would read the file into a testbench
variable or constant array
at initialization time.

See the testbench and binary file here:
http://home.comcast.net/~mike_treseler/
for related examples.

-- Mike Treseler
 
On Fri, 11 Jan 2008 08:55:04 -0800 (PST),
"ALuPin@web.de" <ALuPin@web.de> wrote:


How can I include the "image_cnt" value
[an integer]

into the string of the image name in an elegant way ?
ReadFile("image" & integer'image(image_cnt) & ".bmp");

Or, much better:

ReadFile(MakeFilenameFromInteger(image_cnt));

And now you can write a function MakeFilenameFromInteger
that perhaps does exactly what I first suggested:

function MakeFilenameFromInteger(n: integer)
return string
is
begin
return "image" & integer'image(n) & ".bmp";
end;

or, perhaps, does something cleverer.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
A

ALuPin@web.de

Guest
Hi newsgroup,

I have a function which is called by

ReadFile("image.bmp")


At certain events I want to call that function in the following
manner:

signal image_cnt : integer range 0 to 127;

process(Clk)
begin
if rising_edge(Clk) then

if load_image='1' then
if image_cnt=127 then
image_cnt <= 0;
else
image_cnt <= image_cnt + 1;
end if;

if image_cnt=0 then
ReadFile("image0.bmp");
elsif image_cnt=1 then
ReadFile("image1.bmp");
...
elsif image_cnt=127 then
ReadFile("image127.bmp");
end if;
end if;
end if;
end process;

How can I include the "image_cnt" value
into the string of the image name in an elegant way ?

Thank you for your help.

Rgds
Andre
 
Hi KJ, Jonathan Bromley, Mike Treseler,

thank you for your proposals.

Rgds
Andre
 

Welcome to EDABoard.com

Sponsor

Back
Top