1#!/usr/bin/env perl
2if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
3# DESCRIPTION: Verilator: Verilog Test driver/expect definition
4#
5# Copyright 2020 by Geza Lore. This program is free software; you can
6# redistribute it and/or modify it under the terms of either the GNU
7# Lesser General Public License Version 3 or the Perl Artistic License
8# Version 2.0.
9# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
10
11scenarios(simulator => 1);
12
13if ($Self->{nc}) {
14    # For NC, compile twice, first just to generate DPI headers
15    compile(
16        nc_flags2 => ["+ncdpiheader+$Self->{obj_dir}/dpi-exp.h",
17                      "+ncdpiimpheader+$Self->{obj_dir}/dpi-imp.h"]
18        );
19}
20
21compile(
22    v_flags2 => ["t/$Self->{name}.cpp"],
23    # --no-decoration so .out file doesn't comment on source lines
24    verilator_flags2 => ["-Wall -Wno-DECLFILENAME --no-decoration"],
25    # NC: Gdd the obj_dir to the C include path
26    nc_flags2 => ["+ncscargs+-I$Self->{obj_dir}"],
27    # ModelSim: Generate DPI header, add obj_dir to the C include path
28    ms_flags2 => ["-dpiheader $Self->{obj_dir}/dpi.h",
29                  "-ccflags -I$Self->{obj_dir}"],
30    );
31
32if ($Self->{vlt_all}) {
33    files_identical("$Self->{obj_dir}/$Self->{VM_PREFIX}__Dpi.h",
34                    "t/$Self->{name}__Dpi.out");
35}
36
37execute(
38    check_finished => 1,
39    );
40
41ok(1);
421;
43