summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold2014-01-05 10:17:18 +0100
committerTristan Gingold2014-01-05 10:17:18 +0100
commitd9e0243d4a38de3334069a1be94b423135c5a1ee (patch)
treea7dea0a77d3588d3aefc243de839e30df8850ae1 /testsuite
parent1cb6bdfbcc35a8510c7ba1148697d26f9cffdcdc (diff)
downloadghdl-d9e0243d4a38de3334069a1be94b423135c5a1ee.tar.gz
ghdl-d9e0243d4a38de3334069a1be94b423135c5a1ee.tar.bz2
ghdl-d9e0243d4a38de3334069a1be94b423135c5a1ee.zip
Fix bug17203: elaborate packages of an entity before evaluating default expr.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/bug17203/bug.vhdl37
-rwxr-xr-xtestsuite/gna/bug17203/testsuite.sh10
2 files changed, 47 insertions, 0 deletions
diff --git a/testsuite/gna/bug17203/bug.vhdl b/testsuite/gna/bug17203/bug.vhdl
new file mode 100644
index 0000000..8c2e6a5
--- /dev/null
+++ b/testsuite/gna/bug17203/bug.vhdl
@@ -0,0 +1,37 @@
+use std.textio.all;
+
+package read_string is
+ function read_string_time (s : string) return time;
+end read_string;
+
+package body read_string is
+ function read_string_time (s : string) return time is
+ variable l : line := new string'(s);
+ variable t : time;
+ variable read_ok : boolean;
+ begin
+ read(l, t, read_ok);
+ if not read_ok then
+ report "read time failed" severity failure;
+ end if;
+ return t;
+ end function;
+end package body read_string;
+
+use work.read_string.all;
+
+entity test_time is
+ generic (test_t : time := read_string_time("123 ps"));
+end test_time;
+
+architecture test of test_time is
+begin
+ process
+ variable t : time;
+ begin
+ t := read_string_time("321 ps");
+ report "t=" & time'image(t) severity warning;
+ wait;
+ end process;
+end test;
+
diff --git a/testsuite/gna/bug17203/testsuite.sh b/testsuite/gna/bug17203/testsuite.sh
new file mode 100755
index 0000000..2d521dd
--- /dev/null
+++ b/testsuite/gna/bug17203/testsuite.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze bug.vhdl
+elab_simulate test_time
+
+clean
+
+echo "Test successful"