-
Notifications
You must be signed in to change notification settings - Fork 16
/
refmod.sv
32 lines (26 loc) · 898 Bytes
/
refmod.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import "DPI-C" context function int sum(int a, int b);
class refmod extends uvm_component;
`uvm_component_utils(refmod)
packet_in tr_in;
packet_out tr_out;
integer a, b;
uvm_get_port #(packet_in) in;
uvm_put_port #(packet_out) out;
function new(string name = "refmod", uvm_component parent);
super.new(name, parent);
in = new("in", this);
out = new("out", this);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
tr_out = packet_out::type_id::create("tr_out", this);
endfunction: build_phase
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
forever begin
in.get(tr_in);
tr_out.data = sum(tr_in.A, tr_in.B);
out.put(tr_out);
end
endtask: run_phase
endclass: refmod