Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Reading data from text

Status
Not open for further replies.

masoud.malekzadeh

Member level 1
Joined
Jan 22, 2012
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,626
port map

Hi, I'm trying to read data from text file and store it into a ROM the add ROM(0) and ROM(1) using Xilinx IP Core Generator

I'm getting this error in port mapping line :Indexed name is not a std_logic_vector

If I declare ROM type std_logic_vector instead of Bit_vector the reading wo'nt work and i get errors such as

read needs 3 component
Line is not declared
Read is not declared ....

I would be thankful if someone help me .........





library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_unsigned.ALL;
use std.textio.all;


entity ROM is

port (
clk: in std_logic
);

end ROM;

architecture Behavioral of ROM is

type ram_type is array (9 downto 0 ) of bit_vector(31 downto 0 );
signal ram :ram_type;
signal w:std_logic_vector(31 downto 0);

signal z:std_logic_vector(31 downto 0);
signal f:std_logic_vector(31 downto 0);
component adder
port (
a: in std_logic_vector(31 downto 0);
b: in std_logic_vector(31 downto 0);
clk: in std_logic;
result: out std_logic_vector(31 downto 0));
end component;



begin

g1: adder port map (a => ram(0),b => ram(1),clk => clk,result => w); ---------ERROR HERE------
process(clk)

FILE infile : TEXT is in "in_code.txt";
FILE outfile : TEXT IS OUT "out_code.txt";
VARIABLE out_line: LINE;
variable my_line : line;
variable int: bit_vector(31 downto 0 ) ;
variable i :integer range 9 downto 0 :=0;

begin


if(clk' event and clk='1') then

readline(infile,my_line);

read (my_line,int);
ram(i)<=int;
i:=i+1;
write(out_line,int);
writeline(outfile,out_line );

end if ;


end process;


end Behavioral
 
Last edited:

include the package ieee.std_logic_textio.all and you can read directly into std_logic_vectors. No need for bit_Vectors.

PS. Any reason you're using VHDL 87 code for fileIO rather than 93?
Also - you realise you can only simulate this code right? you cannot synthesise it?
 

Thanks , i got that error fixed but the port map is not working yet ,
and i do not know the advantage of using 93 to 87 ! I would be thankful to know that ......
 

93 adds an append mode to the file modes.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top