/****************************************************************************
    +-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
    |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

