code for calculating string length

Guest
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;
begin
process
file infile : text is in "E:\shweta\extra\RCS card\examples
\data.dat";
file outfile :text is out "E:\shweta\extra\RCS card
\examples\out.dat";
variable inlin : line;
variable outlin : line;
variable length : integer := 0;
begin
while(not(endfile(infile))) loop
readline(infile,inlin);
wait for 100 ns;
length := length + inlin'length;
deallocate(inlin);
end loop;
final <= length;
end process;
end length;
 
On Jun 23, 3:34 am, rahul.bajai...@gmail.com wrote:
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;
begin
process
file infile : text is in "E:\shweta\extra\RCS card\examples
\data.dat";
file outfile :text is out "E:\shweta\extra\RCS card
\examples\out.dat";
variable inlin : line;
variable outlin : line;
variable length : integer := 0;
begin
while(not(endfile(infile))) loop
readline(infile,inlin);
wait for 100 ns;
length := length + inlin'length;
deallocate(inlin);
end loop;
final <= length;
end process;
end length;
you cant use wait for 100 ns; this wont synthesize . try to work this
out someother way.
ashani
 
On Jun 23, 6:34 am, rahul.bajai...@gmail.com wrote:
can anybody tell me whats wrong in the following code ::
You have this newsgroup question thing all backwards...you 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
 
On 24 Jun, 08:22, Ashani Patel <ashani4...@gmail.com> wrote:
On Jun 23, 3:34 am, rahul.bajai...@gmail.com wrote:



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;
    begin
        process
            file infile : text is in "E:\shweta\extra\RCS card\examples
\data.dat";
            file outfile :text is out "E:\shweta\extra\RCS card
\examples\out.dat";
            variable inlin : line;
            variable outlin : line;
            variable length : integer := 0;
            begin
                while(not(endfile(infile))) loop
                    readline(infile,inlin);
                    wait for 100 ns;
                    length := length + inlin'length;
                    deallocate(inlin);
                end loop;
                final <= length;
        end process;
end length;

you cant use wait for 100 ns; this wont synthesize . try to work this
out someother way.
ashani
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.
 
On Jun 24, 8:33 pm, Tricky <Trickyh...@gmail.com> wrote:
On 24 Jun, 08:22, Ashani Patel <ashani4...@gmail.com> wrote:



On Jun 23, 3:34 am, rahul.bajai...@gmail.com wrote:

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;
begin
process
file infile : text is in "E:\shweta\extra\RCS card\examples
\data.dat";
file outfile :text is out "E:\shweta\extra\RCS card
\examples\out.dat";
variable inlin : line;
variable outlin : line;
variable length : integer := 0;
begin
while(not(endfile(infile))) loop
readline(infile,inlin);
wait for 100 ns;
length := length + inlin'length;
deallocate(inlin);
end loop;
final <= length;
end process;
end length;

you cant use wait for 100 ns; this wont synthesize . try to work this
out someother way.
ashani

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

Welcome to EDABoard.com

Sponsor

Back
Top