From d9e0243d4a38de3334069a1be94b423135c5a1ee Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 5 Jan 2014 10:17:18 +0100 Subject: Fix bug17203: elaborate packages of an entity before evaluating default expr. --- testsuite/gna/bug17203/bug.vhdl | 37 +++++++++++++++++++++++++++++++++++++ testsuite/gna/bug17203/testsuite.sh | 10 ++++++++++ 2 files changed, 47 insertions(+) create mode 100644 testsuite/gna/bug17203/bug.vhdl create mode 100755 testsuite/gna/bug17203/testsuite.sh (limited to 'testsuite/gna/bug17203') diff --git a/testsuite/gna/bug17203/bug.vhdl b/testsuite/gna/bug17203/bug.vhdl new file mode 100644 index 000000000..8c2e6a5d1 --- /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 000000000..2d521dd72 --- /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" -- cgit v1.2.3