Add VPI examples

This commit is contained in:
Nikolay Puzanov
2022-07-12 18:47:44 +03:00
parent d298a14bff
commit 2c8c60429c
10 changed files with 257 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
`timescale 1ps/1ps
`include "utest.vh"
module vpi_log2 #(parameter ARGUMENT = 1.0,
parameter SIGMA = 1e-6);
real dut, gold;
initial begin
gold = $ln(ARGUMENT) / $ln(2);
dut = $log2(ARGUMENT);
`log_info(("Gold: %0f", gold));
`log_info((" DUT: %0f", dut));
if ($abs(gold - dut) > SIGMA)
`log_error(("FAIL"));
$finish;
end
endmodule // vpi_log2