Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > VHDL, arbitrary string length

Thread Tools

VHDL, arbitrary string length

eko eko is offline
Junior Member
Join Date: Apr 2008
Posts: 12

for a testbench I need a procedure loading arbitrary files with stimuli data. Now my problem is vhdl wants me to define the string length of the file name+path in advance. But since this TB is used for huge amount of testcases run in several different environments I cannot tell the length of the file name strings before the procedure is called...

Further a quite similar problem arises when I read the stimuli files, since they contain signal names and their values, I cannot tell in advance how big the string read from a line will can I just read a string of arbitrary length from a file with an arbitrary name?

Anyone having an idea how to solve this?


Last edited by eko; 04-16-2008 at 04:11 PM..
Reply With Quote
scottcarl scottcarl is offline
Join Date: May 2007
Location: USA
Posts: 51
VHDL is not very forgiving it its language format. If you truely don't know the input format of the data then I highly suggest that you use some other software program, c-shell, python, ... etc, to format the data into a known state. Otherwise you'll just end up getting lots of errors during simulation that will drive you nuts.
You could try reading in a very large string (1 to 120) perhaps. Then you'll have to check the first letters, numbers, or characters to determine if the input string is valid data, comments, blank line, or something else. There is also a package out there called iopakb.vhd and iopakp.vhd (Google it) that has a c-type "fscan" function that will read in strings very well. However you try to do it there is no simple answer when your input data is of a random nature. You'll have to put in a ton of 'checking' logic as long as the input is of a somewhat unknown form.

Scott C
Reply With Quote
eko eko is offline
Junior Member
Join Date: Apr 2008
Posts: 12
Thank you, that was exactly what i was looking for I used this some time ago but somehow had forgotten about std_iopak...
Reply With Quote
prasanthri prasanthri is offline
Junior Member
Join Date: Apr 2007
Posts: 1
i would like to drive a vhdl testbench with commands reading from a file.the expected command format is like" module activity values", 'activity' indicates what to be done on the specified 'module' for testing and 'values' specifies what all parameters have to be used for that 'activity'.

for example:writing to a memory-

"memory write 0x0001|0001,0x0002|0010,0x0003|0011"

how can i read these commands from the file in correct order and run my test bench.
Reply With Quote

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
String exceeding length - Getting absolute string length Java 5 01-11-2007 12:07 AM
Arbitrary length multi-dimensional arrays kd C Programming 8 06-27-2006 12:40 AM
left(string, length) or right(string, length)? Sam ASP .Net 3 02-17-2005 12:01 PM
calling an arbitrary function w/ arbitrary arguments Honestmath C++ 5 12-13-2004 06:18 AM
How to return a string of arbitrary length to caller? John Smith C++ 8 04-22-2004 07:35 PM