Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > problem in files

Reply
Thread Tools

problem in files

 
 
ramanand
Guest
Posts: n/a
 
      07-19-2006
I am having a problem in executing file's. it was compiled
successfully. But coming to simulation it is not reading the i/p
values from i/p FILE, it taking default values.
Please tell me the solution for the below code . Thanks to all


(iam using modelsim5.5a)


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use STD.TEXTIO.ALL;
use IEEE.STD_LOGIC_TEXTIO.ALL;

entity fir16bit is
port(
clk:in std_logic;
-- 16 INPUT SAMPLES FOR 16 TAP FILTER

samp1,samp2,samp3,samp4,samp5,samp6,samp7,samp8,sa mp9,samp10,samp11,samp12,samp13,samp14,samp15,samp 16:in
integer;
-- 16 INPUT CO-EFFICIENTS

coef1,coef2,coef3,coef4,coef5,coef6,coef7,coef8,co ef9,coef10,coef11,coef12,coef13,coef14,coef15,coef 16:in
integer;
sut integer

);

end fir16bit;

architecture Behavioral of fir16bit is

type a is array(1 to 16) of integer; -- ARRAY TO STORE INPUT SAMPLES
type c is array(1 to 16) of integer; -- ARRAY TO STORE INPUT
CO-EFFICIENTS
begin

process(clk)
variable p1,p2,p3,p4,p5,p6,p7,p8,q1,q2,q3,q4,r1,r2:integer;
variable x : a;
variable z : c;
variable j:integer range 1 to 17:=1;

--FILE DECLARATION TO READ INPUT CO-EFFIEICENTS
variable init :boolean :=false;
type ip_data_file is file of integer;

--
file ip_coeff : ip_data_file is in "test123.txt";-- I/P FILE
DECLARARTION

type col_matrix is array (1 to 17) of integer;
variable coeff :col_matrix;
variable i: integer range 1 to 17:=1;
begin
if(init = false)then

while (not endfile(ip_coeff)) and (i < 17)loop
read(ip_coeff, coeff(i)); -- i/p coeff's read in to
file:IP_CO_COEFF
i := i+1;
end loop;

init:=true;
end if;

if rising_edge(clk)then

x(1) := samp1;
x(2) := samp2;
x(3) := samp3;
x(4) := samp4;
x(5) := samp5;
x(6) := samp6;
x(7) := samp7;
x( := samp8;
x(9) := samp9;
x(10):= samp10;
x(11):= samp11;
x(12):= samp12;
x(13):= samp13;
x(14):= samp14;
x(15):= samp15;
x(16):= samp16;

--MULTIPLICATION OF CO-EFFICIENTS AND SAMPLES.
j:=1;
while (j < 17) loop
z(j) := x(j)* coeff(j);
j := j+1;
end loop;

-- ADDITIONS OF INDIVIDUL PRODUCT TERMS.
p1 := z(1)+z(2);
p2 := z(3)+z(4);
p3 := z(5)+z(6);
p4 := z(7)+z(;
p5 := z(9)+z(10);
p6 := z(11)+z(12);
p7 := z(13)+z(14);
p8 := z(15)+z(16);

q1 := p1+p2;
q2 := p3+p4;
q3 := p5+p6;
q4 := p7+p8;

r1 := q1+q2;
r2 := q3+q4;

--FINAL OUTPUT ASSIGNMENT
s <= (r1+r2)

end if;
end process; end Behavioral;

 
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
How to check what symbols are defined in a .o files? .a files? and.so files in linux? yinglcs@gmail.com C++ 3 01-18-2009 05:23 PM
Problem reading small files - stringio problem? Singeo Ruby 3 05-27-2008 04:26 PM
how i can extract text from the PDF files,power point files,Ms word files? crazyprakash Java 4 10-30-2005 10:17 AM
Text files read multiple files into single file, and then recreate the multiple files googlinggoogler@hotmail.com Python 4 02-13-2005 05:44 PM
Help! Files, Files, and more Files ... Everywhere JeffS Digital Photography 22 09-19-2004 01:47 AM



Advertisments