How to Report/Display a File Name in VHDL?...

A

A

Guest
I\'d like to open a file and then display the name of the file that I just opened. Tried the following but get a syntax Error.

FILE Fnew : Text;
FILE_OPEN(Fnew, \"wfile\", WRITE_MODE);
report \"FILE NAME = \", & Fnew; --Syntax Error

Thanks for your help.
 
On Thursday, February 10, 2022 at 1:10:50 PM UTC-5, ashokm...@gmail.com wrote:
I\'d like to open a file and then display the name of the file that I just opened. Tried the following but get a syntax Error.

FILE Fnew : Text;
FILE_OPEN(Fnew, \"wfile\", WRITE_MODE);
report \"FILE NAME = \", & Fnew; --Syntax Error

Thanks for your help.
The file name in your example is \"wfile\", not &Fnew.

So it should be
report \"FILE NAME = \" & \"wfile\";

Alternatively, define a string constant and pass that string to the file_open procedure as well as using it in the report statement.
 
On Friday, February 11, 2022 at 3:33:30 AM UTC-8, KJ wrote:
On Thursday, February 10, 2022 at 1:10:50 PM UTC-5, ashokm...@gmail.com wrote:
I\'d like to open a file and then display the name of the file that I just opened. Tried the following but get a syntax Error.

FILE Fnew : Text;
FILE_OPEN(Fnew, \"wfile\", WRITE_MODE);
report \"FILE NAME = \", & Fnew; --Syntax Error

Thanks for your help.
The file name in your example is \"wfile\", not &Fnew.

So it should be
report \"FILE NAME = \" & \"wfile\";

Alternatively, define a string constant and pass that string to the file_open procedure as well as using it in the report statement.

Thanks but I still get a syntax error with your solution. Also, defined a string constant and passed that to the file_open and report statements. Still syntax Error.
 
On Friday, February 11, 2022 at 11:44:18 AM UTC-5, ashokm...@gmail.com wrote:
On Friday, February 11, 2022 at 3:33:30 AM UTC-8, KJ wrote:
On Thursday, February 10, 2022 at 1:10:50 PM UTC-5, ashokm...@gmail.com wrote:
I\'d like to open a file and then display the name of the file that I just opened. Tried the following but get a syntax Error.

FILE Fnew : Text;
FILE_OPEN(Fnew, \"wfile\", WRITE_MODE);
report \"FILE NAME = \", & Fnew; --Syntax Error

Thanks for your help.
The file name in your example is \"wfile\", not &Fnew.

So it should be
report \"FILE NAME = \" & \"wfile\";

Alternatively, define a string constant and pass that string to the file_open procedure as well as using it in the report statement.
Thanks but I still get a syntax error with your solution. Also, defined a string constant and passed that to the file_open and report statements. Still syntax Error.

What I posted works for me: report \"FILE NAME = \" & \"wfile\";

Since you\'ve provided no actual code or what the actual error is, I\'m not going to guess. Good luck.

Kevin Jennings
 
On 2/11/22 17:44, A wrote:
On Friday, February 11, 2022 at 3:33:30 AM UTC-8, KJ wrote:
On Thursday, February 10, 2022 at 1:10:50 PM UTC-5, ashokm...@gmail.com wrote:
I\'d like to open a file and then display the name of the file that I just opened. Tried the following but get a syntax Error.

FILE Fnew : Text;
FILE_OPEN(Fnew, \"wfile\", WRITE_MODE);
report \"FILE NAME = \", & Fnew; --Syntax Error
[...]
The file name in your example is \"wfile\", not &Fnew.

So it should be
report \"FILE NAME = \" & \"wfile\";
[...]> Thanks but I still get a syntax error with your solution. Also,
defined a string constant and passed that to the file_open and report
statements. Still syntax Error.

Hello
The problem is probably with the comma before the concatenation operator &

Nicolas
 

Welcome to EDABoard.com

Sponsor

Back
Top