sim_file reading

S

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

Welcome to EDABoard.com

Sponsor

Back
Top