Skip to content
Snippets Groups Projects
Commit 47c704c5 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

proc_common_read_integer_file(): Return zeros when file is UNUSED. Report...

proc_common_read_integer_file(): Return zeros when file is UNUSED. Report failure when nof_row > nof lines in file.
parent 6b5b7d2f
No related branches found
No related tags found
No related merge requests found
...@@ -990,6 +990,7 @@ PACKAGE BODY tb_common_pkg IS ...@@ -990,6 +990,7 @@ PACKAGE BODY tb_common_pkg IS
VARIABLE v_string : STRING(1 TO 80); VARIABLE v_string : STRING(1 TO 80);
VARIABLE v_row_arr : t_integer_arr(0 TO nof_col-1); VARIABLE v_row_arr : t_integer_arr(0 TO nof_col-1);
BEGIN BEGIN
IF file_name/="UNUSED" AND file_name/="unused" THEN
-- Open the file for reading -- Open the file for reading
proc_common_open_file(v_file_status, v_in_file, file_name, READ_MODE); proc_common_open_file(v_file_status, v_in_file, file_name, READ_MODE);
-- Read and skip the header -- Read and skip the header
...@@ -1002,11 +1003,17 @@ PACKAGE BODY tb_common_pkg IS ...@@ -1002,11 +1003,17 @@ PACKAGE BODY tb_common_pkg IS
return_array(J*nof_col + I) <= v_row_arr(I); -- use loop to be independent of t_integer_arr downto or to range return_array(J*nof_col + I) <= v_row_arr(I); -- use loop to be independent of t_integer_arr downto or to range
END LOOP; END LOOP;
IF ENDFILE(v_in_file) THEN IF ENDFILE(v_in_file) THEN
IF J/=nof_row-1 THEN
REPORT "COMMON : Unexpected end of file" SEVERITY FAILURE;
END IF;
EXIT; EXIT;
END IF; END IF;
END LOOP; END LOOP;
-- Close the file -- Close the file
proc_common_close_file(v_file_status, v_in_file); proc_common_close_file(v_file_status, v_in_file);
ELSE
return_array <= (return_array'RANGE=>0);
END IF;
END proc_common_read_integer_file; END proc_common_read_integer_file;
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment