diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-04-18 06:45:04 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-04-19 20:48:24 +0200 |
commit | 391c91e95f1fe6958e06a1b2ddd314b9952ff6b3 (patch) | |
tree | 0146c702b0bad792235eff7357f4445acdfbc1de /testsuite | |
parent | 1e3f0221d1e010cadd0d844f05df63edb4534ee8 (diff) | |
download | ghdl-391c91e95f1fe6958e06a1b2ddd314b9952ff6b3.tar.gz ghdl-391c91e95f1fe6958e06a1b2ddd314b9952ff6b3.tar.bz2 ghdl-391c91e95f1fe6958e06a1b2ddd314b9952ff6b3.zip |
Add testcase for #20
Close #20
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/gna/issue20/fp_write_read_issue.vhdl | 32 | ||||
-rwxr-xr-x | testsuite/gna/issue20/testsuite.sh | 12 |
2 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/gna/issue20/fp_write_read_issue.vhdl b/testsuite/gna/issue20/fp_write_read_issue.vhdl new file mode 100644 index 000000000..b83bc51eb --- /dev/null +++ b/testsuite/gna/issue20/fp_write_read_issue.vhdl @@ -0,0 +1,32 @@ +entity fp_write_read_issue is
+end entity fp_write_read_issue ;
+architecture doit of fp_write_read_issue is
+ use std.textio.all ;
+ file MyFile : text ;
+begin
+ process
+ variable A, B : real ;
+ variable buf : line ;
+ begin
+ file_open(MyFile, "./fp_write_read_file_A.txt", WRITE_MODE) ;
+ A := 5.0 / 7.0 ;
+ write(buf, A) ;
+ writeline(MyFile, buf) ;
+ file_close(MyFile) ;
+ swrite(buf, "A = ") ;
+ write(buf, A) ;
+ writeline(OUTPUT, buf) ;
+ file_close(MyFile) ;
+ file_open(MyFile, "./fp_write_read_file_A.txt", READ_MODE) ;
+ readline(MyFile, buf) ;
+ read(buf, B);
+ file_close(MyFile) ;
+ swrite(buf, "B = ") ;
+ write(buf, B) ;
+ writeline(OUTPUT, buf) ;
+ Assert A = B report "Read value differs from write value" severity failure ;
+
+ std.env.stop ;
+ wait ;
+ end process ;
+end architecture doit ;
diff --git a/testsuite/gna/issue20/testsuite.sh b/testsuite/gna/issue20/testsuite.sh new file mode 100755 index 000000000..5bfed4bfe --- /dev/null +++ b/testsuite/gna/issue20/testsuite.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze fp_write_read_issue.vhdl +elab_simulate fp_write_read_issue + +rm -f fp_write_read_file_A.txt +clean + +echo "Test successful" |