init
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
|F|u|n|c|t|i|o|n|a|l| |V|e|r|i|f|i|c|a|t|i|o|n| |o|f| |H|a|r|d|w|a|r|e|
|
||||
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
|
||||
FILE apb_test_base.sv
|
||||
|
||||
DESCRIPTION base test to be extended by other tests
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
`ifndef APB_TEST_BASE_SV
|
||||
`define APB_TEST_BASE_SV
|
||||
|
||||
/**
|
||||
* Class: apb_test_base
|
||||
*/
|
||||
class apb_test_base extends uvm_test;
|
||||
|
||||
// UVM factory registration
|
||||
`uvm_component_utils (apb_test_base)
|
||||
|
||||
// main environment
|
||||
apb_env env;
|
||||
|
||||
// new - constructor
|
||||
function new(string name = "apb_test_base", uvm_component parent = null);
|
||||
super.new(name, parent);
|
||||
endfunction : new
|
||||
|
||||
// UVM build_phase
|
||||
function void build_phase(uvm_phase phase);
|
||||
super.build_phase(phase);
|
||||
// build environment
|
||||
env = apb_env::type_id::create("env", this);
|
||||
endfunction : build_phase
|
||||
|
||||
// UVM end_of_elaboration_phase
|
||||
function void end_of_elaboration_phase(uvm_phase phase);
|
||||
super.end_of_elaboration_phase(phase);
|
||||
// display verification environment topology
|
||||
uvm_top.print_topology();
|
||||
endfunction : end_of_elaboration_phase
|
||||
|
||||
endclass : apb_test_base
|
||||
|
||||
`endif
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/****************************************************************************
|
||||
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
|F|u|n|c|t|i|o|n|a|l| |V|e|r|i|f|i|c|a|t|i|o|n| |o|f| |H|a|r|d|w|a|r|e|
|
||||
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
|
||||
FILE apb_test_lib.sv
|
||||
|
||||
DESCRIPTION test includes
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
`ifndef APB_TEST_LIB_SV
|
||||
`define APB_TEST_LIB_SV
|
||||
|
||||
`include "apb_test_base.sv"
|
||||
`include "apb_test_simple.sv"
|
||||
|
||||
`endif
|
||||
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
|F|u|n|c|t|i|o|n|a|l| |V|e|r|i|f|i|c|a|t|i|o|n| |o|f| |H|a|r|d|w|a|r|e|
|
||||
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
|
||||
FILE apb_test_simple.sv
|
||||
|
||||
DESCRIPTION simple test for debug
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
`ifndef APB_TEST_SIMPLE_SV
|
||||
`define APB_TEST_SIMPLE_SV
|
||||
|
||||
/**
|
||||
* Class: apb_test_simple
|
||||
*/
|
||||
class apb_test_simple extends apb_test_base;
|
||||
|
||||
// UVM factory registration
|
||||
`uvm_component_utils (apb_test_simple)
|
||||
|
||||
// sequences
|
||||
apb_master_simple_seq master_seq;
|
||||
apb_slave_simple_seq slave_seq;
|
||||
|
||||
// new - constructor
|
||||
function new(string name = "apb_test_simple", uvm_component parent = null);
|
||||
super.new(name, parent);
|
||||
endfunction : new
|
||||
|
||||
// UVM build_phase
|
||||
function void build_phase(uvm_phase phase);
|
||||
super.build_phase(phase);
|
||||
// build all sequences
|
||||
master_seq = apb_master_simple_seq::type_id::create("master_seq");
|
||||
slave_seq = apb_slave_simple_seq::type_id::create("slave_seq");
|
||||
endfunction : build_phase
|
||||
|
||||
// UVM run_phase
|
||||
task run_phase(uvm_phase phase);
|
||||
assert(master_seq.randomize()); // random fields in master seq.
|
||||
|
||||
phase.raise_objection(this); // test cannot end yet
|
||||
|
||||
// start all sequences
|
||||
fork
|
||||
master_seq.start(env.master.seqr);
|
||||
slave_seq.start(env.slaves[0].seqr); // runs forever
|
||||
join_any
|
||||
// only way to get here is if master sequence finished
|
||||
|
||||
phase.drop_objection(this); // test can end
|
||||
endtask : run_phase
|
||||
|
||||
endclass : apb_test_simple
|
||||
|
||||
`endif
|
||||
|
||||
Reference in New Issue
Block a user