aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/bug17203/bug.vhdl
blob: 8c2e6a5d138b06fbd42057f7c194ebcca4e0c6e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;