aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue881
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-08-06 07:50:13 +0200
committerTristan Gingold <tgingold@free.fr>2019-08-06 07:50:13 +0200
commit5bf9308b47bfb71ebec95316351c4ee1039a3a90 (patch)
treeb75345a3c075d8b52826bf887d94e45aa7231892 /testsuite/gna/issue881
parent5034635df4c711dfa2dc3ae1faad49c49d018511 (diff)
downloadghdl-5bf9308b47bfb71ebec95316351c4ee1039a3a90.tar.gz
ghdl-5bf9308b47bfb71ebec95316351c4ee1039a3a90.tar.bz2
ghdl-5bf9308b47bfb71ebec95316351c4ee1039a3a90.zip
Add a testcase for #881
Diffstat (limited to 'testsuite/gna/issue881')
-rw-r--r--testsuite/gna/issue881/t87.vhdl17
-rw-r--r--testsuite/gna/issue881/t87io.vhdl19
-rwxr-xr-xtestsuite/gna/issue881/testsuite.sh21
3 files changed, 57 insertions, 0 deletions
diff --git a/testsuite/gna/issue881/t87.vhdl b/testsuite/gna/issue881/t87.vhdl
new file mode 100644
index 000000000..847bf4e47
--- /dev/null
+++ b/testsuite/gna/issue881/t87.vhdl
@@ -0,0 +1,17 @@
+entity t87 is
+end;
+
+architecture behav of t87 is
+ constant t1 : time := 1 ns;
+ constant t2 : natural := time'pos (t1);
+begin
+ assert t1 = 1000 ps;
+ process
+ variable v : natural;
+ begin
+ -- Time resolution must be ps
+ v := time'pos(ps);
+ assert v = 1 severity failure;
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/gna/issue881/t87io.vhdl b/testsuite/gna/issue881/t87io.vhdl
new file mode 100644
index 000000000..3b2c70c18
--- /dev/null
+++ b/testsuite/gna/issue881/t87io.vhdl
@@ -0,0 +1,19 @@
+entity t87io is
+end;
+
+use std.textio.all;
+
+architecture behav of t87io is
+ constant t1 : time := 1 ns;
+ constant t2 : natural := time'pos (t1);
+begin
+ assert t1 = 1000 ps;
+ process
+ variable v : natural;
+ begin
+ -- Time resolution must be ps
+ v := time'pos(ps);
+ assert v = 1 severity failure;
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/gna/issue881/testsuite.sh b/testsuite/gna/issue881/testsuite.sh
new file mode 100755
index 000000000..1ec9e0a4d
--- /dev/null
+++ b/testsuite/gna/issue881/testsuite.sh
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+# See #613
+
+if ! $GHDL --help -a | grep -q time-resolution; then
+ echo "option --time-resolution not available"
+else
+ analyze t87.vhdl
+ elab_simulate --time-resolution=ps t87
+ elab_simulate --time-resolution=auto t87
+
+ analyze t87io.vhdl
+ elab_simulate --time-resolution=ps t87io
+ elab_simulate --time-resolution=auto t87io
+
+ clean
+fi
+
+echo "Test successful"