Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Changing files

Reply
Thread Tools

Changing files

 
 
ALuPin@web.de
Guest
Posts: n/a
 
      11-16-2006
Hi,

in the following process I write some data into a file:

WRITEFILE: PROCESS(clk)
FILE G: TEXT;
VARIABLE L: LINE;
VARIABLE P3 : string(1 TO 2) := "P3";
VARIABLE homepage : string(1 TO 32):= "# Test";
VARIABLE four : string(1 TO 3) := "4 4";
VARIABLE space : string(1 TO 1) := " ";
BEGIN
IF falling_edge(clk) THEN
IF rst_cnt=0 THEN
FILE_OPEN(G, "test4x4readback.ppm", WRITE_MODE);

WRITE(L, P3);
WRITELINE(G, L);
WRITE(L, homepage);
WRITELINE(G, L);
WRITE(L, four);
WRITELINE(G, L);
WRITE(L, 255);
--WRITELINE(G, L);
rst_cnt <= 1;
ELSE

IF ls_wr='1' THEN
row_cnt <= row_cnt + 3;

IF row_cnt MOD 24 = 0 OR row_cnt=0 THEN
WRITELINE(G, L);
END IF;

WRITE(L, red); WRITE(L, space);
WRITE(L, green); WRITE(L, space);
WRITE(L, blue); WRITE(L, space);

END IF;

END IF;
END IF;
END PROCESS WRITEFILE;

Now I want to close the corresponding file when some trigger occurs, at
the same
time I want to create a new file and begin to write to it.
for example :

#1 trigger
If trigger='1' THEN
close (file1);
open(file2);
end if;

#2 trigger
if trigger='1' THEN
close(file2);
open(file3);
end if;
....

How can I do that ? Do I have to declare the number of files I want to
write to and
how do I handle them?


Thank you for your opinion.

Rgds
André

 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      11-16-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> How can I do that ? Do I have to declare the number of files I want to
> write to and
> how do I handle them?


I would

1. Package constant arrays of records
for static input.

2. Declare variable arrays of records
to collect variable report data.

3. Write a procedure to format the report
after the test is done.

-- Mike Treseler
 
Reply With Quote
 
 
 
 
ALuPin@web.de
Guest
Posts: n/a
 
      11-17-2006
Hi Mike,

thank you for your response.
Do you have some example on your homepage ?

I have some doubts concerning your differentiation
between constant and variable arrays of records
for this application.

So does that mean that the variable arrays stand for
the definition of the different files (which contain
image data in ppm format) ?

Rgds
André

>
> I would
>
> 1. Package constant arrays of records
> for static input.
>
> 2. Declare variable arrays of records
> to collect variable report data.
>
> 3. Write a procedure to format the report
> after the test is done.
>
> -- Mike Treseler


 
Reply With Quote
 
Jim Lewis
Guest
Posts: n/a
 
      11-17-2006
(E-Mail Removed) wrote:

> #1 trigger
> If trigger='1' THEN
> close (file1);
> open(file2);
> end if;
>
> #2 trigger
> if trigger='1' THEN
> close(file2);
> open(file3);
> end if;
> ...
>
> How can I do that ? Do I have to declare the number of files I want to
> write to and
> how do I handle them?


You open and close based on the file handle, G in your
example above. If you have closed the file handle you
should be able to re-open it with a different file name.

file_close (G);
FILE_OPEN(G, "new_file.ppm", WRITE_MODE);

Note that the file name is a string expression.

Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training (E-Mail Removed)
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      11-17-2006
(E-Mail Removed) wrote:

> thank you for your response.
> Do you have some example on your homepage ?


I'm not sure. It is in need of a new index.
Look through these if you like:
http://groups.google.com/groups/sear...t+vhd+treseler

> I have some doubts concerning your differentiation
> between constant and variable arrays of records
> for this application.


Stim data that doesn't change can be collected
in a vhdl constant structure. This is the
simplest case.

> So does that mean that the variable arrays stand for
> the definition of the different files (which contain
> image data in ppm format) ?


No. See Jim's reply for an answer to your file question.
I am not a fan of using files other than
vhdl packages for verification.

-- Mike Treseler
 
Reply With Quote
 
ALuPin@web.de
Guest
Posts: n/a
 
      11-20-2006
Hi,

your help is appreciated.

Thank you for your helpful suggestions.

Rgds
André

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing style of the numbers in a CSS <ol> without changing the style of the <li> Aaron Beall HTML 2 09-14-2007 08:07 PM
<FAQENTRY>I'm changing my page but nothing is changing on the screen. Why?</FAQENTRY> VK Javascript 3 03-15-2007 04:59 PM
how i can extract text from the PDF files,power point files,Ms word files? crazyprakash Java 4 10-30-2005 10:17 AM
changing file extension without changing filename jamy Computer Support 4 03-04-2005 01:03 AM
Difficulty in changing the Connection Server control path changing ... Samridhi Kumar Shukla ASP .Net 1 11-30-2003 02:31 AM



Advertisments