VHDL, arbitrary string length

Discussion in 'VHDL' started by eko, Apr 16, 2008.

  1. eko

    eko

    Joined:
    Apr 16, 2008
    Messages:
    12
    Hi,

    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 be...how can I just read a string of arbitrary length from a file with an arbitrary name?

    Anyone having an idea how to solve this?

    Thanks!
     
    Last edited: Apr 16, 2008
    eko, Apr 16, 2008
    #1
    1. Advertising

  2. eko

    scottcarl

    Joined:
    May 4, 2007
    Messages:
    49
    Location:
    USA
    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
     
    scottcarl, Apr 16, 2008
    #2
    1. Advertising

  3. eko

    eko

    Joined:
    Apr 16, 2008
    Messages:
    12
    Thank you, that was exactly what i was looking for :) I used this some time ago but somehow had forgotten about std_iopak...
     
    eko, Apr 17, 2008
    #3
  4. eko

    prasanthri

    Joined:
    Apr 27, 2007
    Messages:
    1
    reading commands from text files

    hi,
    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.
     
    prasanthri, May 29, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sam
    Replies:
    3
    Views:
    14,109
    Karl Seguin
    Feb 17, 2005
  2. John Smith
    Replies:
    8
    Views:
    416
    John Smith
    Apr 22, 2004
  3. Honestmath
    Replies:
    5
    Views:
    561
    Honestmath
    Dec 13, 2004
  4. james.w.appleby@gmail.com

    String exceeding length - Getting absolute string length

    james.w.appleby@gmail.com, Jan 9, 2007, in forum: Java
    Replies:
    5
    Views:
    667
    John W. Kennedy
    Jan 11, 2007
  5. kd
    Replies:
    8
    Views:
    326
    KeeganDunn@gmail.com
    Jun 27, 2006
Loading...

Share This Page