sim_file reading

Discussion in 'VHDL' started by srinukasam, Aug 3, 2005.

  1. srinukasam

    srinukasam Guest

    hi to all
    iam reading a file for simulation data.
    the problem iam facing is read values are just reverse to my actual
    values..
    ex..if i give input 00001 it reads as 10000

    i know that its taking bits from left corner ( from file).

    but how to solve this..

    i think i need to reverse the string that iam reading .but i want to do
    without using 2nd variable..is it possible? is there any inbuit function
    in lib that just reverse the vector. or is there any other idea..please
    send me your reply.

    my procedure for reading string

    procedure readbitstring (variable patternline: in line; column: inout
    positive; variable bitstring: out bit_vector) is
    variable k :natural:=0;
    begin
    while patternline(column)/= ' ' loop
    case patternline(column) is
    when '1'=> bitstring(k):='1';
    when others => bitstring(k):='0';
    end case;
    column:=column+1;
    k:=k+1;
    end loop;
    column:=column+1;
    end procedure;
    srinukasam, Aug 3, 2005
    #1
    1. Advertising

  2. srinukasam

    Guest

    You need reverse your array index while reading patternline.

    procedure readbitstring (
    variable patternline: in line;
    column: inout positive;
    variable bitstring: out bit_vector
    ) is
    variable k :natural:=0;
    begin
    while patternline(column)/= ' ' loop
    case patternline(column) is
    when '1'=> bitstring(bitstring'length-k-1):='1'; --
    reverse your array index
    when others => bitstring(bitstring'length-k-1):='0'; --
    reverse your array index
    end case;
    column:=column+1;
    k:=k+1;
    end loop;
    column:=column+1;
    end procedure;
    , Aug 4, 2005
    #2
    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. Andrija
    Replies:
    1
    Views:
    811
    William Ryan
    Oct 5, 2003
  2. Darrel
    Replies:
    3
    Views:
    657
    Kevin Spencer
    Nov 11, 2004
  3. Wael Soliman

    ASP.NET Reading problem (reading .xls)

    Wael Soliman, Jan 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    4,780
    =?Utf-8?B?dmluYXk=?=
    Jan 3, 2005
  4. Replies:
    0
    Views:
    771
  5. Karim Ali

    Reading a file and resuming reading.

    Karim Ali, May 25, 2007, in forum: Python
    Replies:
    2
    Views:
    356
    Hrvoje Niksic
    May 25, 2007
Loading...

Share This Page