newbye and Sonata / open_file problem

F

Fred Bartoli

Guest
Hello,

I'm totally new to vhdl and have a probably obvious problem I'm stuck with.

The first thing to say is that I use Sonata.

I have a test bench in which I want to open a file "CPLD_CMD.txt" as a byte
file that will provide commands for a CPLD.
It compiles fine, but the simulation fails at the open_file line complaining
with the following message :


....
# of Components = 7
# of Processes = 14
# of Drivers = 68
Design Load/Elaboration Elapsed Time: 00h:00m:00s:406ms
% run {1.2 us}
Warning: Free edition - running at reduced performance levels!
Error: CSSIM0022: IF_CPLD_TB.vhd: (line 49): FILE_OPEN: FILE
operation/opening failed.
Reason: Can't use FILE_OPEN on FILE that is already associated with
file-name 'CPLDCMD.txt'
At IF_CPLD_TB.vhd: (line 49)
Instance = :ser2par_tb(struct):wordgen@cpu_cmd_block(behv):
Exception occurred. Cannot continue simulation
Error: vhdle: Simulation failed with exception: file io operation failed
Simulation ended at: 100 ns
Elapsed Time: 00h:00m:00s:000ms
%


Of course I've checked the obvious and the file is there.

Here is the excerpt of interest of the test bench :


ARCHITECTURE behv of CPU_Cmd_block is
constant clockEdge : std_logic := '0';
constant BitsPerWord : integer := 8;

BEGIN
CPLDDriver : process
type fsm_state is (IDLE_St, SEND_St, END_St, READLINE_St);
variable Ser : std_logic;
variable fsm_stateM : fsm_state;
variable bit_count : integer;
variable Word : std_logic_vector(WIDTH-1 downto 0);
variable ByteToSend : std_logic_vector(7 downto 0);
variable line_in,
line_out : Line;
variable good : boolean;
file CmdFile : text;

begin

***** simulation fails here :
file_open(CmdFile,"CPLDCMD.txt",READ_MODE);


case fsm_stateM is
when IDLE_St =>
if Send = '1' then
Word := ParIn;
fsm_stateM := READLINE_St;
end if;
bit_count := 0;
CpldExec<= '0';
SerClk <= '0';

when READLINE_St =>
if not endfile(CmdFile) then
readline(CmdFile, line_in);
hread(line_in, ByteToSend);
fsm_StateM := SEND_St;
else
fsm_StateM := END_St;
end if;


Thanks,
Fred.
 
Fred Bartoli wrote:

I have a test bench in which I want to open a file "CPLD_CMD.txt" as a byte
file that will provide commands for a CPLD.
It compiles fine, but the simulation fails at the open_file line complaining
with the following message :

begin

***** simulation fails here :
file_open(CmdFile,"CPLDCMD.txt",READ_MODE);
You trying to open the file on every process loop.


-- Mike Treseler
 
"Mike Treseler" <mike.treseler@flukenetworks.com> a écrit dans le message
news: 40103062.2080205@flukenetworks.com...
Fred Bartoli wrote:

I have a test bench in which I want to open a file "CPLD_CMD.txt" as a
byte
file that will provide commands for a CPLD.
It compiles fine, but the simulation fails at the open_file line
complaining
with the following message :

begin

***** simulation fails here :
file_open(CmdFile,"CPLDCMD.txt",READ_MODE);

You trying to open the file on every process loop.
I knew that was stupid.

Thanks you very much,
Fred.


> -- Mike Treseler
 

Welcome to EDABoard.com

Sponsor

Back
Top