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.

problem with file for a test bench

Status
Not open for further replies.

mimiza

Junior Member level 2
Joined
Mar 25, 2012
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,426
Hi, I write a simple code that downloads inputs from a text file for a testbench, but when I simulate I receive the following error:

# ** Error: (vsim-7) Failed to open VHDL file "Input.txt" in rb mode.
#
# No such file or directory. (errno = ENOENT)

How can I fix it, please help. I'm working on modelsim.
Thanks.
 

Usually, Modelsim is expecting the file in the project base directory (where *.do files or vsim.ini reside), not in the hdl directory. Where did you place it?
 

Hi FvM, I placed the file "Input.txt" in the project directory where I saved my project. But i didn't found a directory containing *.do files or vsim.ini.
thanks
 

Hi FvM, I placed the file "Input.txt" in the project directory where I saved my project. But i didn't found a directory containing *.do files or vsim.ini.
thanks

FvM is referring to the location that Modelsim is running from. If you have Modelsim up type into the console: pwd

That will tell you where it's running from. Put the Input.txt file in that directory. You should also verify that the VHDL file that calls out the Input.txt file isn't adding a directory path to the name. If it does, put the file in that directory.

Regards,
-alan
 

thanks for your reply ads_err, yes I have already added the input.txt to the directory as you said but the error persist again. that is my code, perhaps I wrote something wrong:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_textio.all;


library STD;
use STD.textio.all;
---------------------------------------------------------------------
entity tb_additionneur is
end tb_additionneur;
---------------------------------------------------------------------
architecture TB of TB_additionneur is

component additionneur
port(
clock: in std_logic;
reset: in std_logic;
inp1: in std_logic_vector(3 downto 0);
inp2: in std_logic_vector(3 downto 0);
inp3: in std_logic_vector(3 downto 0);
Som:eek:ut std_logic_vector(5 downto 0)
);
end component;
-------fichier de testbench--------------

------------------------------------------

signal T_clock: std_logic;
signal T_reset: std_logic;
signal T_inp1: std_logic_vector(3 downto 0);
signal T_inp2: std_logic_vector(3 downto 0);
signal T_inp3: std_logic_vector(3 downto 0);
signal T_som: std_logic_vector(5 downto 0);

begin
U_additionneur:additionneur
port map(T_clock, T_reset,T_inp1,T_inp2,T_inp3,T_som);

-- procedure d'horloge-------------------
process
begin
T_clock <= '0';
wait for 5 ns;
T_clock <= '1';
wait for 5 ns;
end process;
--------------------------------------------


---------- entree a partir de fichier text-------------

read_input:process

file fileIn : text open read_mode is "Input.txt";
-- les variables de lecture

variable read_len:natural;
variable ligne: line;
variable good_number : boolean;

-- les variables d'entrées
variable V_inp1,V_inp2,V_inp3 : std_logic_vector(3 downto 0);
begin


FILE_OPEN(fileIn, "Input.txt" );
while not endfile(fileIn) loop
-- lecture de la ligne
readline(fileIn, ligne);

read(ligne,V_inp1);
read(ligne,V_inp2);
read(ligne,V_inp3);



T_inp1 <= V_inp1;
T_inp2 <= V_inp2;
T_inp3 <= V_inp3;


end loop;
wait;
end process;

T_reset <= '1' after 0 ns, '0' after 100 ns ;
end TB;
 

file fileIn : text open read_mode is "Input.txt";
FILE_OPEN(fileIn, "Input.txt" );
while not endfile(fileIn) loop
-- lecture de la ligne
readline(fileIn, ligne);

read(ligne,V_inp1);
read(ligne,V_inp2);
read(ligne,V_inp3);

Well Input.txt should reside in the directory where vsim is running. Don't know how you are launching the simulator, so can't tell you where it starts up. Modelsim defaults to it's install directory if there is no project that was previously loaded, otherwise it tries to launch in the last project directory opened if you're using a .mpf file.

Regards,
-alan
 

And the all-time favorite .. when in doubt, use absolute paths in your filenames. One less issue to worry about when you're still figuring things out.

So where you have "Input.txt" now, you put something like "/tmp/Input.txt" or "C:\OMG\IUSE\TEHWINDOZE\Input.txt".
 

I fixed the problem, Thanks for all of you.
 

Hello

friends i am new to this site and never used programming and i have a project based on programming can any one help me in this projects my topics are listed below the project had to be small not a big one

List of my project topics

Web/Mobile Technology Group
Operating-Systems and Network/Distributed Systems Group
Compilers, DSL
Embedded/Electronics Group
Cryptography Group
Augmented Reality Group
Artificial Intelligence

Thanks & Regards
Muqtar.Mohammed
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top