Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > VHDL > Re: reading an ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 11 Topic 6091 of 6417
Post > Topic >>

Re: reading an array of parallel input data

by Jonathan Bromley <jonathan.bromley@[EMAIL PROTECTED] > Jun 26, 2008 at 01:40 PM

On Thu, 26 Jun 2008 05:18:42 -0700 (PDT), koyel.aphy@[EMAIL PROTECTED]
 wrote:

>Here is what I am able to edit when I got few errors though there seem
>to be no reason for those.

I have no idea what you mean.  When I tried out my own code
just now I found a few silly errors that prevented it from
compiling; it took me about a minute to fix them.  
What's the problem?

>But now I am getting undefined values [...]
> I don't want to change this code much

Why not?  You'll learn far more if you *do* change it.
Hack around, add plenty of diagnostics, try things out,
see what happens, until you are confident that you
know how to do it all for yourself.

>ReadAndApply:process
>    variable c: character;
>    variable i: integer;
>    variable L: line;
>  begin
>    file_open(StimCSV, "StimCSV.csv", READ_MODE);
>	 wait until (clk'event and clk = '1');
[...]
>		din <= stimulus;
>		end if;
>    file_close(StimCSV);
>    wait;

You're OK with just getting exactly one line of stimulus
from the file?  Doesn't sound very interesting to me.

Since you don't seem to want to debug for yourself,
here's my code fully debugged and working.  I didn't
need to change very much.  I've put in some fixed
time delays so that you can see the values on signal
"stimulus" in a wave viewer.

entity read_csv_test is end;

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.textio.all;

architecture A of read_csv_test is

  subtype slv10 is std_logic_vector(9 downto 0);
  type arr_slv10 is array(natural range <>) of slv10;

  signal stimulus: arr_slv10(0 to 7);
  file StimCSV: text;

begin

  ReadAndApply: process
    variable c: character;
    variable i: integer;
    variable L: line;
  begin
    file_open(StimCSV, "test.csv", READ_MODE);
    while not endfile(StimCSV) loop
      wait for 10 ns;
      readline(StimCSV, L);   -- Get the next stimulus line
      for j in stimulus'range loop
        read(L, i);    -- Get the next integer
        if j /= stimulus'right then
          -- it's not the last item; skip the next comma
          read(L, c);
          assert c = ',' re****t "Oops, bad separator";
        end if;
        stimulus(j) <= std_logic_vector(
                          to_unsigned(i, slv10'length));
      end loop;
    end loop;
    file_close(StimCSV);
    wait for 20 ns;
    wait;
  end process;

end;

-- 
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@[EMAIL PROTECTED]
 contents of this message may contain personal views which 
are not the views of Doulos Ltd., unless specifically stated.
 




 11 Posts in Topic:
reading an array of parallel input data
koyel.aphy@[EMAIL PROTECT  2008-06-19 03:05:15 
Re: reading an array of parallel input data
Jonathan Bromley <jona  2008-06-19 11:53:34 
Re: reading an array of parallel input data
koyel.aphy@[EMAIL PROTECT  2008-06-25 04:41:53 
Re: reading an array of parallel input data
Jonathan Bromley <jona  2008-06-25 13:37:30 
Re: reading an array of parallel input data
koyel.aphy@[EMAIL PROTECT  2008-06-26 05:18:42 
Re: reading an array of parallel input data
Jonathan Bromley <jona  2008-06-26 13:40:04 
Re: reading an array of parallel input data
koyel.aphy@[EMAIL PROTECT  2008-06-26 07:34:39 
Re: reading an array of parallel input data
koyel.aphy@[EMAIL PROTECT  2008-06-27 06:34:39 
Re: reading an array of parallel input data
Jonathan Bromley <jona  2008-06-27 15:19:25 
Re: reading an array of parallel input data
koyel.aphy@[EMAIL PROTECT  2008-06-27 10:43:19 
Re: reading an array of parallel input data
koyel.aphy@[EMAIL PROTECT  2008-06-27 10:47:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 15:58:09 CST 2008.