Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > I have a pb to read from file

Reply
Thread Tools

I have a pb to read from file

 
 
sky_nad
Guest
Posts: n/a
 
      12-08-2004
Hi,

I need ur help in my VHDL design:i wanted to read the datas of
component Ram ( data_in) from a file for after use them in this Ram
but when i simulated my code i could find my datas from a file but the
result ( data_out) in output Ram was the first data from file only.I
don't know why. Could u help me for resolving my problem?

This is my code:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use std.textio.all;

entity ram_tb1 is
generic(DEEP: integer := 4;
WIDTH:integer := ;
port(wr,clk:std_logic;
adram:in std_logic_vector (DEEP downto 1);
data_in: inout std_logic_vector(WIDTH downto 1);
data_outut std_logic_vector(WIDTH downto 1));
end ram_tb1;
architecture bev_tb1 of ram_tb1 is

component ram
generic(DEEP: integer := 4;
WIDTH:integer := ;
port(wr,clk:std_logic;
adram:in std_logic_vector (DEEP downto 1);
data_in: in std_logic_vector(WIDTH downto 1);
data_outut std_logic_vector(WIDTH downto 1));
end component;


file from_file:text open READ_MODE is "ram_test_rd.txt";
-- file to_text:text open WRITE_MODE is "ram_test_wr.txt";

begin
call_ram: ram generic map ( deep => 4,
width=>
port map(clk=>clk,
wr=>wr,
adram=>adram,
data_in=>data_in,
data_out=>data_out);

process
variable buf_out,buf_in:line;
variable to_data: bit_vector(8 downto 1);

begin

while not endfile(from_file) loop
wait until rising_edge (clk) ;

-- read digital data from input file
readline(from_file, buf_out);
read(buf_out, to_data);
data_in <= to_stdlogicvector(to_data);

end loop;
end process;

end;


The file "ram_test_rd.txt":

00110011
01010101
00001111

control file is:
force clk 0 0, 1 10, 0 20, 1 30, 0 40, 1 50, 0 60, 1 70, 0 80, 1 90, 0
100, 1 110, 0 120, 1 130, 0 140, 1 150, 0 160
force wr 1 0, 0 70
force adram 0 10, 1 30, 2 50,0 70,1 90,2 110
run 200

Thanks and best regards.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File.read(fname) vs. File.read(fname,File.size(fname)) Alex Dowad Ruby 4 05-01-2010 08:20 AM
file.read() doesn't read the whole file Sreejith K Python 24 03-24-2009 12:20 PM
Database file and folder are not read only but error message says it is read only?? keithb ASP .Net 2 06-07-2006 03:40 PM
jython/python: read file and allow read to be terminated py Python 0 01-27-2006 08:41 PM
Warehouse Dell dimension 3000 advert. This is a question so TNO doesn't have to download this message and read it to waste his time reading messages that I could have possibly got the answer .. (damn, run out of space in the subject line!) cowboyz NZ Computing 68 12-21-2004 02:19 PM



Advertisments