blob: c7ed25851f59d9725544521aa198765e62831f60 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
library ieee;
context ieee.ieee_std_context;
library vunit_lib;
context vunit_lib.vunit_context;
entity tb_test is
generic ( runner_cfg : string );
end entity;
architecture tb of tb_test is
constant params: integer_vector_ptr_t := new_integer_vector_ptr(2, -1);
constant clk_period : time := 20 ns;
type time_t is array (natural range 0 to 1) of natural;
procedure set_time(t: time_t) is begin
set(params, 0, t(0));
set(params, 1, t(1));
end;
procedure get_time(variable t: inout time_t) is begin
t(0) := get(params, 0);
t(1) := get(params, 1);
end;
impure function get_time return time_t is
variable t: time_t;
begin
-- t(0) := get(params, 0);
-- t(1) := get(params, 1);
return t;
end;
constant null_time: time_t := (others => 0);
impure function to_string(t: time_t) return string is begin
return to_string(t(0)) & " " & to_string(t(1));
end;
signal clk: std_logic;
begin
clk <= not clk after (clk_period/2);
run: process(all)
variable r: time_t;
begin
if rising_edge(clk) then
-- info("Time: " & to_string(get_time));
-- get_time(r);
end if;
end process;
main: process
variable t: time_t;
begin
test_runner_setup(runner, runner_cfg);
get_time(t);
if t = null_time then
set_time((others=>natural'high));
end if;
get_time(t);
info("Init test | time: " & to_string(t));
info("Test done");
test_runner_cleanup(runner);
wait;
end process;
test_runner_watchdog(runner, 500 ms);
end architecture;
|