2024-07-24 12:40:39 +02:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
|
//
|
2026-01-27 02:24:34 +01:00
|
|
|
// This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
// under the terms of either the GNU Lesser General Public License Version 3
|
|
|
|
|
// or the Perl Artistic License Version 2.0.
|
|
|
|
|
// SPDX-FileCopyrightText: 2024 Antmicro
|
2024-07-24 12:40:39 +02:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
|
|
|
|
|
2025-09-13 15:28:43 +02:00
|
|
|
module t;
|
2026-03-03 13:21:24 +01:00
|
|
|
int a = 123;
|
|
|
|
|
int b = 321;
|
|
|
|
|
int out;
|
2024-07-24 12:40:39 +02:00
|
|
|
|
2026-03-03 13:21:24 +01:00
|
|
|
import "DPI-C" function void dpii_add(
|
|
|
|
|
int a,
|
|
|
|
|
int b,
|
|
|
|
|
ref int out
|
|
|
|
|
);
|
|
|
|
|
import "DPI-C" function int dpii_add_check(
|
|
|
|
|
int actual,
|
|
|
|
|
int expected
|
|
|
|
|
);
|
2024-07-24 12:40:39 +02:00
|
|
|
|
2026-03-03 13:21:24 +01:00
|
|
|
initial begin
|
|
|
|
|
dpii_add(a, b, out);
|
|
|
|
|
if (dpii_add_check(out, (a + b)) != 1) begin
|
|
|
|
|
$write("%%Error: Failure in DPI tests\n");
|
|
|
|
|
$stop;
|
|
|
|
|
end
|
|
|
|
|
else begin
|
|
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
|
$finish;
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-07-24 12:40:39 +02:00
|
|
|
|
|
|
|
|
endmodule
|