FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-16-2006, 01:06 PM
Guest
 
Posts: n/a
Default Changing files

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
  #2 (permalink)  
Old 11-16-2006, 06:37 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Changing files

[email protected] 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
  #3 (permalink)  
Old 11-17-2006, 08:54 AM
Guest
 
Posts: n/a
Default Re: Changing files

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
  #4 (permalink)  
Old 11-17-2006, 05:11 PM
Jim Lewis
Guest
 
Posts: n/a
Default Re: Changing files

[email protected] 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 mailto:[email protected]
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Reply With Quote
  #5 (permalink)  
Old 11-17-2006, 05:47 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Changing files

[email protected] 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
  #6 (permalink)  
Old 11-20-2006, 08:43 AM
Guest
 
Posts: n/a
Default Re: Changing files

Hi,

your help is appreciated.

Thank you for your helpful suggestions.

Rgds
André

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Schematic Files (.sch) to Verilog Files (.v) for simulation in ModelSim [email protected] FPGA 11 07-14-2007 12:33 PM
JTAG programming: JAM files versus ISC (IEEE1532) files [email protected] FPGA 4 06-17-2005 01:02 AM
Changing directory name in Quartus ALuPin FPGA 3 07-22-2004 04:48 PM
Changing directory name in Quartus ALuPin VHDL 0 07-21-2004 09:29 AM
changing values in a fifo Patrick Klacka FPGA 13 01-26-2004 09:16 PM


All times are GMT +1. The time now is 04:23 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved