-
Notifications
You must be signed in to change notification settings - Fork 1
/
Code_25 UVM Blocking_put_port.sv
89 lines (56 loc) · 1.86 KB
/
Code_25 UVM Blocking_put_port.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
`include "uvm_macros.svh"
import uvm_pkg::*;
class producer extends uvm_component;
`uvm_component_utils(producer)
int data = 12;
uvm_blocking_put_port #(int) send;
function new(input string path = "producer", uvm_component parent = null);
super.new(path, parent);
send = new("send", this);
endfunction
endclass
////////////////////////////////////////////////
class consumer extends uvm_component;
`uvm_component_utils(consumer)
uvm_blocking_put_export #(int) recv;
function new(input string path = "consumer", uvm_component parent = null);
super.new(path, parent);
recv = new("recv", this);
endfunction
endclass
//////////////////////////////////////////////////////////////////////////////////
class env extends uvm_env;
`uvm_component_utils(env)
producer p;
consumer c;
function new(input string path = "env", uvm_component parent = null);
super.new(path, parent);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
p = producer::type_id::create("p",this);
c = consumer::type_id::create("c", this);
endfunction
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
p.send.connect(c.recv);
endfunction
endclass
///////////////////////////////////////////////////
class test extends uvm_test;
`uvm_component_utils(test)
env e;
function new(input string path = "test", uvm_component parent = null);
super.new(path, parent);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
e = env::type_id::create("e",this);
endfunction
endclass
//////////////////////////////////////////////
module tb;
initial begin
run_test("test");
end
endmodule