N
Niv (KP)
Hi, I currently set a generic to select between two groups of files,
as below:
ARCHITECTURE behave OF mystuff IS
-----------------------------------------------------------------------------------------------------
FUNCTION assign_rd_file(select : BOOLEAN) RETURN STRING IS
BEGIN
IF select THEN
RETURN "../file1.txt";
ELSE
RETURN "../file2.txt";
END IF;
END assign_rd_file;
----------------------------------------------------------------------------------------------------------
BEGIN -- The Architecture
main : PROCESS
FILE f_rd : TEXT OPEN read_mode IS
assign_rd_file(select ) ;
BEGIN
-- do stuff with read file here
END PROCESS main;
END ARCHITECTURE behave;
All well and good, but I would prefer to make the selection after i've
invoked ModelSim, rather than compile with different generic each time
I want different file choice.
I can use something like:
-----------------------------------------------------------------------------------------------
simulation_type_proc : PROCESS
VARIABLE line_out : LINE;
VARIABLE line_in : LINE;
VARIABLE key_press : CHARACTER;
CONSTANT question : STRING := "Enter 'y' for file set 1, anything
else for file set 2";
BEGIN
write(line_out, question); -- ask the question
writeline(output, line_out);
readline(input, line_in); -- get the answer
read(line_in, key_press);
IF key_press = 'y' THEN
select <= TRUE;
ELSE
select <= FALSE;
END IF;
WAIT;
END PROCESS simulation_type_proc;
-------------------------------------------------------------------------------------
which will set a "select" variable, but this obviously wont overwrite
the generic.
Any ideas please?
TIA, Niv.
as below:
ARCHITECTURE behave OF mystuff IS
-----------------------------------------------------------------------------------------------------
FUNCTION assign_rd_file(select : BOOLEAN) RETURN STRING IS
BEGIN
IF select THEN
RETURN "../file1.txt";
ELSE
RETURN "../file2.txt";
END IF;
END assign_rd_file;
----------------------------------------------------------------------------------------------------------
BEGIN -- The Architecture
main : PROCESS
FILE f_rd : TEXT OPEN read_mode IS
assign_rd_file(select ) ;
BEGIN
-- do stuff with read file here
END PROCESS main;
END ARCHITECTURE behave;
All well and good, but I would prefer to make the selection after i've
invoked ModelSim, rather than compile with different generic each time
I want different file choice.
I can use something like:
-----------------------------------------------------------------------------------------------
simulation_type_proc : PROCESS
VARIABLE line_out : LINE;
VARIABLE line_in : LINE;
VARIABLE key_press : CHARACTER;
CONSTANT question : STRING := "Enter 'y' for file set 1, anything
else for file set 2";
BEGIN
write(line_out, question); -- ask the question
writeline(output, line_out);
readline(input, line_in); -- get the answer
read(line_in, key_press);
IF key_press = 'y' THEN
select <= TRUE;
ELSE
select <= FALSE;
END IF;
WAIT;
END PROCESS simulation_type_proc;
-------------------------------------------------------------------------------------
which will set a "select" variable, but this obviously wont overwrite
the generic.
Any ideas please?
TIA, Niv.