forked from letitbe0201/AXI-DMA-master-verification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample_test.sv
103 lines (85 loc) · 3.39 KB
/
sample_test.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
`ifndef SAMPLE_TEST_SV
`define SAMPLE_TEST_SV
`define NEED_DEBUG 1
class sample_test extends component_base #(
.BASE(uvm_test),
.CONFIGURATION(sample_test_configuration)
);
dma_axi_master_agent master_agent;
dma_axi_master_sequencer master_sequencer;
dma_axi_slave_agent slave_agent;
dma_axi_slave_sequencer slave_sequencer;
apb_config_agent config_agent;
dma_apb_reg_model regmodel; /*RAL*/
dma_ral_adapter m_adapter; /*RAL*/
dma_apb_config_seq config_seq; /*RAL*/
dma_axi_sb sb;
`uvm_component_utils(sample_test);
function new(string name="sample_test", uvm_component par=null);
super.new(name, par);
`uvm_info("SRANDOM", $sformatf("Initial random seed: %0d", $get_initial_random_seed), UVM_NONE)
endfunction : new
function void create_configuration();
configuration = CONFIGURATION::type_id::create("configuration");
void'(uvm_config_db #(dma_axi_vif)::get(null, "", "vif", configuration.axi_cfg.vif));
if (configuration.randomize()) begin
`uvm_info(get_name(), $sformatf("Configuration...\n%s", configuration.sprint()), UVM_NONE)
end
else begin
`uvm_fatal(get_name(), "Randomization FAILED!")
end
endfunction : create_configuration
function void build_phase(uvm_phase phase);
super.build_phase(phase);
slave_agent = dma_axi_slave_agent::type_id::create("slave_agent", this);
slave_agent.set_configuration(configuration.axi_cfg);
config_agent = apb_config_agent::type_id::create("config_agent", this);
regmodel = dma_apb_reg_model::type_id::create("regmodel", this); /*RAL*/
regmodel.build(); /*RAL*/
m_adapter = dma_ral_adapter::type_id::create("m_adapter",, get_full_name()); /*RAL*/
config_seq = dma_apb_config_seq::type_id::create("config_seq");
sb = dma_axi_sb::type_id::create("dma_axi_sb", this);
// sb.set_configuration(configuration.axi_cfg);
endfunction : build_phase
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
slave_sequencer = slave_agent.sequencer;
regmodel.default_map.set_sequencer(.sequencer(config_agent.sqr), .adapter(m_adapter)); /*RAL*/
regmodel.default_map.set_base_addr('h0); /*RAL*/
config_agent.apb_port_ag.connect(sb.apb_fifo.analysis_export);
slave_agent.sb_port_ag.connect(sb.axi_addr_fifo.analysis_export);
endfunction : connect_phase
function void end_of_elaboration_phase(uvm_phase phase);
super.end_of_elaboration_phase(phase);
uvm_config_db#(uvm_object_wrapper)::set(slave_sequencer, "run_phase", "default_sequence", dma_axi_slave_default_sequence::type_id::get());
uvm_top.print_topology();
// slave
endfunction : end_of_elaboration_phase
/*RAL*/
task run_phase(uvm_phase phase);
# 200;
phase.raise_objection(this);
if (!config_seq.randomize()) begin
`uvm_error("[SAMPLE_TEST]", "CONFIG SEQ RANDOMIZATION FAILED.")
end
config_seq.regmodel = regmodel;
config_seq.starting_phase = phase;
config_seq.start(config_agent.sqr);
phase.drop_objection(this);
////////test
/*
# 200;
phase.raise_objection(this);
if (!config_seq.randomize()) begin
`uvm_error("[SAMPLE_TEST]", "CONFIG SEQ RANDOMIZATION FAILED.")
end
config_seq.regmodel = regmodel;
config_seq.starting_phase = phase;
config_seq.start(config_agent.sqr);
phase.drop_objection(this);
*/
////////test
endtask : run_phase
/*RAL*/
endclass : sample_test
`endif