1// DESCRIPTION: Verilator: Verilog Test module
2//
3// Copyright 2010 by Wilson Snyder. This program is free software; you can
4// redistribute it and/or modify it under the terms of either the GNU
5// Lesser General Public License Version 3 or the Perl Artistic License
6// Version 2.0.
7// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
8
9`ifdef USE_VPI_NOT_DPI
10//We call it via $c so we can verify DPI isn't required - see bug572
11`else
12import "DPI-C" context function int mon_check();
13`endif
14
15
16module t #(
17   parameter int WIDTH /* verilator public_flat_rd */ = 32
18  ) (/*AUTOARG*/
19   // Inputs
20   clk
21   );
22
23`ifdef VERILATOR
24`systemc_header
25extern "C" int mon_check();
26`verilog
27`endif
28
29   input clk;
30
31   localparam int DEPTH /* verilator public_flat_rd */ = 16;
32   localparam longint PARAM_LONG /* verilator public_flat_rd */ = 64'hFEDCBA9876543210;
33   localparam string PARAM_STR /* verilator public_flat_rd */ = "'some string value'";
34
35   reg [WIDTH-1:0] mem0 [DEPTH:1] /*verilator public_flat_rw @(posedge clk) */;
36   integer    i, status;
37
38   // Test loop
39   initial begin
40`ifdef VERILATOR
41      status = $c32("mon_check()");
42`endif
43`ifdef IVERILOG
44     status = $mon_check();
45`endif
46`ifndef USE_VPI_NOT_DPI
47     status = mon_check();
48`endif
49
50    if (status!=0) begin
51      $write("%%Error: t_vpi_param.cpp:%0d: C Test failed\n", status);
52      $stop;
53    end
54    $write("*-* All Finished *-*\n");
55    $finish;
56   end
57
58endmodule : t
59