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 08-05-2007, 04:18 AM
G Iveco
Guest
 
Posts: n/a
Default How do I declare CFILE variables with global visibility?

Hi there,

I am using this public domain package, maybe some of you know.
It basically mimics C's standard IO functions.. It works for my simulation
but I found the CFILE variable must be declared in/for a single process.

For large designs, I may need to print things on the edge of signals, which
means another process. Examples being detection of SYN word, Output
Error flag, etc.

http://bear.ces.cwru.edu/vhdl/



Reply With Quote
  #2 (permalink)  
Old 08-06-2007, 06:09 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: How do I declare CFILE variables with global visibility?

G Iveco wrote:

> I am using this public domain package, maybe some of you know.
> It basically mimics C's standard IO functions.. It works for my simulation
> but I found the CFILE variable must be declared in/for a single process.
>
> For large designs, I may need to print things on the edge of signals, which
> means another process. Examples being detection of SYN word, Output
> Error flag, etc.


It's quite possible to provide test stimulus
and verification using a single process.
See my testbench example.

If you prefer to go further out
on the original tangent, start here:
http://groups.google.com/groups/sear...ple&scoring=d&


-- Mike Treseler
Reply With Quote
  #3 (permalink)  
Old 08-06-2007, 10:39 PM
Paul Uiterlinden
Guest
 
Posts: n/a
Default Re: How do I declare CFILE variables with global visibility?

G Iveco wrote:

> Hi there,
>
> I am using this public domain package, maybe some of you know.
> It basically mimics C's standard IO functions.. It works for my simulation
> but I found the CFILE variable must be declared in/for a single process.
>
> For large designs, I may need to print things on the edge of signals,
> which means another process. Examples being detection of SYN word, Output
> Error flag, etc.
>
> http://bear.ces.cwru.edu/vhdl/


I haven't looked at these packages so I don't know how this CFILE is used or
what type it is.

I have my own set of procedures for text output. What it boils down to is a
package declaring the output file:

FILE logfile : text OPEN write_mode IS "log";

Furthermore, this package contains print procedures that use logfile
internally (so not via their parameter lists).

Now anywhere where you want to print to this file, you just make that
package visible by a USE clause and use the print procedures.

Because logfile is declared in a package, it is only opened once, even if
multiple processes use the print procedures.

--
Paul Uiterlinden
www.aimvalley.nl
e-mail addres: remove the not.
Reply With Quote
  #4 (permalink)  
Old 08-07-2007, 02:37 PM
G Iveco
Guest
 
Posts: n/a
Default Re: How do I declare CFILE variables with global visibility?


"Mike Treseler" <[email protected]> wrote in message
news:[email protected]...
>G Iveco wrote:
>
>> I am using this public domain package, maybe some of you know.
>> It basically mimics C's standard IO functions.. It works for my
>> simulation
>> but I found the CFILE variable must be declared in/for a single process.
>>
>> For large designs, I may need to print things on the edge of signals,
>> which
>> means another process. Examples being detection of SYN word, Output
>> Error flag, etc.

>
> It's quite possible to provide test stimulus
> and verification using a single process.
> See my testbench example.
>
> If you prefer to go further out
> on the original tangent, start here:
> http://groups.google.com/groups/sear...ple&scoring=d&
>
>
> -- Mike Treseler



Yes I am aware of that it's possible to code everything in one process.

Designs get complicated in communication area, where the arrival of some
signals and delays in demodulated data can not be determined, so writing a
single process will be extremely messy and unreadable.

I think i will keep exploring until I have built up all my coding habbits..



Reply With Quote
  #5 (permalink)  
Old 08-07-2007, 02:42 PM
G Iveco
Guest
 
Posts: n/a
Default Re: How do I declare CFILE variables with global visibility?


"Paul Uiterlinden" <[email protected]> wrote in message
news:[email protected]...
>G Iveco wrote:
>
>> Hi there,
>>
>> I am using this public domain package, maybe some of you know.
>> It basically mimics C's standard IO functions.. It works for my
>> simulation
>> but I found the CFILE variable must be declared in/for a single process.
>>
>> For large designs, I may need to print things on the edge of signals,
>> which means another process. Examples being detection of SYN word, Output
>> Error flag, etc.
>>
>> http://bear.ces.cwru.edu/vhdl/

>
> I haven't looked at these packages so I don't know how this CFILE is used
> or
> what type it is.
>
> I have my own set of procedures for text output. What it boils down to is
> a
> package declaring the output file:
>
> FILE logfile : text OPEN write_mode IS "log";
>
> Furthermore, this package contains print procedures that use logfile
> internally (so not via their parameter lists).
>
> Now anywhere where you want to print to this file, you just make that
> package visible by a USE clause and use the print procedures.
>
> Because logfile is declared in a package, it is only opened once, even if
> multiple processes use the print procedures.
>
> --
> Paul Uiterlinden
> www.aimvalley.nl
> e-mail addres: remove the not.



CFILE is an integer subtype.

SUBTYPE CFILE IS INTEGER;

With this package, one can write fprintf and printf as if it's in C
language..


Here are some examples,

variable fout: CFILE; --FILE fout: text; --FILE *fout;
variable fin: CFILE; --FILE fin: text; --FILE *fin;
variable fout1:CFILE; --FILE fout1:text;
variable fout2:CFILE; --FILE fout2:text;


fout1:=fopen("xxx_fout1.txt", "w"); --file_open(fout1, "xxx_fout1.txt",
WRITE_MODE);
fprintf(fout1, " Hello, World\n 123\n 9bc ");
fclose(fout1); --fclose(fbuf1, fout1);




Reply With Quote
  #6 (permalink)  
Old 08-07-2007, 03:27 PM
Paul Uiterlinden
Guest
 
Posts: n/a
Default Re: How do I declare CFILE variables with global visibility?

G Iveco wrote:

> CFILE is an integer subtype.
>
> SUBTYPE CFILE IS INTEGER;
>
> With this package, one can write fprintf and printf as if it's in C
> language..
>
>
> Here are some examples,
>
> variable fout: CFILE; --FILE fout: text; --FILE *fout;
> variable fin: CFILE; --FILE fin: text; --FILE *fin;
> variable fout1:CFILE; --FILE fout1:text;
> variable fout2:CFILE; --FILE fout2:text;
>
>
> fout1:=fopen("xxx_fout1.txt", "w"); --file_open(fout1,
> "xxx_fout1.txt", WRITE_MODE);
> fprintf(fout1, " Hello, World\n 123\n 9bc ");
> fclose(fout1); --fclose(fbuf1, fout1);


Based on those examples, I suppose these variables can be made shared
variables (or rather: protected shared variables) declared in a package.
Then you can print from different processes to the same file. But still you
should be carefull not to open the file more than once.

Apart from everything, I don't like the idea of trying to mimic the C-style
print procedures in VHDL. This is my personal taste, based on the fact that
VHDL lacks variable argument lists. So there always be limitations. I'd
rather stick to VHDL and use type LINE from std.textio to build the strings
I want to print. Together with some home brew print procedures and
conversion functions things are quite manageable.

--
Paul Uiterlinden
www.aimvalley.nl
e-mail addres: remove the not.
Reply With Quote
  #7 (permalink)  
Old 08-07-2007, 05:14 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: How do I declare CFILE variables with global visibility?

G Iveco wrote:

> Designs get complicated in communication area, where the arrival of some
> signals and delays in demodulated data can not be determined, so writing a
> single process will be extremely messy and unreadable.


Might be.
So might any other style.
Hardware description is based on communicating sequential processes.
Each process is a box that is wired to other boxes.
If I use lots of boxes, the procedures are obscured by wires.
If I use just one box, the wires are are obscured by procedures.

-- Mike Treseler
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
Global Variables [email protected] FPGA 2 11-05-2007 02:50 PM
global variables in Verilog thomasc Verilog 6 03-08-2005 06:14 AM
Visibility of enumeration literals under use clauses [email protected] VHDL 15 02-01-2005 04:19 AM
Passing user-defined types through the port (global variables??) FPGA 3 02-04-2004 12:52 PM


All times are GMT +1. The time now is 11:42 AM.


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