sim_file reading

S

srinukasam

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;
 
C

coshzz

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;
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top