SV: import method in DPI - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

205


15
 
1
// Code your testbench here
2
// or browse Examples
3
module tb;
4
5
  import "DPI-C" function void addition(int a, int b);
6
  
7
  initial
8
  begin
9
    $display("Before add function call");
10
    addition(4,5);
11
    $display("After add function call");
12
  end
13
  
14
endmodule
15
7
 
1
2
#include <stdio.h>
3
4
  void addition(int a, int b) {
5
  printf("Addition of %0d and %0d is %0d\n", a, b, a+b);
6
7
}
798 views and 0 likes     
 
import method in SV example

import method in SV example

150:0