diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-02-25 02:01:21 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-02-25 19:19:23 +0100 |
commit | 9b2fec3be17d065898706245ddee7c6e020b9f6e (patch) | |
tree | a369202637f89db95340afd1476d174fbb9e70ea /testsuite | |
parent | 83449709c345372656d849d893d2d797a83bd683 (diff) | |
download | ghdl-9b2fec3be17d065898706245ddee7c6e020b9f6e.tar.gz ghdl-9b2fec3be17d065898706245ddee7c6e020b9f6e.tar.bz2 ghdl-9b2fec3be17d065898706245ddee7c6e020b9f6e.zip |
testsuite/gna: add test for #1145
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/gna/issue1145/count.vhdl | 22 | ||||
-rw-r--r-- | testsuite/gna/issue1145/empty.txt | 5 | ||||
-rw-r--r-- | testsuite/gna/issue1145/ghdl_test.txt | 10 | ||||
-rw-r--r-- | testsuite/gna/issue1145/tb.vhdl | 26 | ||||
-rwxr-xr-x | testsuite/gna/issue1145/testsuite.sh | 16 |
5 files changed, 79 insertions, 0 deletions
diff --git a/testsuite/gna/issue1145/count.vhdl b/testsuite/gna/issue1145/count.vhdl new file mode 100644 index 000000000..a515dd1de --- /dev/null +++ b/testsuite/gna/issue1145/count.vhdl @@ -0,0 +1,22 @@ +library std; +use std.textio.all; + +entity count is +end entity count; + +architecture tb of count is +begin + p_test : process is + variable v_line : line; + variable nlines : natural := 0; + begin + while not endfile(input) loop + readline(input, v_line); + nlines := nlines + 1; + end loop; + + report natural'image (nlines); + + wait; + end process; +end architecture; diff --git a/testsuite/gna/issue1145/empty.txt b/testsuite/gna/issue1145/empty.txt new file mode 100644 index 000000000..804598449 --- /dev/null +++ b/testsuite/gna/issue1145/empty.txt @@ -0,0 +1,5 @@ +1 +2 +3 + +5 diff --git a/testsuite/gna/issue1145/ghdl_test.txt b/testsuite/gna/issue1145/ghdl_test.txt new file mode 100644 index 000000000..238f43adf --- /dev/null +++ b/testsuite/gna/issue1145/ghdl_test.txt @@ -0,0 +1,10 @@ +114,-76,-317,-192,-243,261,99,37,10,-267,-429,-77,133,-117,-760,-363,-294,586,179,-62,-414,-188,-196,351,1,2,0,0,0
+-141,-91,-22,441,448,180,-38,-141,-331,211,214,633,-268,-77,207,1347,999,-216,-241,-206,-62,687,664,74,1,2,0,0,0
+-92,161,541,265,507,-808,-36,173,813,-509,-59,-682,17,545,1826,-875,-893,-1493,-38,308,380,-571,-341,-482,1,2,0,0,0
+181,88,676,-1484,-1635,-413,25,-83,-1470,235,461,876,500,-217,-675,-1357,-1164,1060,-213,8,-18,1511,1070,-455,1,2,1,0,0
+-278,154,2919,650,-35,-2073,-190,-389,-2376,-110,550,2684,-58,-51,856,1775,860,-395,-848,-813,-1922,3408,3586,1359,1,2,0,0,0
+86,578,1208,-1260,-635,-1180,-338,488,1747,642,1115,-2076,-171,855,3564,-1449,-1067,-3147,-90,908,2039,-1723,-1117,-1933,1,2,0,0,0
+467,-198,-806,-1601,-1615,907,332,177,-266,-652,-1178,-91,630,-361,-2452,-1816,-1546,2127,333,-226,-1315,484,219,678,1,2,0,0,0
+-123,-185,-735,561,741,788,15,-154,-48,323,199,468,-427,-146,64,1835,1469,-203,-187,-129,377,313,217,-171,1,2,0,0,0
+-80,92,508,404,401,-661,-35,61,330,-363,-83,-252,32,332,1070,-463,-522,-898,-9,114,-122,-372,-153,88,1,2,0,0,0
+87,29,118,-570,-630,6,36,25,-284,21,-47,78,156,-150,-650,-415,-271,633,46,-49,-96,312,214,-45,1,2,0,0,0
diff --git a/testsuite/gna/issue1145/tb.vhdl b/testsuite/gna/issue1145/tb.vhdl new file mode 100644 index 000000000..397a37e72 --- /dev/null +++ b/testsuite/gna/issue1145/tb.vhdl @@ -0,0 +1,26 @@ +library std; +use std.textio.all; + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity tb_ghdl_test is +end entity tb_ghdl_test; + +architecture tb of tb_ghdl_test is +begin + p_test : process is + file f_in : text; + variable v_line : line; + begin + file_open(f_in, "ghdl_test.txt", read_mode); + + while not endfile(f_in) loop + readline(f_in, v_line); + report v_line.all; + end loop; + + wait; + end process; +end architecture; diff --git a/testsuite/gna/issue1145/testsuite.sh b/testsuite/gna/issue1145/testsuite.sh new file mode 100755 index 000000000..9a9f45ebd --- /dev/null +++ b/testsuite/gna/issue1145/testsuite.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze tb.vhdl +elab_simulate tb_ghdl_test + +analyze count.vhdl +elab count + +simulate count < ghdl_test.txt | grep -q " 10" +simulate count < empty.txt | grep -q " 5" + +clean + +echo "Test successful" |