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

Reply

VHDL - File Transfer

 
Thread Tools Search this Thread
Old 03-01-2009, 05:09 PM   #1
Default File Transfer


This Quote is regarding File Read operation into std_logic_vector.

Is it possible to read a .txt or .doc file and convert the data inside it to binary (output: out std_logic_vector) and see in Test bench Waveform in VHDL???
The output is of fixed length 150 downto 0, This is the packet data Which is further processed in MATLAB.. Plse help me in this issue...


shashankrsharma

Last edited by shashankrsharma : 03-01-2009 at 05:15 PM.
shashankrsharma is offline   Reply With Quote
Old 03-03-2009, 06:47 AM   #2
ice
Junior Member
 
Join Date: Mar 2009
Posts: 2
Default
Quote:
Originally Posted by shashankrsharma
This Quote is regarding File Read operation into std_logic_vector.

Is it possible to read a .txt or .doc file and convert the data inside it to binary (output: out std_logic_vector) and see in Test bench Waveform in VHDL???
The output is of fixed length 150 downto 0, This is the packet data Which is further processed in MATLAB.. Plse help me in this issue...


Yes, check out the following libraries

LIBRARY IEEE;
USE ieee.std_logic_textio.all;
LIBRARY std;
USE std.textio.all;


ice
ice is offline   Reply With Quote
Old 03-04-2009, 04:48 PM   #3
shashankrsharma
Junior Member
 
Join Date: Mar 2009
Posts: 6
Exclamation
Quote:
Originally Posted by ice
Yes, check out the following libraries

LIBRARY IEEE;
USE ieee.std_logic_textio.all;
LIBRARY std;
USE std.textio.all;

Thanks folks,
I have used the above lib, but the file reads the data into LINE data type,
how to convert the data present in LINE to STD_LOGIC_VECTOR(150 down to 0)??

I also faced another problem , later This code is to be simulated in MATLAB using Xilinx blockset, so i used BLACKBOX to call the program, but while execution there is a error reported -> "CODE ERROR" stating IN and OUT keyword should not be used for FILE decleration..so how to correct that error??
I know ppl rarely use such an concept, so if any one know plse do help


shashankrsharma
shashankrsharma is offline   Reply With Quote
Old 03-05-2009, 04:56 AM   #4
shashankrsharma
Junior Member
 
Join Date: Mar 2009
Posts: 6
Default The source code
this code is helpfull to copy contents from one file to another, but how to copy the contents in the std_logic_vector???
check for the code->
/////////////////////////////////////////////////////////////////////
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;


library std;
use std.textio.all;

entity fileaccess is
port(clk : in std_logic);
end fileaccess;

architecture Behavioral of fileaccess is
file myfile:text is IN "in.txt";
file outfile:text is out "out.txt";
begin
process(clk)
variable eol:boolean;
variable ilin,tempout:line;
variable header,headerout:string(35 downto 1);
variable tmp : integer;
begin
for tmp in 1 to 3 loop-- to copy 3 lines
readline(myfile,ilin);
read(ilin,header,eol);

--headerout:=To_StdLogicVector(header);--????? how to do this
--headerout<=to_std_logic_vector(header(1));--?????

write(tempout,header);
writeline(outfile,tempout);
end loop;
end process;
end behavioral;
///////////////////////////////////////////////////////////////


shashankrsharma
shashankrsharma is offline   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
A Great gift for ipod users:ImTOO iPod Computer Transfer candycaw Software 4 11-26-2007 06:59 AM
Classic Original Broadcasts Trading List - Updated ( w/o/c ) porkys1982@sbcglobal.net DVD Video 0 12-05-2005 03:38 AM
Classic Original Broadcasts Trading List - Updated ( w/o/c ) porkys1982@sbcglobal.net DVD Video 0 11-19-2005 04:46 PM
Original Airings : The A-Team , M*A*S*H , Taxi , Barney Miller , WKRP porkys1982@sbcglobal.net DVD Video 0 08-15-2005 03:09 AM




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