Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Reading/writing data to/from files into 2D array

 
Thread Tools Search this Thread
Old 05-19-2004, 05:03 PM   #1
Default Reading/writing data to/from files into 2D array


Hi:

I need to verify my design by comparing the VHDL simulation results
with actual results.I'm working with images and so,the input data is a
text file obtained from Matlab.The text file has image data (of image
size ... 256x256).I tried to read the data from the file into a 2D
array. The data has to be in the form of a matrix (2D array),as I need
to perform block processing later. Below is the code I'm working on.I
would highly appreciate any help/suggestions in doing this.

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
use IEEE.numeric_std.all;
use work.data.all;

entity PE is

port (search_data1_in : in data_array;
current_data1_in : in data_array;
clk,reset : in std_logic;
SAD_blk : out std_logic_vector(11 downto 0)
);
end PE ;

architecture BEHAVE of PE is

signal search_data_in,search_data1_in1 : data_array;
signal current_data1_in1,current_data_in: data_array;
signal s_ras,s_cas,c_ras,c_cas : std_logic;
signal s_row,s_col,c_row,c_col : integer;
signal s_address,c_address : std_logic_vector(15 downto 0);

type integer_file is file of integer;
file data_in : integer_file is in "data.txt";

component S_DRAM
port(s_address : in std_logic_vector(15 downto 0);
clk,reset : in std_logic;
s_we : in std_logic;
s_ras,s_cas : in std_logic;
s_row,s_col : out integer;
search_data_in : in data_array;
search_data_out : out data_array
);
end component;

begin

DRAM_S : S_DRAM port map(s_address => s_address, clk => clk, reset
=> reset, s_we => s_we, s_ras => s_ras, s_cas => s_cas, s_row =>
s_row, s_col => s_col, search_data_in => search_data_in,
search_data_out => search_data1_in1);

process
type Y_array is array (1 to 2,1 to 2) of integer;
variable Y : Y_array;
begin
while not endfile (data_in) loop
for i in 1 to 2 loop
for j in 1 to 2 loop
read(data_in,Y(i,j));
end loop;
end loop;
end loop;
wait for 2 ns;
end process;

end behave;

Also,I need divide this 256x256 matrix into 4x4 blocks.I'm not
sure,where to start on this.Please give me some ideas to implement
this.

Thanks a lot,
Modukuri


Modukuri
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Video files to PSP ivan DVD Video 4 06-17-2008 11:16 AM
Convert Video files to MP4 for iPod ivan DVD Video 0 04-26-2006 08:38 AM
Very slow recognising DVD disc Terry Pinnell DVD Video 1 03-28-2006 06:53 PM
Now I introduce some popular software of multimedia eightsome@gmail.com DVD Video 0 03-28-2006 02:29 PM
Best software for Copying data files to my DVD Writer fkissam DVD Video 2 09-03-2003 06:18 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46