forked from naragece/uvm-testbench-tutorial-simple-adder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vhdl_adder_tb.sv
55 lines (45 loc) · 1.45 KB
/
vhdl_adder_tb.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
`include "simpleadder_pkg.sv"
`include "simpleadder_if.sv"
`include "vunit_defines.svh"
`include "uvm_macros.svh"
module vhdl_adder_tb;
import uvm_pkg::*;
import simpleadder_pkg::*;
//Interface declaration
simpleadder_if vif();
//Connects the Interface to the DUT
vhdl_adder dut(.clk(vif.sig_clock),
.en_i(vif.sig_en_i),
.ina(vif.sig_ina),
.inb(vif.sig_inb),
.en_o(vif.sig_en_o),
.outp(vif.sig_out)
);
// Clock generator
always
#5 vif.sig_clock = ~vif.sig_clock;
`TEST_SUITE begin
`TEST_SUITE_SETUP begin
// UVM can't control the end of the simulation, VUnit does that
uvm_root root;
root = uvm_root::get();
root.set_finish_on_completion(0);
//Registers the Interface in the configuration block so that other
//blocks can use it
uvm_resource_db#(virtual simpleadder_if)::set
(.scope("ifs"), .name("simpleadder_if"), .val(vif));
end
`TEST_CASE_SETUP begin
vif.sig_clock <= 1;
end
`TEST_CASE("Adder UVM test") begin
run_test("simpleadder_test");
end
`TEST_CASE_CLEANUP begin
uvm_report_server server;
server = uvm_report_server::get_server();
`CHECK_EQUAL(server.get_severity_count(UVM_ERROR), 0);
`CHECK_EQUAL(server.get_severity_count(UVM_FATAL), 0);
end
end
endmodule