summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold2015-06-09 20:16:23 +0200
committerTristan Gingold2015-06-09 20:16:23 +0200
commite6d3f2d007196dbddad119520c530454ab5a33c9 (patch)
treef454874a59006d9c9075782fb5ffd4d00d4fe29e /testsuite
parent051c628175b30d752db4d8e292b992c30364116f (diff)
downloadghdl-e6d3f2d007196dbddad119520c530454ab5a33c9.tar.gz
ghdl-e6d3f2d007196dbddad119520c530454ab5a33c9.tar.bz2
ghdl-e6d3f2d007196dbddad119520c530454ab5a33c9.zip
Testcase for crash due to physical fp literals.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/bug15/phys.vhdl24
-rw-r--r--testsuite/gna/bug15/phys2.vhdl14
-rwxr-xr-xtestsuite/gna/bug15/testsuite.sh12
3 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/gna/bug15/phys.vhdl b/testsuite/gna/bug15/phys.vhdl
new file mode 100644
index 0000000..5af3359
--- /dev/null
+++ b/testsuite/gna/bug15/phys.vhdl
@@ -0,0 +1,24 @@
+package physical is
+ type FREQ is range 0 to INTEGER'high units
+ Hz;
+ kHz = 1000 Hz;
+ MHz = 1000 kHz;
+ GHz = 1000 MHz;
+-- THz = 1000 GHz;
+ end units;
+end package;
+
+entity tb is
+end;
+
+use work.physical.all;
+
+architecture test of tb is
+ constant CLOCK_FREQ : FREQ := 100.0 MHz;
+ procedure p (a : freq := 1.0 Mhz) is
+ begin
+ end p;
+begin
+ p (clock_freq);
+ -- empty
+end architecture;
diff --git a/testsuite/gna/bug15/phys2.vhdl b/testsuite/gna/bug15/phys2.vhdl
new file mode 100644
index 0000000..3c0957f
--- /dev/null
+++ b/testsuite/gna/bug15/phys2.vhdl
@@ -0,0 +1,14 @@
+entity tb2 is
+end;
+
+use work.physical.all;
+
+architecture test of tb2 is
+ constant CLOCK_FREQ : FREQ := MHz;
+ procedure p (a : freq) is
+ begin
+ end p;
+begin
+ p (clock_freq);
+ -- empty
+end architecture;
diff --git a/testsuite/gna/bug15/testsuite.sh b/testsuite/gna/bug15/testsuite.sh
new file mode 100755
index 0000000..59c4a42
--- /dev/null
+++ b/testsuite/gna/bug15/testsuite.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze phys.vhdl
+elab_simulate tb
+
+analyze phys2.vhdl
+elab_simulate tb2
+clean
+
+echo "Test successful"