code for calculating string length

Discussion in 'VHDL' started by rahul.bajait30, Jun 23, 2008.

  1. can anybody tell me whats wrong in the following code ::

    library ieee,std;
    use std.textio.all;
    use ieee.std_logic_textio.all;

    entity len is
    end len;

    architecture length of len is
    signal final : integer := 0;
    file infile : text is in "E:\shweta\extra\RCS card\examples
    file outfile :text is out "E:\shweta\extra\RCS card
    variable inlin : line;
    variable outlin : line;
    variable length : integer := 0;
    while(not(endfile(infile))) loop
    wait for 100 ns;
    length := length + inlin'length;
    end loop;
    final <= length;
    end process;
    end length;
    rahul.bajait30, Jun 23, 2008
    1. Advertisements

  2. rahul.bajait30


    Feb 27, 2008
    Likes Received:
    try comment out "wait for 100ns" in the loop;
    instead, add a "wait" before "end process".
    jeffsen, Jun 23, 2008
    1. Advertisements

  3. rahul.bajait30

    Ashani Patel Guest

    you cant use wait for 100 ns; this wont synthesize . try to work this
    out someother way.
    Ashani Patel, Jun 24, 2008
  4. rahul.bajait30

    KJ Guest

    You have this newsgroup question thing all tell us
    what's wrong and we can tell you why it is wrong. Other than that, it
    is perfectly clear that what you wrote does exactly what you told it
    to do.

    KJ, Jun 24, 2008
  5. rahul.bajait30

    Tricky Guest

    As it appears to be a testbench, then its not meant to be synthesized.
    So wait for 100 ns is a perfectly valid bit of code.
    Tricky, Jun 24, 2008
  6. thanks for your reply, bt there's a better code to find string length
    than this code, but if we want to continue with this code, then we
    have to add wait after end of while loop. now i am not getting how a
    wait could solve a problem. if anybody knows please let me know
    rahul.bajait30, Jun 25, 2008
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.