Google for "WAV file format". The first link describes the file
format well enough to write a reader.
You can read from a binary file by declaring:
type CHAR_FILE is file of CHARACTER;
and using FILE_OPEN, READ, and ENDFILE to perform the reading.
and some vhdl sources using it to test FIR filter
http://lotnisko.net/~mikel/sources.zip
Użytkownik "David Jones" <d...@inode.org> napisał w wiadomości
news:S%m8a.31$KJ3....@news20.bellglobal.com...
--
Serwis Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/
Hint for anyone seeking the same information:
This is a example. I have not yet completed the full testbench.
Hope this will give you a idea.....
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 std.textio.all;
entity test is
end test;
architecture beh of test is
begin
process
type CHAR_FILE is file of character;
file in_file,out_file : CHAR_FILE;
variable fstat,fstat1 : file_open_status;
variable ch : character:= 'a';
variable data : std_logic_vector (15 downto 0);
variable data_size : integer:= 44128 ;
begin
FILE_OPEN(fstat,in_file,"s1.wav",READ_MODE);
FILE_OPEN(fstat1,out_file,"s2.wav",WRITE_MODE);
while not endfile(in_file) loop
read(in_file,ch);
-- this is convert the character to std_logic_vector
data := std_logic_vector(to_unsigned(character'pos(ch),16));
write(out_file,ch);
end loop;
FILE_CLOSE(in_file);
FILE_CLOSE(out_file);
wait for 10 ns;
end process;
end beh;