diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-07-19 16:59:45 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-07-19 16:59:45 +0200 |
commit | 430a0574659f7ffa6dce8116e9e3fc54cdcc4a43 (patch) | |
tree | feaf8a307638c5e9ca942b56929ea539f3db0ff9 /testsuite/gna | |
parent | 8677e93d3c0ab2158b906728dbb767bc48fa776b (diff) | |
download | ghdl-430a0574659f7ffa6dce8116e9e3fc54cdcc4a43.tar.gz ghdl-430a0574659f7ffa6dce8116e9e3fc54cdcc4a43.tar.bz2 ghdl-430a0574659f7ffa6dce8116e9e3fc54cdcc4a43.zip |
testsuite/gna: add a test for #1392
Diffstat (limited to 'testsuite/gna')
-rw-r--r-- | testsuite/gna/issue1392/file15.vhdl | 52 | ||||
-rwxr-xr-x | testsuite/gna/issue1392/testsuite.sh | 10 |
2 files changed, 62 insertions, 0 deletions
diff --git a/testsuite/gna/issue1392/file15.vhdl b/testsuite/gna/issue1392/file15.vhdl new file mode 100644 index 000000000..cd71f2093 --- /dev/null +++ b/testsuite/gna/issue1392/file15.vhdl @@ -0,0 +1,52 @@ +-- Code your testbench here +library IEEE; +use IEEE.std_logic_1164.all; +--use std.textio.all; +--use work.proc_pkg.all; + + +entity file15 is + +end entity file15; + +architecture rtl of file15 is + + type char_array_t is array(natural range <>) of character; + type char_arr_file is file of char_array_t; + +begin + process + + file cr : char_arr_file; + + variable mcrr : char_array_t(12 downto 0); + variable small_mcrr : char_array_t(2 downto 0); + variable c : character := 'a'; + variable len : natural; + + begin + + file_open(cr, "./char_arr_file.txt", WRITE_MODE); + for i in 0 to 12 loop + mcrr(i) := c; + c := character'succ(c); + end loop; + write(cr, mcrr); + file_close(cr); + + -- small container + file_open(cr, "./char_arr_file.txt", READ_MODE); + read(cr, small_mcrr,len); + + for i in 0 to 2 loop + report "" & small_mcrr(i); + end loop; + file_close(cr); + + + wait; + end process; + +end rtl; + + diff --git a/testsuite/gna/issue1392/testsuite.sh b/testsuite/gna/issue1392/testsuite.sh new file mode 100755 index 000000000..f694ccdc5 --- /dev/null +++ b/testsuite/gna/issue1392/testsuite.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze file15.vhdl +elab_simulate file15 + +clean + +echo "Test successful" |